Skip to content

Commit

Permalink
Add compilation database functions
Browse files Browse the repository at this point in the history
  • Loading branch information
mjsabby committed Jul 10, 2016
1 parent 9af19a5 commit ba2cba3
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 3 deletions.
4 changes: 2 additions & 2 deletions ClangSharp.sln
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.31101.0
# Visual Studio 2015
VisualStudioVersion = 14.0.20420.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClangSharp", "ClangSharp.csproj", "{6091B9F6-D75E-4457-BF5B-89076FCB262B}"
EndProject
Expand Down
78 changes: 78 additions & 0 deletions Generated.cs
Expand Up @@ -465,6 +465,36 @@ public CXIndexAction(IntPtr pointer)
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate CXVisitorResult CXFieldVisitor(CXCursor @C, IntPtr @client_data);

public partial struct CXCompilationDatabase
{
public CXCompilationDatabase(IntPtr pointer)
{
this.Pointer = pointer;
}

public IntPtr Pointer;
}

public partial struct CXCompileCommands
{
public CXCompileCommands(IntPtr pointer)
{
this.Pointer = pointer;
}

public IntPtr Pointer;
}

public partial struct CXCompileCommand
{
public CXCompileCommand(IntPtr pointer)
{
this.Pointer = pointer;
}

public IntPtr Pointer;
}

public enum CXErrorCode : int
{
@CXError_Success = 0,
Expand Down Expand Up @@ -1171,6 +1201,12 @@ public enum CXCommentParamPassDirection : int
@CXCommentParamPassDirection_InOut = 2,
}

public enum CXCompilationDatabase_Error : int
{
@CXCompilationDatabase_NoError = 0,
@CXCompilationDatabase_CanNotLoadDatabase = 1,
}

public static partial class clang
{
private const string libraryPath = "libclang";
Expand Down Expand Up @@ -2093,5 +2129,47 @@ public static partial class clang
[DllImport(libraryPath, EntryPoint = "clang_FullComment_getAsXML", CallingConvention = CallingConvention.Cdecl)]
public static extern CXString FullComment_getAsXML(CXComment @Comment);

[DllImport(libraryPath, EntryPoint = "clang_CompilationDatabase_fromDirectory", CallingConvention = CallingConvention.Cdecl)]
public static extern CXCompilationDatabase CompilationDatabase_fromDirectory([MarshalAs(UnmanagedType.LPStr)] string @BuildDir, out CXCompilationDatabase_Error @ErrorCode);

[DllImport(libraryPath, EntryPoint = "clang_CompilationDatabase_dispose", CallingConvention = CallingConvention.Cdecl)]
public static extern void CompilationDatabase_dispose(CXCompilationDatabase @param0);

[DllImport(libraryPath, EntryPoint = "clang_CompilationDatabase_getCompileCommands", CallingConvention = CallingConvention.Cdecl)]
public static extern CXCompileCommands CompilationDatabase_getCompileCommands(CXCompilationDatabase @param0, [MarshalAs(UnmanagedType.LPStr)] string @CompleteFileName);

[DllImport(libraryPath, EntryPoint = "clang_CompilationDatabase_getAllCompileCommands", CallingConvention = CallingConvention.Cdecl)]
public static extern CXCompileCommands CompilationDatabase_getAllCompileCommands(CXCompilationDatabase @param0);

[DllImport(libraryPath, EntryPoint = "clang_CompileCommands_dispose", CallingConvention = CallingConvention.Cdecl)]
public static extern void CompileCommands_dispose(CXCompileCommands @param0);

[DllImport(libraryPath, EntryPoint = "clang_CompileCommands_getSize", CallingConvention = CallingConvention.Cdecl)]
public static extern uint CompileCommands_getSize(CXCompileCommands @param0);

[DllImport(libraryPath, EntryPoint = "clang_CompileCommands_getCommand", CallingConvention = CallingConvention.Cdecl)]
public static extern CXCompileCommand CompileCommands_getCommand(CXCompileCommands @param0, uint @I);

[DllImport(libraryPath, EntryPoint = "clang_CompileCommand_getDirectory", CallingConvention = CallingConvention.Cdecl)]
public static extern CXString CompileCommand_getDirectory(CXCompileCommand @param0);

[DllImport(libraryPath, EntryPoint = "clang_CompileCommand_getFilename", CallingConvention = CallingConvention.Cdecl)]
public static extern CXString CompileCommand_getFilename(CXCompileCommand @param0);

[DllImport(libraryPath, EntryPoint = "clang_CompileCommand_getNumArgs", CallingConvention = CallingConvention.Cdecl)]
public static extern uint CompileCommand_getNumArgs(CXCompileCommand @param0);

[DllImport(libraryPath, EntryPoint = "clang_CompileCommand_getArg", CallingConvention = CallingConvention.Cdecl)]
public static extern CXString CompileCommand_getArg(CXCompileCommand @param0, uint @I);

[DllImport(libraryPath, EntryPoint = "clang_CompileCommand_getNumMappedSources", CallingConvention = CallingConvention.Cdecl)]
public static extern uint CompileCommand_getNumMappedSources(CXCompileCommand @param0);

[DllImport(libraryPath, EntryPoint = "clang_CompileCommand_getMappedSourcePath", CallingConvention = CallingConvention.Cdecl)]
public static extern CXString CompileCommand_getMappedSourcePath(CXCompileCommand @param0, uint @I);

[DllImport(libraryPath, EntryPoint = "clang_CompileCommand_getMappedSourceContent", CallingConvention = CallingConvention.Cdecl)]
public static extern CXString CompileCommand_getMappedSourceContent(CXCompileCommand @param0, uint @I);

}
}
2 changes: 1 addition & 1 deletion build.bat
Expand Up @@ -9,5 +9,5 @@ if [%2]==[] (
)

csc /out:ClangSharpPInvokeGenerator.exe ClangSharpPInvokeGenerator\*.cs
ClangSharpPInvokeGenerator.exe --m clang --p clang_ --namespace ClangSharp --output Generated.cs --libraryPath %1 --include %2 --file %2/clang-c/Index.h --file %2/clang-c/CXString.h --file %2/clang-c/Documentation.h --file %2/clang-c/CXErrorCode.h
ClangSharpPInvokeGenerator.exe --m clang --p clang_ --namespace ClangSharp --output Generated.cs --libraryPath %1 --include %2 --file %2/clang-c/Index.h --file %2/clang-c/CXString.h --file %2/clang-c/Documentation.h --file %2/clang-c/CXErrorCode.h --file %2/clang-c/BuildSystem.h --file %2/clang-c/CXCompilationDatabase.h
csc /target:library /out:ClangSharp.dll Generated.cs Extensions.cs

0 comments on commit ba2cba3

Please sign in to comment.