Finalize Bindings

This commit is contained in:
Rune
2026-01-29 19:12:36 +01:00
parent fb9601fcc6
commit a369ab2dc0
12 changed files with 8201 additions and 2 deletions

164
BuildSystem.bf Normal file
View File

@@ -0,0 +1,164 @@
// This file was auto-generated by Cpp2Beef
using System;
using System.Interop;
namespace LibClang;
static
{
/*==-- clang-c/BuildSystem.h - Utilities for use by build systems -*- C -*-===*\
|* *|
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
|* Exceptions. *|
|* See https://llvm.org/LICENSE.txt for license information. *|
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
|* *|
|*===----------------------------------------------------------------------===*|
|* *|
|* This header provides various utilities for use by build systems. *|
|* *|
\*===----------------------------------------------------------------------===*/
}
extension Clang
{
/**
* \defgroup BUILD_SYSTEM Build system utilities
* @{
*/
/**
* Return the timestamp for use with Clang's
* \c -fbuild-session-timestamp= option.
*/
[Import(Clang.dll)] [LinkName("clang_getBuildSessionTimestamp")] public static extern c_ulonglong GetBuildSessionTimestamp();
}
/**
* Object encapsulating information about overlaying virtual
* file/directories over the real file system.
*/
[CRepr] public struct CXVirtualFileOverlayImpl; public struct CXVirtualFileOverlay : this(CXVirtualFileOverlayImpl* ptr);
extension Clang
{
/**
* Create a \c CXVirtualFileOverlay object.
* Must be disposed with \c clang_VirtualFileOverlay_dispose().
*
* \param options is reserved, always pass 0.
*/
[Import(Clang.dll)] [LinkName("clang_VirtualFileOverlay_create")] public static extern CXVirtualFileOverlay VirtualFileOverlay_Create(c_uint options);
/**
* Map an absolute virtual file path to an absolute real one.
* The virtual path must be canonicalized (not contain "."/"..").
* \returns 0 for success, non-zero to indicate an error.
*/
[Import(Clang.dll)] [LinkName("clang_VirtualFileOverlay_addFileMapping")] public static extern CXErrorCode VirtualFileOverlay_AddFileMapping(CXVirtualFileOverlay, c_char* virtualPath, c_char* realPath);
/**
* Set the case sensitivity for the \c CXVirtualFileOverlay object.
* The \c CXVirtualFileOverlay object is case-sensitive by default, this
* option can be used to override the default.
* \returns 0 for success, non-zero to indicate an error.
*/
[Import(Clang.dll)] [LinkName("clang_VirtualFileOverlay_setCaseSensitivity")] public static extern CXErrorCode VirtualFileOverlay_SetCaseSensitivity(CXVirtualFileOverlay, c_int caseSensitive);
/**
* Write out the \c CXVirtualFileOverlay object to a char buffer.
*
* \param options is reserved, always pass 0.
* \param out_buffer_ptr pointer to receive the buffer pointer, which should be
* disposed using \c clang_free().
* \param out_buffer_size pointer to receive the buffer size.
* \returns 0 for success, non-zero to indicate an error.
*/
[Import(Clang.dll)] [LinkName("clang_VirtualFileOverlay_writeToBuffer")] public static extern CXErrorCode VirtualFileOverlay_WriteToBuffer(CXVirtualFileOverlay, c_uint options, c_char** out_buffer_ptr, c_uint* out_buffer_size);
/**
* free memory allocated by libclang, such as the buffer returned by
* \c CXVirtualFileOverlay() or \c clang_ModuleMapDescriptor_writeToBuffer().
*
* \param buffer memory pointer to free.
*/
[Import(Clang.dll)] [LinkName("clang_free")] public static extern void Free(void* buffer);
/**
* Dispose a \c CXVirtualFileOverlay object.
*/
[Import(Clang.dll)] [LinkName("clang_VirtualFileOverlay_dispose")] public static extern void VirtualFileOverlay_Dispose(CXVirtualFileOverlay);
}
/**
* Object encapsulating information about a module.map file.
*/
[CRepr] public struct CXModuleMapDescriptorImpl; public struct CXModuleMapDescriptor : this(CXModuleMapDescriptorImpl* ptr);
extension Clang
{
/**
* Create a \c CXModuleMapDescriptor object.
* Must be disposed with \c clang_ModuleMapDescriptor_dispose().
*
* \param options is reserved, always pass 0.
*/
[Import(Clang.dll)] [LinkName("clang_ModuleMapDescriptor_create")] public static extern CXModuleMapDescriptor ModuleMapDescriptor_Create(c_uint options);
/**
* Sets the framework module name that the module.map describes.
* \returns 0 for success, non-zero to indicate an error.
*/
[Import(Clang.dll)] [LinkName("clang_ModuleMapDescriptor_setFrameworkModuleName")] public static extern CXErrorCode ModuleMapDescriptor_SetFrameworkModuleName(CXModuleMapDescriptor, c_char* name);
/**
* Sets the umbrella header name that the module.map describes.
* \returns 0 for success, non-zero to indicate an error.
*/
[Import(Clang.dll)] [LinkName("clang_ModuleMapDescriptor_setUmbrellaHeader")] public static extern CXErrorCode ModuleMapDescriptor_SetUmbrellaHeader(CXModuleMapDescriptor, c_char* name);
/**
* Write out the \c CXModuleMapDescriptor object to a char buffer.
*
* \param options is reserved, always pass 0.
* \param out_buffer_ptr pointer to receive the buffer pointer, which should be
* disposed using \c clang_free().
* \param out_buffer_size pointer to receive the buffer size.
* \returns 0 for success, non-zero to indicate an error.
*/
[Import(Clang.dll)] [LinkName("clang_ModuleMapDescriptor_writeToBuffer")] public static extern CXErrorCode ModuleMapDescriptor_WriteToBuffer(CXModuleMapDescriptor, c_uint options, c_char** out_buffer_ptr, c_uint* out_buffer_size);
/**
* Dispose a \c CXModuleMapDescriptor object.
*/
[Import(Clang.dll)] [LinkName("clang_ModuleMapDescriptor_dispose")] public static extern void ModuleMapDescriptor_Dispose(CXModuleMapDescriptor);
}
/**
* @}
*/
/* CLANG_C_BUILD_SYSTEM_H */

186
CXCompilationDatabase.bf Normal file
View File

@@ -0,0 +1,186 @@
// This file was auto-generated by Cpp2Beef
using System;
using System.Interop;
namespace LibClang;
static
{
/*===-- clang-c/CXCompilationDatabase.h - Compilation database ---*- C -*-===*\
|* *|
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
|* Exceptions. *|
|* See https://llvm.org/LICENSE.txt for license information. *|
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
|* *|
|*===----------------------------------------------------------------------===*|
|* *|
|* This header provides a public interface to use CompilationDatabase without *|
|* the full Clang C++ API. *|
|* *|
\*===----------------------------------------------------------------------===*/
}
/** \defgroup COMPILATIONDB CompilationDatabase functions
* \ingroup CINDEX
*
* @{
*/
/**
* A compilation database holds all information used to compile files in a
* project. For each file in the database, it can be queried for the working
* directory or the command line used for the compiler invocation.
*
* Must be freed by \c clang_CompilationDatabase_dispose
*/
public struct CXCompilationDatabase : this(void* ptr);
/**
* Contains the results of a search in the compilation database
*
* When searching for the compile command for a file, the compilation db can
* return several commands, as the file may have been compiled with
* different options in different places of the project. This choice of compile
* commands is wrapped in this opaque data structure. It must be freed by
* \c clang_CompileCommands_dispose.
*/
public struct CXCompileCommands : this(void* ptr);
/**
* Represents the command line invocation to compile a specific file.
*/
public struct CXCompileCommand : this(void* ptr);
/**
* Error codes for Compilation Database
*/
[AllowDuplicates] public enum CXCompilationDatabase_Error : c_int {
/*
* No error occurred
*/
NoError = 0,
/*
* Database can not be loaded
*/
CanNotLoadDatabase = 1,
}
extension Clang
{
/**
* Creates a compilation database from the database found in directory
* buildDir. For example, CMake can output a compile_commands.json which can
* be used to build the database.
*
* It must be freed by \c clang_CompilationDatabase_dispose.
*/
[Import(Clang.dll)] [LinkName("clang_CompilationDatabase_fromDirectory")] public static extern CXCompilationDatabase CompilationDatabase_FromDirectory(c_char* BuildDir, CXCompilationDatabase_Error* ErrorCode);
/**
* Free the given compilation database
*/
[Import(Clang.dll)] [LinkName("clang_CompilationDatabase_dispose")] public static extern void CompilationDatabase_Dispose(CXCompilationDatabase);
/**
* Find the compile commands used for a file. The compile commands
* must be freed by \c clang_CompileCommands_dispose.
*/
[Import(Clang.dll)] [LinkName("clang_CompilationDatabase_getCompileCommands")] public static extern CXCompileCommands CompilationDatabase_GetCompileCommands(CXCompilationDatabase, c_char* CompleteFileName);
/**
* Get all the compile commands in the given compilation database.
*/
[Import(Clang.dll)] [LinkName("clang_CompilationDatabase_getAllCompileCommands")] public static extern CXCompileCommands CompilationDatabase_GetAllCompileCommands(CXCompilationDatabase);
/**
* Free the given CompileCommands
*/
[Import(Clang.dll)] [LinkName("clang_CompileCommands_dispose")] public static extern void CompileCommands_Dispose(CXCompileCommands);
/**
* Get the number of CompileCommand we have for a file
*/
[Import(Clang.dll)] [LinkName("clang_CompileCommands_getSize")] public static extern c_uint CompileCommands_GetSize(CXCompileCommands);
/**
* Get the I'th CompileCommand for a file
*
* Note : 0 <= i < clang_CompileCommands_getSize(CXCompileCommands)
*/
[Import(Clang.dll)] [LinkName("clang_CompileCommands_getCommand")] public static extern CXCompileCommand CompileCommands_GetCommand(CXCompileCommands, c_uint I);
/**
* Get the working directory where the CompileCommand was executed from
*/
[Import(Clang.dll)] [LinkName("clang_CompileCommand_getDirectory")] public static extern CXString CompileCommand_GetDirectory(CXCompileCommand);
/**
* Get the filename associated with the CompileCommand.
*/
[Import(Clang.dll)] [LinkName("clang_CompileCommand_getFilename")] public static extern CXString CompileCommand_GetFilename(CXCompileCommand);
/**
* Get the number of arguments in the compiler invocation.
*
*/
[Import(Clang.dll)] [LinkName("clang_CompileCommand_getNumArgs")] public static extern c_uint CompileCommand_GetNumArgs(CXCompileCommand);
/**
* Get the I'th argument value in the compiler invocations
*
* Invariant :
* - argument 0 is the compiler executable
*/
[Import(Clang.dll)] [LinkName("clang_CompileCommand_getArg")] public static extern CXString CompileCommand_GetArg(CXCompileCommand, c_uint I);
/**
* Get the number of source mappings for the compiler invocation.
*/
[Import(Clang.dll)] [LinkName("clang_CompileCommand_getNumMappedSources")] public static extern c_uint CompileCommand_GetNumMappedSources(CXCompileCommand);
/**
* Get the I'th mapped source path for the compiler invocation.
*/
[Import(Clang.dll)] [LinkName("clang_CompileCommand_getMappedSourcePath")] public static extern CXString CompileCommand_GetMappedSourcePath(CXCompileCommand, c_uint I);
/**
* Get the I'th mapped source content for the compiler invocation.
*/
[Import(Clang.dll)] [LinkName("clang_CompileCommand_getMappedSourceContent")] public static extern CXString CompileCommand_GetMappedSourceContent(CXCompileCommand, c_uint I);
}
/**
* @}
*/

73
CXErrorCode.bf Normal file
View File

@@ -0,0 +1,73 @@
// This file was auto-generated by Cpp2Beef
using System;
using System.Interop;
namespace LibClang;
static
{
/*===-- clang-c/CXErrorCode.h - C Index Error Codes --------------*- C -*-===*\
|* *|
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
|* Exceptions. *|
|* See https://llvm.org/LICENSE.txt for license information. *|
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
|* *|
|*===----------------------------------------------------------------------===*|
|* *|
|* This header provides the CXErrorCode enumerators. *|
|* *|
\*===----------------------------------------------------------------------===*/
}
/**
* Error codes returned by libclang routines.
*
* Zero (\c CXError_Success) is the only error code indicating success. Other
* error codes, including not yet assigned non-zero values, indicate errors.
*/
[AllowDuplicates] public enum CXErrorCode : c_int {
/**
* No error.
*/
Success = 0,
/**
* A generic error code, no further details are available.
*
* Errors of this kind can get their own specific error codes in future
* libclang versions.
*/
Failure = 1,
/**
* libclang crashed while performing the requested operation.
*/
Crashed = 2,
/**
* The function detected that the arguments violate the function
* contract.
*/
InvalidArguments = 3,
/**
* An AST deserialization error has occurred.
*/
ASTReadError = 4,
}

83
CXString.bf Normal file
View File

@@ -0,0 +1,83 @@
// This file was auto-generated by Cpp2Beef
using System;
using System.Interop;
namespace LibClang;
static
{
/*===-- clang-c/CXString.h - C Index strings --------------------*- C -*-===*\
|* *|
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
|* Exceptions. *|
|* See https://llvm.org/LICENSE.txt for license information. *|
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
|* *|
|*===----------------------------------------------------------------------===*|
|* *|
|* This header provides the interface to C Index strings. *|
|* *|
\*===----------------------------------------------------------------------===*/
}
/**
* \defgroup CINDEX_STRING String manipulation routines
* \ingroup CINDEX
*
* @{
*/
/**
* A character string.
*
* The \c CXString type is used to return strings from the interface when
* the ownership of that string might differ from one call to the next.
* Use \c clang_getCString() to retrieve the string data and, once finished
* with the string data, call \c clang_disposeString() to free the string.
*/
[CRepr] public struct CXString {
public void* data;
public c_uint private_flags;
}
[CRepr] public struct CXStringSet {
public CXString* Strings;
public c_uint Count;
}
extension Clang
{
/**
* Retrieve the character data associated with the given string.
*/
[Import(Clang.dll)] [LinkName("clang_getCString")] public static extern c_char* GetCString(CXString string);
/**
* Free the given string.
*/
[Import(Clang.dll)] [LinkName("clang_disposeString")] public static extern void DisposeString(CXString string);
/**
* Free the given string set.
*/
[Import(Clang.dll)] [LinkName("clang_disposeStringSet")] public static extern void DisposeStringSet(CXStringSet* set);
}
/**
* @}
*/

569
Documentation.bf Normal file
View File

@@ -0,0 +1,569 @@
// This file was auto-generated by Cpp2Beef
using System;
using System.Interop;
namespace LibClang;
static
{
/*==-- clang-c/Documentation.h - Utilities for comment processing -*- C -*-===*\
|* *|
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
|* Exceptions. *|
|* See https://llvm.org/LICENSE.txt for license information. *|
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
|* *|
|*===----------------------------------------------------------------------===*|
|* *|
|* This header provides a supplementary interface for inspecting *|
|* documentation comments. *|
|* *|
\*===----------------------------------------------------------------------===*/
}
/**
* \defgroup CINDEX_COMMENT Comment introspection
*
* The routines in this group provide access to information in documentation
* comments. These facilities are distinct from the core and may be subject to
* their own schedule of stability and deprecation.
*
* @{
*/
/**
* A parsed comment.
*/
[CRepr] public struct CXComment {
public void* ASTNode;
public CXTranslationUnit TranslationUnit;
}
extension Clang
{
/**
* Given a cursor that represents a documentable entity (e.g.,
* declaration), return the associated parsed comment as a
* \c CXComment_FullComment AST node.
*/
[Import(Clang.dll)] [LinkName("clang_Cursor_getParsedComment")] public static extern CXComment Cursor_GetParsedComment(CXCursor C);
}
/**
* Describes the type of the comment AST node (\c CXComment). A comment
* node can be considered block content (e. g., paragraph), inline content
* (plain text) or neither (the root AST node).
*/
[AllowDuplicates] public enum CXCommentKind : c_int {
/**
* Null comment. No AST node is constructed at the requested location
* because there is no text or a syntax error.
*/
Null = 0,
/**
* Plain text. Inline content.
*/
Text = 1,
/**
* A command with word-like arguments that is considered inline content.
*
* For example: \\c command.
*/
InlineCommand = 2,
/**
* HTML start tag with attributes (name-value pairs). Considered
* inline content.
*
* For example:
* \verbatim
* <br> <br /> <a href="http://example.org/">
* \endverbatim
*/
HTMLStartTag = 3,
/**
* HTML end tag. Considered inline content.
*
* For example:
* \verbatim
* </a>
* \endverbatim
*/
HTMLEndTag = 4,
/**
* A paragraph, contains inline comment. The paragraph itself is
* block content.
*/
Paragraph = 5,
/**
* A command that has zero or more word-like arguments (number of
* word-like arguments depends on command name) and a paragraph as an
* argument. Block command is block content.
*
* Paragraph argument is also a child of the block command.
*
* For example: \has 0 word-like arguments and a paragraph argument.
*
* AST nodes of special kinds that parser knows about (e. g., \\param
* command) have their own node kinds.
*/
BlockCommand = 6,
/**
* A \\param or \\arg command that describes the function parameter
* (name, passing direction, description).
*
* For example: \\param [in] ParamName description.
*/
ParamCommand = 7,
/**
* A \\tparam command that describes a template parameter (name and
* description).
*
* For example: \\tparam T description.
*/
TParamCommand = 8,
/**
* A verbatim block command (e. g., preformatted code). Verbatim
* block has an opening and a closing command and contains multiple lines of
* text (\c CXComment_VerbatimBlockLine child nodes).
*
* For example:
* \\verbatim
* aaa
* \\endverbatim
*/
VerbatimBlockCommand = 9,
/**
* A line of text that is contained within a
* CXComment_VerbatimBlockCommand node.
*/
VerbatimBlockLine = 10,
/**
* A verbatim line command. Verbatim line has an opening command,
* a single line of text (up to the newline after the opening command) and
* has no closing command.
*/
VerbatimLine = 11,
/**
* A full comment attached to a declaration, contains block content.
*/
FullComment = 12,
}
/**
* The most appropriate rendering mode for an inline command, chosen on
* command semantics in Doxygen.
*/
[AllowDuplicates] public enum CXCommentInlineCommandRenderKind : c_int {
/**
* Command argument should be rendered in a normal font.
*/
Normal,
/**
* Command argument should be rendered in a bold font.
*/
Bold,
/**
* Command argument should be rendered in a monospaced font.
*/
Monospaced,
/**
* Command argument should be rendered emphasized (typically italic
* font).
*/
Emphasized,
/**
* Command argument should not be rendered (since it only defines an anchor).
*/
Anchor,
}
/**
* Describes parameter passing direction for \\param or \\arg command.
*/
[AllowDuplicates] public enum CXCommentParamPassDirection : c_int {
/**
* The parameter is an input parameter.
*/
In,
/**
* The parameter is an output parameter.
*/
Out,
/**
* The parameter is an input and output parameter.
*/
InOut,
}
extension Clang
{
/**
* \param Comment AST node of any kind.
*
* \returns the type of the AST node.
*/
[Import(Clang.dll)] [LinkName("clang_Comment_getKind")] public static extern CXCommentKind Comment_GetKind(CXComment Comment);
/**
* \param Comment AST node of any kind.
*
* \returns number of children of the AST node.
*/
[Import(Clang.dll)] [LinkName("clang_Comment_getNumChildren")] public static extern c_uint Comment_GetNumChildren(CXComment Comment);
/**
* \param Comment AST node of any kind.
*
* \param ChildIdx child index (zero-based).
*
* \returns the specified child of the AST node.
*/
[Import(Clang.dll)] [LinkName("clang_Comment_getChild")] public static extern CXComment Comment_GetChild(CXComment Comment, c_uint ChildIdx);
/**
* A \c CXComment_Paragraph node is considered whitespace if it contains
* only \c CXComment_Text nodes that are empty or whitespace.
*
* Other AST nodes (except \c CXComment_Paragraph and \c CXComment_Text) are
* never considered whitespace.
*
* \returns non-zero if \c Comment is whitespace.
*/
[Import(Clang.dll)] [LinkName("clang_Comment_isWhitespace")] public static extern c_uint Comment_IsWhitespace(CXComment Comment);
/**
* \returns non-zero if \c Comment is inline content and has a newline
* immediately following it in the comment text. Newlines between paragraphs
* do not count.
*/
[Import(Clang.dll)] [LinkName("clang_InlineContentComment_hasTrailingNewline")] public static extern c_uint InlineContentComment_HasTrailingNewline(CXComment Comment);
/**
* \param Comment a \c CXComment_Text AST node.
*
* \returns text contained in the AST node.
*/
[Import(Clang.dll)] [LinkName("clang_TextComment_getText")] public static extern CXString TextComment_GetText(CXComment Comment);
/**
* \param Comment a \c CXComment_InlineCommand AST node.
*
* \returns name of the inline command.
*/
[Import(Clang.dll)] [LinkName("clang_InlineCommandComment_getCommandName")] public static extern CXString InlineCommandComment_GetCommandName(CXComment Comment);
/**
* \param Comment a \c CXComment_InlineCommand AST node.
*
* \returns the most appropriate rendering mode, chosen on command
* semantics in Doxygen.
*/
[Import(Clang.dll)] [LinkName("clang_InlineCommandComment_getRenderKind")] public static extern CXCommentInlineCommandRenderKind InlineCommandComment_GetRenderKind(CXComment Comment);
/**
* \param Comment a \c CXComment_InlineCommand AST node.
*
* \returns number of command arguments.
*/
[Import(Clang.dll)] [LinkName("clang_InlineCommandComment_getNumArgs")] public static extern c_uint InlineCommandComment_GetNumArgs(CXComment Comment);
/**
* \param Comment a \c CXComment_InlineCommand AST node.
*
* \param ArgIdx argument index (zero-based).
*
* \returns text of the specified argument.
*/
[Import(Clang.dll)] [LinkName("clang_InlineCommandComment_getArgText")] public static extern CXString InlineCommandComment_GetArgText(CXComment Comment, c_uint ArgIdx);
/**
* \param Comment a \c CXComment_HTMLStartTag or \c CXComment_HTMLEndTag AST
* node.
*
* \returns HTML tag name.
*/
[Import(Clang.dll)] [LinkName("clang_HTMLTagComment_getTagName")] public static extern CXString HTMLTagComment_GetTagName(CXComment Comment);
/**
* \param Comment a \c CXComment_HTMLStartTag AST node.
*
* \returns non-zero if tag is self-closing (for example, &lt;br /&gt;).
*/
[Import(Clang.dll)] [LinkName("clang_HTMLStartTagComment_isSelfClosing")] public static extern c_uint HTMLStartTagComment_IsSelfClosing(CXComment Comment);
/**
* \param Comment a \c CXComment_HTMLStartTag AST node.
*
* \returns number of attributes (name-value pairs) attached to the start tag.
*/
[Import(Clang.dll)] [LinkName("clang_HTMLStartTag_getNumAttrs")] public static extern c_uint HTMLStartTag_GetNumAttrs(CXComment Comment);
/**
* \param Comment a \c CXComment_HTMLStartTag AST node.
*
* \param AttrIdx attribute index (zero-based).
*
* \returns name of the specified attribute.
*/
[Import(Clang.dll)] [LinkName("clang_HTMLStartTag_getAttrName")] public static extern CXString HTMLStartTag_GetAttrName(CXComment Comment, c_uint AttrIdx);
/**
* \param Comment a \c CXComment_HTMLStartTag AST node.
*
* \param AttrIdx attribute index (zero-based).
*
* \returns value of the specified attribute.
*/
[Import(Clang.dll)] [LinkName("clang_HTMLStartTag_getAttrValue")] public static extern CXString HTMLStartTag_GetAttrValue(CXComment Comment, c_uint AttrIdx);
/**
* \param Comment a \c CXComment_BlockCommand AST node.
*
* \returns name of the block command.
*/
[Import(Clang.dll)] [LinkName("clang_BlockCommandComment_getCommandName")] public static extern CXString BlockCommandComment_GetCommandName(CXComment Comment);
/**
* \param Comment a \c CXComment_BlockCommand AST node.
*
* \returns number of word-like arguments.
*/
[Import(Clang.dll)] [LinkName("clang_BlockCommandComment_getNumArgs")] public static extern c_uint BlockCommandComment_GetNumArgs(CXComment Comment);
/**
* \param Comment a \c CXComment_BlockCommand AST node.
*
* \param ArgIdx argument index (zero-based).
*
* \returns text of the specified word-like argument.
*/
[Import(Clang.dll)] [LinkName("clang_BlockCommandComment_getArgText")] public static extern CXString BlockCommandComment_GetArgText(CXComment Comment, c_uint ArgIdx);
/**
* \param Comment a \c CXComment_BlockCommand or
* \c CXComment_VerbatimBlockCommand AST node.
*
* \returns paragraph argument of the block command.
*/
[Import(Clang.dll)] [LinkName("clang_BlockCommandComment_getParagraph")] public static extern CXComment BlockCommandComment_GetParagraph(CXComment Comment);
/**
* \param Comment a \c CXComment_ParamCommand AST node.
*
* \returns parameter name.
*/
[Import(Clang.dll)] [LinkName("clang_ParamCommandComment_getParamName")] public static extern CXString ParamCommandComment_GetParamName(CXComment Comment);
/**
* \param Comment a \c CXComment_ParamCommand AST node.
*
* \returns non-zero if the parameter that this AST node represents was found
* in the function prototype and \c clang_ParamCommandComment_getParamIndex
* function will return a meaningful value.
*/
[Import(Clang.dll)] [LinkName("clang_ParamCommandComment_isParamIndexValid")] public static extern c_uint ParamCommandComment_IsParamIndexValid(CXComment Comment);
/**
* \param Comment a \c CXComment_ParamCommand AST node.
*
* \returns zero-based parameter index in function prototype.
*/
[Import(Clang.dll)] [LinkName("clang_ParamCommandComment_getParamIndex")] public static extern c_uint ParamCommandComment_GetParamIndex(CXComment Comment);
/**
* \param Comment a \c CXComment_ParamCommand AST node.
*
* \returns non-zero if parameter passing direction was specified explicitly in
* the comment.
*/
[Import(Clang.dll)] [LinkName("clang_ParamCommandComment_isDirectionExplicit")] public static extern c_uint ParamCommandComment_IsDirectionExplicit(CXComment Comment);
/**
* \param Comment a \c CXComment_ParamCommand AST node.
*
* \returns parameter passing direction.
*/
[Import(Clang.dll)] [LinkName("clang_ParamCommandComment_getDirection")] public static extern CXCommentParamPassDirection ParamCommandComment_GetDirection(CXComment Comment);
/**
* \param Comment a \c CXComment_TParamCommand AST node.
*
* \returns template parameter name.
*/
[Import(Clang.dll)] [LinkName("clang_TParamCommandComment_getParamName")] public static extern CXString TParamCommandComment_GetParamName(CXComment Comment);
/**
* \param Comment a \c CXComment_TParamCommand AST node.
*
* \returns non-zero if the parameter that this AST node represents was found
* in the template parameter list and
* \c clang_TParamCommandComment_getDepth and
* \c clang_TParamCommandComment_getIndex functions will return a meaningful
* value.
*/
[Import(Clang.dll)] [LinkName("clang_TParamCommandComment_isParamPositionValid")] public static extern c_uint TParamCommandComment_IsParamPositionValid(CXComment Comment);
/**
* \param Comment a \c CXComment_TParamCommand AST node.
*
* \returns zero-based nesting depth of this parameter in the template parameter list.
*
* For example,
* \verbatim
* template<typename C, template<typename T> class TT>
* void test(TT<int> aaa);
* \endverbatim
* for C and TT nesting depth is 0,
* for T nesting depth is 1.
*/
[Import(Clang.dll)] [LinkName("clang_TParamCommandComment_getDepth")] public static extern c_uint TParamCommandComment_GetDepth(CXComment Comment);
/**
* \param Comment a \c CXComment_TParamCommand AST node.
*
* \returns zero-based parameter index in the template parameter list at a
* given nesting depth.
*
* For example,
* \verbatim
* template<typename C, template<typename T> class TT>
* void test(TT<int> aaa);
* \endverbatim
* for C and TT nesting depth is 0, so we can ask for index at depth 0:
* at depth 0 C's index is 0, TT's index is 1.
*
* For T nesting depth is 1, so we can ask for index at depth 0 and 1:
* at depth 0 T's index is 1 (same as TT's),
* at depth 1 T's index is 0.
*/
[Import(Clang.dll)] [LinkName("clang_TParamCommandComment_getIndex")] public static extern c_uint TParamCommandComment_GetIndex(CXComment Comment, c_uint Depth);
/**
* \param Comment a \c CXComment_VerbatimBlockLine AST node.
*
* \returns text contained in the AST node.
*/
[Import(Clang.dll)] [LinkName("clang_VerbatimBlockLineComment_getText")] public static extern CXString VerbatimBlockLineComment_GetText(CXComment Comment);
/**
* \param Comment a \c CXComment_VerbatimLine AST node.
*
* \returns text contained in the AST node.
*/
[Import(Clang.dll)] [LinkName("clang_VerbatimLineComment_getText")] public static extern CXString VerbatimLineComment_GetText(CXComment Comment);
/**
* Convert an HTML tag AST node to string.
*
* \param Comment a \c CXComment_HTMLStartTag or \c CXComment_HTMLEndTag AST
* node.
*
* \returns string containing an HTML tag.
*/
[Import(Clang.dll)] [LinkName("clang_HTMLTagComment_getAsString")] public static extern CXString HTMLTagComment_GetAsString(CXComment Comment);
/**
* Convert a given full parsed comment to an HTML fragment.
*
* Specific details of HTML layout are subject to change. Don't try to parse
* this HTML back into an AST, use other APIs instead.
*
* Currently the following CSS classes are used:
* \li "para-brief" for \paragraph and equivalent commands;
* \li "para-returns" for \\returns paragraph and equivalent commands;
* \li "word-returns" for the "Returns" word in \\returns paragraph.
*
* Function argument documentation is rendered as a \<dl\> list with arguments
* sorted in function prototype order. CSS classes used:
* \li "param-name-index-NUMBER" for parameter name (\<dt\>);
* \li "param-descr-index-NUMBER" for parameter description (\<dd\>);
* \li "param-name-index-invalid" and "param-descr-index-invalid" are used if
* parameter index is invalid.
*
* Template parameter documentation is rendered as a \<dl\> list with
* parameters sorted in template parameter list order. CSS classes used:
* \li "tparam-name-index-NUMBER" for parameter name (\<dt\>);
* \li "tparam-descr-index-NUMBER" for parameter description (\<dd\>);
* \li "tparam-name-index-other" and "tparam-descr-index-other" are used for
* names inside template template parameters;
* \li "tparam-name-index-invalid" and "tparam-descr-index-invalid" are used if
* parameter position is invalid.
*
* \param Comment a \c CXComment_FullComment AST node.
*
* \returns string containing an HTML fragment.
*/
[Import(Clang.dll)] [LinkName("clang_FullComment_getAsHTML")] public static extern CXString FullComment_GetAsHTML(CXComment Comment);
/**
* Convert a given full parsed comment to an XML document.
*
* A Relax NG schema for the XML can be found in comment-xml-schema.rng file
* inside clang source tree.
*
* \param Comment a \c CXComment_FullComment AST node.
*
* \returns string containing an XML document.
*/
[Import(Clang.dll)] [LinkName("clang_FullComment_getAsXML")] public static extern CXString FullComment_GetAsXML(CXComment Comment);
}
/**
* @}
*/
/* CLANG_C_DOCUMENTATION_H */

52
ExternC.bf Normal file
View File

@@ -0,0 +1,52 @@
// This file was auto-generated by Cpp2Beef
using System;
using System.Interop;
namespace LibClang;
static
{
/*===- clang-c/ExternC.h - Wrapper for 'extern "C"' ---------------*- C -*-===*\
|* *|
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
|* Exceptions. *|
|* See https://llvm.org/LICENSE.txt for license information. *|
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
|* *|
|*===----------------------------------------------------------------------===*|
|* *|
|* This file defines an 'extern "C"' wrapper. *|
|* *|
\*===----------------------------------------------------------------------===*/
public const let LLVM_CLANG_C_STRICT_PROTOTYPES_BEGIN
= _Pragma("clang diagnostic push")
_Pragma("clang diagnostic error \"-Wstrict-prototypes\"");
public const let LLVM_CLANG_C_STRICT_PROTOTYPES_END = _Pragma("clang diagnostic pop");
public const let LLVM_CLANG_C_EXTERN_C_BEGIN = LLVM_CLANG_C_STRICT_PROTOTYPES_BEGIN;
public const let LLVM_CLANG_C_EXTERN_C_END = LLVM_CLANG_C_STRICT_PROTOTYPES_END;
}

44
FatalErrorHandler.bf Normal file
View File

@@ -0,0 +1,44 @@
// This file was auto-generated by Cpp2Beef
using System;
using System.Interop;
namespace LibClang;
static
{
/*===-- clang-c/FatalErrorHandler.h - Fatal Error Handling --------*- C -*-===*\
|* *|
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
|* Exceptions. *|
|* See https://llvm.org/LICENSE.txt for license information. *|
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
|* *|
\*===----------------------------------------------------------------------===*/
}
extension Clang
{
/**
* Installs error handler that prints error message to stderr and calls abort().
* Replaces currently installed error handler (if any).
*/
[Import(Clang.dll)] [LinkName("clang_install_aborting_llvm_fatal_error_handler")] public static extern void Install_Aborting_Llvm_Fatal_Error_Handler();
/**
* Removes currently installed error handler (if any).
* If no error handler is intalled, the default strategy is to print error
* message to stderr and call exit(1).
*/
[Import(Clang.dll)] [LinkName("clang_uninstall_llvm_fatal_error_handler")] public static extern void Uninstall_Llvm_Fatal_Error_Handler();
}

6864
Index.bf Normal file

File diff suppressed because it is too large Load Diff

64
Platform.bf Normal file
View File

@@ -0,0 +1,64 @@
// This file was auto-generated by Cpp2Beef
using System;
using System.Interop;
namespace LibClang;
static
{
/*===-- clang-c/Platform.h - C Index platform decls -------------*- C -*-===*\
|* *|
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
|* Exceptions. *|
|* See https://llvm.org/LICENSE.txt for license information. *|
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
|* *|
|*===----------------------------------------------------------------------===*|
|* *|
|* This header provides platform specific macros (dllimport, deprecated, ...) *|
|* *|
\*===----------------------------------------------------------------------===*/
/* Windows DLL import/export. */
public const let CINDEX_LINKAGE = __declspec(dllimport);
public const let CINDEX_DEPRECATED = __declspec(deprecated);
}

73
Rewrite.bf Normal file
View File

@@ -0,0 +1,73 @@
// This file was auto-generated by Cpp2Beef
using System;
using System.Interop;
namespace LibClang;
static
{
/*===-- clang-c/Rewrite.h - C CXRewriter --------------------------*- C -*-===*\
|* *|
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
|* Exceptions. *|
|* See https://llvm.org/LICENSE.txt for license information. *|
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
|* *|
|*===----------------------------------------------------------------------===*/
}
public struct CXRewriter : this(void* ptr);
extension Clang
{
/**
* Create CXRewriter.
*/
[Import(Clang.dll)] [LinkName("clang_CXRewriter_create")] public static extern CXRewriter CXRewriter_Create(CXTranslationUnit TU);
/**
* Insert the specified string at the specified location in the original buffer.
*/
[Import(Clang.dll)] [LinkName("clang_CXRewriter_insertTextBefore")] public static extern void CXRewriter_InsertTextBefore(CXRewriter Rew, CXSourceLocation Loc, c_char* Insert);
/**
* Replace the specified range of characters in the input with the specified
* replacement.
*/
[Import(Clang.dll)] [LinkName("clang_CXRewriter_replaceText")] public static extern void CXRewriter_ReplaceText(CXRewriter Rew, CXSourceRange ToBeReplaced, c_char* Replacement);
/**
* Remove the specified range.
*/
[Import(Clang.dll)] [LinkName("clang_CXRewriter_removeText")] public static extern void CXRewriter_RemoveText(CXRewriter Rew, CXSourceRange ToBeRemoved);
/**
* Save all changed files to disk.
* Returns 1 if any files were not saved successfully, returns 0 otherwise.
*/
[Import(Clang.dll)] [LinkName("clang_CXRewriter_overwriteChangedFiles")] public static extern c_int CXRewriter_OverwriteChangedFiles(CXRewriter Rew);
/**
* Write out rewritten version of the main file to stdout.
*/
[Import(Clang.dll)] [LinkName("clang_CXRewriter_writeMainFileToStdOut")] public static extern void CXRewriter_WriteMainFileToStdOut(CXRewriter Rew);
/**
* Free the given CXRewriter.
*/
[Import(Clang.dll)] [LinkName("clang_CXRewriter_dispose")] public static extern void CXRewriter_Dispose(CXRewriter Rew);
}

View File

@@ -4646,7 +4646,7 @@ extension Clang
*/ */
[AllowDuplicates] public enum CXObjCPropertyAttrKind : c_int { [AllowDuplicates] public enum CXObjCPropertyAttrKind : c_int {
noattr = 0x00, noattr = 0x00,
readonly = 0x01, @readonly = 0x01,
getter = 0x02, getter = 0x02,
assign = 0x04, assign = 0x04,
readwrite = 0x08, readwrite = 0x08,
@@ -4658,7 +4658,7 @@ extension Clang
weak = 0x200, weak = 0x200,
strong = 0x400, strong = 0x400,
unsafe_unretained = 0x800, unsafe_unretained = 0x800,
class = 0x1000, @class = 0x1000,
} }
extension Clang extension Clang

27
src/Library.bf Normal file
View File

@@ -0,0 +1,27 @@
using System;
using System.Interop;
namespace LibClang;
static
{
[Comptime(ConstEval=true)]
public static StringView CINDEX_VERSION_STRINGIZE(c_int major, c_int minor) => scope $"{major}.{minor}";
[Comptime(ConstEval=true)]
public static c_int CINDEX_VERSION_ENCODE(c_int major, c_int minor) => (((major) * 10000) + ((minor) * 1));
}
static class Clang
{
protected const let dll = "libclang" +
#if BF_PLATFORM_WINDOWS
".dll";
#elif BF_PLATFORM_MACOS
".dylib";
#else
".so";
#endif
protected typealias time_t = uint32;
}