This commit is contained in:
Rune
2026-01-29 20:33:25 +01:00
parent baed541086
commit 044f8c3b3a
9 changed files with 1748 additions and 761 deletions

8
.gitignore vendored
View File

@@ -1,3 +1,9 @@
clang-c
clang-c.h
src/clang-c.bf
src/Platform.bf
src/ExternC.bf
recovery
build
BeefSpace_user.toml
BeefSpace_User.toml

View File

@@ -108,7 +108,7 @@ extension Clang
}
/**
* Object encapsulating information about a module.map file.
* Object encapsulating information about a module.modulemap file.
*/
[CRepr] public struct CXModuleMapDescriptorImpl; public struct CXModuleMapDescriptor : this(CXModuleMapDescriptorImpl* ptr);
@@ -124,14 +124,14 @@ extension Clang
[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.
* Sets the framework module name that the module.modulemap 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.
* Sets the umbrella header name that the module.modulemap describes.
* \returns 0 for success, non-zero to indicate an error.
*/

393
src/CXDiagnostic.bf Normal file
View File

@@ -0,0 +1,393 @@
// This file was auto-generated by Cpp2Beef
using System;
using System.Interop;
namespace LibClang;
static
{
/*===-- clang-c/CXDiagnostic.h - C Index Diagnostics --------------*- 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 diagnostics. *|
|* *|
\*===----------------------------------------------------------------------===*/
}
/**
* \defgroup CINDEX_DIAG Diagnostic reporting
*
* @{
*/
/**
* Describes the severity of a particular diagnostic.
*/
[AllowDuplicates] public enum CXDiagnosticSeverity : c_int {
/**
* A diagnostic that has been suppressed, e.g., by a command-line
* option.
*/
Ignored = 0,
/**
* This diagnostic is a note that should be attached to the
* previous (non-note) diagnostic.
*/
Note = 1,
/**
* This diagnostic indicates suspicious code that may not be
* wrong.
*/
Warning = 2,
/**
* This diagnostic indicates that the code is ill-formed.
*/
Error = 3,
/**
* This diagnostic indicates that the code is ill-formed such
* that future parser recovery is unlikely to produce useful
* results.
*/
Fatal = 4,
}
/**
* A single diagnostic, containing the diagnostic's severity,
* location, text, source ranges, and fix-it hints.
*/
public struct CXDiagnostic : this(void* ptr);
/**
* A group of CXDiagnostics.
*/
public struct CXDiagnosticSet : this(void* ptr);
extension Clang
{
/**
* Determine the number of diagnostics in a CXDiagnosticSet.
*/
[Import(Clang.dll)] [LinkName("clang_getNumDiagnosticsInSet")] public static extern c_uint GetNumDiagnosticsInSet(CXDiagnosticSet Diags);
/**
* Retrieve a diagnostic associated with the given CXDiagnosticSet.
*
* \param Diags the CXDiagnosticSet to query.
* \param Index the zero-based diagnostic number to retrieve.
*
* \returns the requested diagnostic. This diagnostic must be freed
* via a call to \c clang_disposeDiagnostic().
*/
[Import(Clang.dll)] [LinkName("clang_getDiagnosticInSet")] public static extern CXDiagnostic GetDiagnosticInSet(CXDiagnosticSet Diags, c_uint Index);
}
/**
* Describes the kind of error that occurred (if any) in a call to
* \c clang_loadDiagnostics.
*/
[AllowDuplicates] public enum CXLoadDiag_Error : c_int {
/**
* Indicates that no error occurred.
*/
None = 0,
/**
* Indicates that an unknown error occurred while attempting to
* deserialize diagnostics.
*/
Unknown = 1,
/**
* Indicates that the file containing the serialized diagnostics
* could not be opened.
*/
CannotLoad = 2,
/**
* Indicates that the serialized diagnostics file is invalid or
* corrupt.
*/
InvalidFile = 3,
}
extension Clang
{
/**
* Deserialize a set of diagnostics from a Clang diagnostics bitcode
* file.
*
* \param file The name of the file to deserialize.
* \param error A pointer to a enum value recording if there was a problem
* deserializing the diagnostics.
* \param errorString A pointer to a CXString for recording the error string
* if the file was not successfully loaded.
*
* \returns A loaded CXDiagnosticSet if successful, and NULL otherwise. These
* diagnostics should be released using clang_disposeDiagnosticSet().
*/
[Import(Clang.dll)] [LinkName("clang_loadDiagnostics")] public static extern CXDiagnosticSet LoadDiagnostics(c_char* file, CXLoadDiag_Error* error, CXString* errorString);
/**
* Release a CXDiagnosticSet and all of its contained diagnostics.
*/
[Import(Clang.dll)] [LinkName("clang_disposeDiagnosticSet")] public static extern void DisposeDiagnosticSet(CXDiagnosticSet Diags);
/**
* Retrieve the child diagnostics of a CXDiagnostic.
*
* This CXDiagnosticSet does not need to be released by
* clang_disposeDiagnosticSet.
*/
[Import(Clang.dll)] [LinkName("clang_getChildDiagnostics")] public static extern CXDiagnosticSet GetChildDiagnostics(CXDiagnostic D);
/**
* Destroy a diagnostic.
*/
[Import(Clang.dll)] [LinkName("clang_disposeDiagnostic")] public static extern void DisposeDiagnostic(CXDiagnostic Diagnostic);
}
/**
* Options to control the display of diagnostics.
*
* The values in this enum are meant to be combined to customize the
* behavior of \c clang_formatDiagnostic().
*/
[AllowDuplicates] public enum CXDiagnosticDisplayOptions : c_int {
/**
* Display the source-location information where the
* diagnostic was located.
*
* When set, diagnostics will be prefixed by the file, line, and
* (optionally) column to which the diagnostic refers. For example,
*
* \code
* test.c:28: warning: extra tokens at end of #endif directive
* \endcode
*
* This option corresponds to the clang flag \c -fshow-source-location.
*/
DisplaySourceLocation = 0x01,
/**
* If displaying the source-location information of the
* diagnostic, also include the column number.
*
* This option corresponds to the clang flag \c -fshow-column.
*/
DisplayColumn = 0x02,
/**
* If displaying the source-location information of the
* diagnostic, also include information about source ranges in a
* machine-parsable format.
*
* This option corresponds to the clang flag
* \c -fdiagnostics-print-source-range-info.
*/
DisplaySourceRanges = 0x04,
/**
* Display the option name associated with this diagnostic, if any.
*
* The option name displayed (e.g., -Wconversion) will be placed in brackets
* after the diagnostic text. This option corresponds to the clang flag
* \c -fdiagnostics-show-option.
*/
DisplayOption = 0x08,
/**
* Display the category number associated with this diagnostic, if any.
*
* The category number is displayed within brackets after the diagnostic text.
* This option corresponds to the clang flag
* \c -fdiagnostics-show-category=id.
*/
DisplayCategoryId = 0x10,
/**
* Display the category name associated with this diagnostic, if any.
*
* The category name is displayed within brackets after the diagnostic text.
* This option corresponds to the clang flag
* \c -fdiagnostics-show-category=name.
*/
DisplayCategoryName = 0x20,
}
extension Clang
{
/**
* Format the given diagnostic in a manner that is suitable for display.
*
* This routine will format the given diagnostic to a string, rendering
* the diagnostic according to the various options given. The
* \c clang_defaultDiagnosticDisplayOptions() function returns the set of
* options that most closely mimics the behavior of the clang compiler.
*
* \param Diagnostic The diagnostic to print.
*
* \param Options A set of options that control the diagnostic display,
* created by combining \c CXDiagnosticDisplayOptions values.
*
* \returns A new string containing for formatted diagnostic.
*/
[Import(Clang.dll)] [LinkName("clang_formatDiagnostic")] public static extern CXString FormatDiagnostic(CXDiagnostic Diagnostic, c_uint Options);
/**
* Retrieve the set of display options most similar to the
* default behavior of the clang compiler.
*
* \returns A set of display options suitable for use with \c
* clang_formatDiagnostic().
*/
[Import(Clang.dll)] [LinkName("clang_defaultDiagnosticDisplayOptions")] public static extern c_uint DefaultDiagnosticDisplayOptions();
/**
* Determine the severity of the given diagnostic.
*/
[Import(Clang.dll)] [LinkName("clang_getDiagnosticSeverity")] public static extern CXDiagnosticSeverity GetDiagnosticSeverity(CXDiagnostic);
/**
* Retrieve the source location of the given diagnostic.
*
* This location is where Clang would print the caret ('^') when
* displaying the diagnostic on the command line.
*/
[Import(Clang.dll)] [LinkName("clang_getDiagnosticLocation")] public static extern CXSourceLocation GetDiagnosticLocation(CXDiagnostic);
/**
* Retrieve the text of the given diagnostic.
*/
[Import(Clang.dll)] [LinkName("clang_getDiagnosticSpelling")] public static extern CXString GetDiagnosticSpelling(CXDiagnostic);
/**
* Retrieve the name of the command-line option that enabled this
* diagnostic.
*
* \param Diag The diagnostic to be queried.
*
* \param Disable If non-NULL, will be set to the option that disables this
* diagnostic (if any).
*
* \returns A string that contains the command-line option used to enable this
* warning, such as "-Wconversion" or "-pedantic".
*/
[Import(Clang.dll)] [LinkName("clang_getDiagnosticOption")] public static extern CXString GetDiagnosticOption(CXDiagnostic Diag, CXString* Disable);
/**
* Retrieve the category number for this diagnostic.
*
* Diagnostics can be categorized into groups along with other, related
* diagnostics (e.g., diagnostics under the same warning flag). This routine
* retrieves the category number for the given diagnostic.
*
* \returns The number of the category that contains this diagnostic, or zero
* if this diagnostic is uncategorized.
*/
[Import(Clang.dll)] [LinkName("clang_getDiagnosticCategory")] public static extern c_uint GetDiagnosticCategory(CXDiagnostic);
/**
* Retrieve the name of a particular diagnostic category. This
* is now deprecated. Use clang_getDiagnosticCategoryText()
* instead.
*
* \param Category A diagnostic category number, as returned by
* \c clang_getDiagnosticCategory().
*
* \returns The name of the given diagnostic category.
*/
[Import(Clang.dll)] [Obsolete] [LinkName("clang_getDiagnosticCategoryName")] public static extern CXString GetDiagnosticCategoryName(c_uint Category);
/**
* Retrieve the diagnostic category text for a given diagnostic.
*
* \returns The text of the given diagnostic category.
*/
[Import(Clang.dll)] [LinkName("clang_getDiagnosticCategoryText")] public static extern CXString GetDiagnosticCategoryText(CXDiagnostic);
/**
* Determine the number of source ranges associated with the given
* diagnostic.
*/
[Import(Clang.dll)] [LinkName("clang_getDiagnosticNumRanges")] public static extern c_uint GetDiagnosticNumRanges(CXDiagnostic);
/**
* Retrieve a source range associated with the diagnostic.
*
* A diagnostic's source ranges highlight important elements in the source
* code. On the command line, Clang displays source ranges by
* underlining them with '~' characters.
*
* \param Diagnostic the diagnostic whose range is being extracted.
*
* \param Range the zero-based index specifying which range to
*
* \returns the requested source range.
*/
[Import(Clang.dll)] [LinkName("clang_getDiagnosticRange")] public static extern CXSourceRange GetDiagnosticRange(CXDiagnostic Diagnostic, c_uint Range);
/**
* Determine the number of fix-it hints associated with the
* given diagnostic.
*/
[Import(Clang.dll)] [LinkName("clang_getDiagnosticNumFixIts")] public static extern c_uint GetDiagnosticNumFixIts(CXDiagnostic Diagnostic);
/**
* Retrieve the replacement information for a given fix-it.
*
* Fix-its are described in terms of a source range whose contents
* should be replaced by a string. This approach generalizes over
* three kinds of operations: removal of source code (the range covers
* the code to be removed and the replacement string is empty),
* replacement of source code (the range covers the code to be
* replaced and the replacement string provides the new code), and
* insertion (both the start and end of the range point at the
* insertion location, and the replacement string provides the text to
* insert).
*
* \param Diagnostic The diagnostic whose fix-its are being queried.
*
* \param FixIt The zero-based index of the fix-it.
*
* \param ReplacementRange The source range whose contents will be
* replaced with the returned replacement string. Note that source
* ranges are half-open ranges [a, b), so the source code should be
* replaced from a and up to (but not including) b.
*
* \returns A string containing text that should be replace the source
* code indicated by the \c ReplacementRange.
*/
[Import(Clang.dll)] [LinkName("clang_getDiagnosticFixIt")] public static extern CXString GetDiagnosticFixIt(CXDiagnostic Diagnostic, c_uint FixIt, CXSourceRange* ReplacementRange);
}
/**
* @}
*/

100
src/CXFile.bf Normal file
View File

@@ -0,0 +1,100 @@
// This file was auto-generated by Cpp2Beef
using System;
using System.Interop;
namespace LibClang;
static
{
/*===-- clang-c/CXFile.h - C Index File ---------------------------*- 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 files. *|
|* *|
\*===----------------------------------------------------------------------===*/
}
/**
* \defgroup CINDEX_FILES File manipulation routines
*
* @{
*/
/**
* A particular source file that is part of a translation unit.
*/
public struct CXFile : this(void* ptr);
extension Clang
{
/**
* Retrieve the complete file and path name of the given file.
*/
[Import(Clang.dll)] [LinkName("clang_getFileName")] public static extern CXString GetFileName(CXFile SFile);
/**
* Retrieve the last modification time of the given file.
*/
[Import(Clang.dll)] [LinkName("clang_getFileTime")] public static extern time_t GetFileTime(CXFile SFile);
}
/**
* Uniquely identifies a CXFile, that refers to the same underlying file,
* across an indexing session.
*/
[CRepr] public struct CXFileUniqueID {
public c_ulonglong[3] data;
}
extension Clang
{
/**
* Retrieve the unique ID for the given \c file.
*
* \param file the file to get the ID for.
* \param outID stores the returned CXFileUniqueID.
* \returns If there was a failure getting the unique ID, returns non-zero,
* otherwise returns 0.
*/
[Import(Clang.dll)] [LinkName("clang_getFileUniqueID")] public static extern c_int GetFileUniqueID(CXFile file, CXFileUniqueID* outID);
/**
* Returns non-zero if the \c file1 and \c file2 point to the same file,
* or they are both NULL.
*/
[Import(Clang.dll)] [LinkName("clang_File_isEqual")] public static extern c_int File_IsEqual(CXFile file1, CXFile file2);
/**
* Returns the real path name of \c file.
*
* An empty string may be returned. Use \c clang_getFileName() in that case.
*/
[Import(Clang.dll)] [LinkName("clang_File_tryGetRealPathName")] public static extern CXString File_TryGetRealPathName(CXFile file);
}
/**
* @}
*/

296
src/CXSourceLocation.bf Normal file
View File

@@ -0,0 +1,296 @@
// This file was auto-generated by Cpp2Beef
using System;
using System.Interop;
namespace LibClang;
static
{
/*===-- clang-c/CXSourceLocation.h - C Index Source Location ------*- 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 source locations. *|
|* *|
\*===----------------------------------------------------------------------===*/
}
/**
* \defgroup CINDEX_LOCATIONS Physical source locations
*
* Clang represents physical source locations in its abstract syntax tree in
* great detail, with file, line, and column information for the majority of
* the tokens parsed in the source code. These data types and functions are
* used to represent source location information, either for a particular
* point in the program or for a range of points in the program, and extract
* specific location information from those data types.
*
* @{
*/
/**
* Identifies a specific source location within a translation
* unit.
*
* Use clang_getExpansionLocation() or clang_getSpellingLocation()
* to map a source location to a particular file, line, and column.
*/
[CRepr] public struct CXSourceLocation {
public void*[2] ptr_data;
public c_uint int_data;
}
/**
* Identifies a half-open character range in the source code.
*
* Use clang_getRangeStart() and clang_getRangeEnd() to retrieve the
* starting and end locations from a source range, respectively.
*/
[CRepr] public struct CXSourceRange {
public void*[2] ptr_data;
public c_uint begin_int_data;
public c_uint end_int_data;
}
extension Clang
{
/**
* Retrieve a NULL (invalid) source location.
*/
[Import(Clang.dll)] [LinkName("clang_getNullLocation")] public static extern CXSourceLocation GetNullLocation();
/**
* Determine whether two source locations, which must refer into
* the same translation unit, refer to exactly the same point in the source
* code.
*
* \returns non-zero if the source locations refer to the same location, zero
* if they refer to different locations.
*/
[Import(Clang.dll)] [LinkName("clang_equalLocations")] public static extern c_uint EqualLocations(CXSourceLocation loc1, CXSourceLocation loc2);
/**
* Determine for two source locations if the first comes
* strictly before the second one in the source code.
*
* \returns non-zero if the first source location comes
* strictly before the second one, zero otherwise.
*/
[Import(Clang.dll)] [LinkName("clang_isBeforeInTranslationUnit")] public static extern c_uint IsBeforeInTranslationUnit(CXSourceLocation loc1, CXSourceLocation loc2);
/**
* Returns non-zero if the given source location is in a system header.
*/
[Import(Clang.dll)] [LinkName("clang_Location_isInSystemHeader")] public static extern c_int Location_IsInSystemHeader(CXSourceLocation location);
/**
* Returns non-zero if the given source location is in the main file of
* the corresponding translation unit.
*/
[Import(Clang.dll)] [LinkName("clang_Location_isFromMainFile")] public static extern c_int Location_IsFromMainFile(CXSourceLocation location);
/**
* Retrieve a NULL (invalid) source range.
*/
[Import(Clang.dll)] [LinkName("clang_getNullRange")] public static extern CXSourceRange GetNullRange();
/**
* Retrieve a source range given the beginning and ending source
* locations.
*/
[Import(Clang.dll)] [LinkName("clang_getRange")] public static extern CXSourceRange GetRange(CXSourceLocation begin, CXSourceLocation end);
/**
* Determine whether two ranges are equivalent.
*
* \returns non-zero if the ranges are the same, zero if they differ.
*/
[Import(Clang.dll)] [LinkName("clang_equalRanges")] public static extern c_uint EqualRanges(CXSourceRange range1, CXSourceRange range2);
/**
* Returns non-zero if \p range is null.
*/
[Import(Clang.dll)] [LinkName("clang_Range_isNull")] public static extern c_int Range_IsNull(CXSourceRange range);
/**
* Retrieve the file, line, column, and offset represented by
* the given source location.
*
* If the location refers into a macro expansion, retrieves the
* location of the macro expansion.
*
* \param location the location within a source file that will be decomposed
* into its parts.
*
* \param file [out] if non-NULL, will be set to the file to which the given
* source location points.
*
* \param line [out] if non-NULL, will be set to the line to which the given
* source location points.
*
* \param column [out] if non-NULL, will be set to the column to which the given
* source location points.
*
* \param offset [out] if non-NULL, will be set to the offset into the
* buffer to which the given source location points.
*/
[Import(Clang.dll)] [LinkName("clang_getExpansionLocation")] public static extern void GetExpansionLocation(CXSourceLocation location, out CXFile file, out c_uint line, out c_uint column, out c_uint offset);
/**
* Retrieve the file, line and column represented by the given source
* location, as specified in a # line directive.
*
* Example: given the following source code in a file somefile.c
*
* \code
* #123 "dummy.c" 1
*
* static int func(void)
* {
* return 0;
* }
* \endcode
*
* the location information returned by this function would be
*
* File: dummy.c Line: 124 Column: 12
*
* whereas clang_getExpansionLocation would have returned
*
* File: somefile.c Line: 3 Column: 12
*
* \param location the location within a source file that will be decomposed
* into its parts.
*
* \param filename [out] if non-NULL, will be set to the filename of the
* source location. Note that filenames returned will be for "virtual" files,
* which don't necessarily exist on the machine running clang - e.g. when
* parsing preprocessed output obtained from a different environment. If
* a non-NULL value is passed in, remember to dispose of the returned value
* using \c clang_disposeString() once you've finished with it. For an invalid
* source location, an empty string is returned.
*
* \param line [out] if non-NULL, will be set to the line number of the
* source location. For an invalid source location, zero is returned.
*
* \param column [out] if non-NULL, will be set to the column number of the
* source location. For an invalid source location, zero is returned.
*/
[Import(Clang.dll)] [LinkName("clang_getPresumedLocation")] public static extern void GetPresumedLocation(CXSourceLocation location, out CXString filename, out c_uint line, out c_uint column);
/**
* Legacy API to retrieve the file, line, column, and offset represented
* by the given source location.
*
* This interface has been replaced by the newer interface
* #clang_getExpansionLocation(). See that interface's documentation for
* details.
*/
[Import(Clang.dll)] [LinkName("clang_getInstantiationLocation")] public static extern void GetInstantiationLocation(CXSourceLocation location, CXFile* file, c_uint* line, c_uint* column, c_uint* offset);
/**
* Retrieve the file, line, column, and offset represented by
* the given source location.
*
* If the location refers into a macro instantiation, return where the
* location was originally spelled in the source file.
*
* \param location the location within a source file that will be decomposed
* into its parts.
*
* \param file [out] if non-NULL, will be set to the file to which the given
* source location points.
*
* \param line [out] if non-NULL, will be set to the line to which the given
* source location points.
*
* \param column [out] if non-NULL, will be set to the column to which the given
* source location points.
*
* \param offset [out] if non-NULL, will be set to the offset into the
* buffer to which the given source location points.
*/
[Import(Clang.dll)] [LinkName("clang_getSpellingLocation")] public static extern void GetSpellingLocation(CXSourceLocation location, out CXFile file, out c_uint line, out c_uint column, out c_uint offset);
/**
* Retrieve the file, line, column, and offset represented by
* the given source location.
*
* If the location refers into a macro expansion, return where the macro was
* expanded or where the macro argument was written, if the location points at
* a macro argument.
*
* \param location the location within a source file that will be decomposed
* into its parts.
*
* \param file [out] if non-NULL, will be set to the file to which the given
* source location points.
*
* \param line [out] if non-NULL, will be set to the line to which the given
* source location points.
*
* \param column [out] if non-NULL, will be set to the column to which the given
* source location points.
*
* \param offset [out] if non-NULL, will be set to the offset into the
* buffer to which the given source location points.
*/
[Import(Clang.dll)] [LinkName("clang_getFileLocation")] public static extern void GetFileLocation(CXSourceLocation location, out CXFile file, out c_uint line, out c_uint column, out c_uint offset);
/**
* Retrieve a source location representing the first character within a
* source range.
*/
[Import(Clang.dll)] [LinkName("clang_getRangeStart")] public static extern CXSourceLocation GetRangeStart(CXSourceRange range);
/**
* Retrieve a source location representing the last character within a
* source range.
*/
[Import(Clang.dll)] [LinkName("clang_getRangeEnd")] public static extern CXSourceLocation GetRangeEnd(CXSourceRange range);
}
/**
* Identifies an array of ranges.
*/
[CRepr] public struct CXSourceRangeList {
/** The number of ranges in the \c ranges array. */
public c_uint count;
/**
* An array of \c CXSourceRanges.
*/
public CXSourceRange* ranges;
}
extension Clang
{
/**
* Destroy the given \c CXSourceRangeList.
*/
[Import(Clang.dll)] [LinkName("clang_disposeSourceRangeList")] public static extern void DisposeSourceRangeList(CXSourceRangeList* ranges);
}
/**
* @}
*/

View File

@@ -60,6 +60,10 @@ extension Clang
{
/**
* Retrieve the character data associated with the given string.
*
* The returned data is a reference and not owned by the user. This data
* is only valid while the `CXString` is valid. This function is similar
* to `std::string::c_str()`.
*/
[Import(Clang.dll)] [LinkName("clang_getCString")] public static extern c_char* GetCString(CXString string);

View File

@@ -32,6 +32,7 @@ static
/**
* \defgroup CINDEX_COMMENT Comment introspection
*
@@ -560,6 +561,70 @@ extension Clang
[Import(Clang.dll)] [LinkName("clang_FullComment_getAsXML")] public static extern CXString FullComment_GetAsXML(CXComment Comment);
}
/**
* CXAPISet is an opaque type that represents a data structure containing all
* the API information for a given translation unit. This can be used for a
* single symbol symbol graph for a given symbol.
*/
[CRepr] public struct CXAPISetImpl; public struct CXAPISet : this(CXAPISetImpl* ptr);
extension Clang
{
/**
* Traverses the translation unit to create a \c CXAPISet.
*
* \param tu is the \c CXTranslationUnit to build the \c CXAPISet for.
*
* \param out_api is a pointer to the output of this function. It is needs to be
* disposed of by calling clang_disposeAPISet.
*
* \returns Error code indicating success or failure of the APISet creation.
*/
[Import(Clang.dll)] [LinkName("clang_createAPISet")] public static extern CXErrorCode CreateAPISet(CXTranslationUnit tu, CXAPISet* out_api);
/**
* Dispose of an APISet.
*
* The provided \c CXAPISet can not be used after this function is called.
*/
[Import(Clang.dll)] [LinkName("clang_disposeAPISet")] public static extern void DisposeAPISet(CXAPISet api);
/**
* Generate a single symbol symbol graph for the given USR. Returns a null
* string if the associated symbol can not be found in the provided \c CXAPISet.
*
* The output contains the symbol graph as well as some additional information
* about related symbols.
*
* \param usr is a string containing the USR of the symbol to generate the
* symbol graph for.
*
* \param api the \c CXAPISet to look for the symbol in.
*
* \returns a string containing the serialized symbol graph representation for
* the symbol being queried or a null string if it can not be found in the
* APISet.
*/
[Import(Clang.dll)] [LinkName("clang_getSymbolGraphForUSR")] public static extern CXString GetSymbolGraphForUSR(c_char* usr, CXAPISet api);
/**
* Generate a single symbol symbol graph for the declaration at the given
* cursor. Returns a null string if the AST node for the cursor isn't a
* declaration.
*
* The output contains the symbol graph as well as some additional information
* about related symbols.
*
* \param cursor the declaration for which to generate the single symbol symbol
* graph.
*
* \returns a string containing the serialized symbol graph representation for
* the symbol being queried or a null string if it can not be found in the
* APISet.
*/
[Import(Clang.dll)] [LinkName("clang_getSymbolGraphForCursor")] public static extern CXString GetSymbolGraphForCursor(CXCursor cursor);
}
/**
* @}
*/

View File

@@ -28,6 +28,7 @@ extension Clang
/**
* Installs error handler that prints error message to stderr and calls abort().
* Replaces currently installed error handler (if any).

File diff suppressed because it is too large Load Diff