diff --git a/.gitignore b/.gitignore
index 872f5b7..188c998 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,6 @@
+.vscode/
+
build/
.direnv/
diff --git a/README.md b/README.md
index 38bd8ff..4c37e83 100644
--- a/README.md
+++ b/README.md
@@ -76,6 +76,7 @@ For better user experience there is additional API for string transformations, w
There are several examples located in `examples` directory. To check them out, run the following command in root directory of the repository:
+- LibClang bindings: `c3c run clang -- ./build/clang.c3i`
- Sandbox to try out library: `c3c run sandbox` - it will write to stdout
- My dummy: `c3c run dummy -- ./build/dummy.c3i` or `c3c run dummy` - it will print output to stdout
- Vulkan: `c3c run vulkan -- ./build/vulkan.c3i`
@@ -98,6 +99,7 @@ Join and contact me in [C3 discord channel](https://discord.com/channels/6503459
## TODO
+- Comments: convert attributes
- Fix multiple definitions for macros
- Inline definition of records and enums inside of function parameters
- Allow user to write any attributes on an entity based on WriteAttrs
diff --git a/bindgen.c3l/bindgen.c3i b/bindgen.c3l/bindgen.c3i
index 847cd7c..48da3a3 100644
--- a/bindgen.c3l/bindgen.c3i
+++ b/bindgen.c3l/bindgen.c3i
@@ -29,7 +29,7 @@ extern fn void? translate_header(
BGOptions opts = {},
BGTransCallbacks trans_callbacks = {},
BGGenCallbacks gen_callbacks = {})
-@extern("bg_translate_header");
+@cname("bg_translate_header");
<*
@@ -44,6 +44,7 @@ extern fn void? translate_header(
"This option is a function which returns true if we want to '#include' file passed to 'name' parameter."
"Note that 'name' is either relative or absolute path to a file"
skip_errors : "Whether to skip clang's parse errors. Note, that '<...> file not found' errors are skipped always and not controlled with this flag"
+ generate_docs : "Whether to retrive docs and translate to C3 docs"
*>
struct BGOptions
{
@@ -58,6 +59,7 @@ struct BGOptions
{
bool skip_errors;
bool no_verbose;
+ bool generate_docs;
}
}
@@ -77,7 +79,8 @@ struct BGTransCallbacks
{
BGTransFn func;
BGTransFn type;
- BGTransFn variable;
+ BGTransFn variable;
+ BGTransFn enum_field;
BGTransFn constant;
BGTransFn func_macro;
}
@@ -260,28 +263,28 @@ struct BGModuleWrap
*>
module bindgen::bgstr;
-fn bool is_between(String name, String bound_1, String bound_2) @extern("bgstr_is_between");
+fn bool is_between(String name, String bound_1, String bound_2) @cname("bgstr_is_between");
-fn String snake_to_camel(String str, Allocator alloc) @extern("bgstr_snake_to_camel");
-fn String snake_to_pascal(String str, Allocator alloc) @extern("bgstr_snake_to_pascal");
-fn String snake_to_screaming(String str, Allocator alloc) @extern("bgstr_snake_to_screaming");
+fn String snake_to_camel(String str, Allocator alloc) @cname("bgstr_snake_to_camel");
+fn String snake_to_pascal(String str, Allocator alloc) @cname("bgstr_snake_to_pascal");
+fn String snake_to_screaming(String str, Allocator alloc) @cname("bgstr_snake_to_screaming");
-fn String pascal_to_screaming(String str, Allocator alloc) @extern("bgstr_pascal_to_screaming");
-fn String pascal_to_snake(String str, Allocator alloc) @extern("bgstr_pascal_to_snake");
-fn String pascal_to_camel(String str, Allocator alloc) @extern("bgstr_pascal_to_camel");
+fn String pascal_to_screaming(String str, Allocator alloc) @cname("bgstr_pascal_to_screaming");
+fn String pascal_to_snake(String str, Allocator alloc) @cname("bgstr_pascal_to_snake");
+fn String pascal_to_camel(String str, Allocator alloc) @cname("bgstr_pascal_to_camel");
-fn String camel_to_screaming(String str, Allocator alloc) @extern("bgstr_camel_to_screaming");
-fn String camel_to_snake(String str, Allocator alloc) @extern("bgstr_camel_to_snake");
-fn String camel_to_pascal(String str, Allocator alloc) @extern("bgstr_camel_to_pascal");
+fn String camel_to_screaming(String str, Allocator alloc) @cname("bgstr_camel_to_screaming");
+fn String camel_to_snake(String str, Allocator alloc) @cname("bgstr_camel_to_snake");
+fn String camel_to_pascal(String str, Allocator alloc) @cname("bgstr_camel_to_pascal");
-fn String screaming_to_snake(String str, Allocator alloc) @extern("bgstr_screaming_to_snake");
-fn String screaming_to_camel(String str, Allocator alloc) @extern("bgstr_screaming_to_camel");
-fn String screaming_to_pascal(String str, Allocator alloc) @extern("bgstr_screaming_to_pascal");
+fn String screaming_to_snake(String str, Allocator alloc) @cname("bgstr_screaming_to_snake");
+fn String screaming_to_camel(String str, Allocator alloc) @cname("bgstr_screaming_to_camel");
+fn String screaming_to_pascal(String str, Allocator alloc) @cname("bgstr_screaming_to_pascal");
-fn String mixed_to_camel(String str, Allocator alloc) @extern("bgstr_mixed_to_camel");
-fn String mixed_to_screaming(String str, Allocator alloc) @extern("bgstr_mixed_to_screaming");
-fn String mixed_to_snake(String str, Allocator alloc) @extern("bgstr_mixed_to_snake");
-fn String mixed_to_pascal(String str, Allocator alloc) @extern("bgstr_mixed_to_pascal");
+fn String mixed_to_camel(String str, Allocator alloc) @cname("bgstr_mixed_to_camel");
+fn String mixed_to_screaming(String str, Allocator alloc) @cname("bgstr_mixed_to_screaming");
+fn String mixed_to_snake(String str, Allocator alloc) @cname("bgstr_mixed_to_snake");
+fn String mixed_to_pascal(String str, Allocator alloc) @cname("bgstr_mixed_to_pascal");
macro bool String.is_between(String str, String a, String b) => is_between(str, a, b);
diff --git a/bindgen.c3l/src/bg.c3 b/bindgen.c3l/src/bg.c3
index 36be30b..9cc7ee1 100644
--- a/bindgen.c3l/src/bg.c3
+++ b/bindgen.c3l/src/bg.c3
@@ -39,10 +39,7 @@ fn void? translateHeader(
if (opts.out_name != "") @pool() {
err::warn(opts.no_verbose, "BGOptions.out_name is deprecated in favour of BGOptions.out_file");
- Path out_path = {
- .path_string = opts.out_name,
- .env = path::DEFAULT_ENV,
- };
+ Path out_path = path::tnew(opts.out_name)!;
if (path::is_dir(out_path)) {
err::erro("The output name you've provided is an existing directory. Please provide a name of a file I should write to");
@@ -50,11 +47,7 @@ fn void? translateHeader(
}
// If there is no parent, we are in root
- Path out_parent = out_path.parent() ?? {
- .path_string = "/",
- .env = path::DEFAULT_ENV,
- };
-
+ Path out_parent = out_path.parent() ?? path::tnew(string::tformat("%s", path::PREFERRED_SEPARATOR))!;
// Create missing directories on the path
path::mkdir(out_parent, recursive: true)!!;
@@ -88,12 +81,12 @@ fn void? translateHeader(
}
CXTranslationUnit tu;
- CXErrorCode code = clang::parseTranslationUnit2(index, (ZString) header_name, cargs.ptr, cargs.len, null, 0, bgimpl::TRANSLATION_UNIT_PARSE_FLAGS, &tu);
+ CXErrorCode code = clang::parseTranslationUnit2(index, (ZString)header_name, cargs.ptr, cargs.len, null, 0, (uint)bgimpl::TRANSLATION_UNIT_PARSE_FLAGS, &tu);
checkCode(code)!;
defer clang::disposeTranslationUnit(tu);
// Print diagnostics
- usz severe_count = runDiagnostics(tu, header_name, clang::DIAGNOSTIC_ERROR);
+ sz severe_count = runDiagnostics(tu, header_name, DIAGNOSTIC_ERROR);
if (severe_count > 0 && !opts.skip_errors) return bg::CLANG_PARSE_ERROR~;
GlobalVisitData visit_data = {
@@ -106,8 +99,9 @@ fn void? translateHeader(
.cxfile = clang::getFile(tu, (ZString)header_name),
.no_verbose = opts.no_verbose,
+ .use_docs = opts.generate_docs
};
-
+
// TODO: also free Strings under types_table
visit_data.types_table.init(mem);
defer visit_data.types_table.free();
@@ -140,7 +134,7 @@ fn void? translateHeader(
@param ignore_file_not_found : "Whether to ignore file not found error in diagnostics"
@return "Number of severe diagnostics"
*>
-fn usz runDiagnostics(
+fn sz runDiagnostics(
CXTranslationUnit tu,
String header_name,
CXDiagnosticSeverity min_severity,
@@ -148,7 +142,7 @@ fn usz runDiagnostics(
@inline
{
CUInt diagnostics_count = clang::getNumDiagnostics(tu);
- usz severe_count;
+ sz severe_count;
for (CUInt i; i < diagnostics_count; ++i) {
CXDiagnostic diag = clang::getDiagnostic(tu, i);
defer clang::disposeDiagnostic(diag);
@@ -181,23 +175,23 @@ fn void? checkCode(
CXErrorCode code)
{
switch (code) {
- case clang::ERROR_SUCCESS:
- break;
- case clang::ERROR_FAILURE:
- case clang::ERROR_AST_READ_ERROR:
- return bg::CLANG_PARSE_ERROR~;
- case clang::ERROR_CRASHED:
- return bg::CLANG_CRASH~;
- case clang::ERROR_INVALID_ARGUMENTS:
- return bg::INVALID_ARGUMENTS~;
+ case ERROR_SUCCESS:
+ break;
+ case ERROR_FAILURE:
+ case ERROR_AST_READ_ERROR:
+ return bg::CLANG_PARSE_ERROR~;
+ case ERROR_CRASHED:
+ return bg::CLANG_CRASH~;
+ case ERROR_INVALID_ARGUMENTS:
+ return bg::INVALID_ARGUMENTS~;
}
}
-const TRANSLATION_UNIT_PARSE_FLAGS =
- clang::TRANSLATION_UNIT_DETAILED_PREPROCESSING_RECORD
- | clang::TRANSLATION_UNIT_IGNORE_NON_ERRORS_FROM_INCLUDED_FILES
- | clang::TRANSLATION_UNIT_SKIP_FUNCTION_BODIES
- | clang::TRANSLATION_UNIT_KEEP_GOING;
+const CXTranslationUnit_Flags TRANSLATION_UNIT_PARSE_FLAGS =
+ CXTranslationUnit_Flags.TRANSLATION_UNIT_DETAILED_PREPROCESSING_RECORD
+| CXTranslationUnit_Flags.TRANSLATION_UNIT_IGNORE_NON_ERRORS_FROM_INCLUDED_FILES
+| CXTranslationUnit_Flags.TRANSLATION_UNIT_SKIP_FUNCTION_BODIES
+| CXTranslationUnit_Flags.TRANSLATION_UNIT_KEEP_GOING;
diff --git a/bindgen.c3l/src/bgstr.c3 b/bindgen.c3l/src/bgstr.c3
index b8e32cd..77d63f4 100644
--- a/bindgen.c3l/src/bgstr.c3
+++ b/bindgen.c3l/src/bgstr.c3
@@ -3,7 +3,7 @@ module bgimpl;
import bgimpl::err;
import std::collections::list;
import std::collections::map;
-import std::ascii;
+import std::core::ascii;
alias ListString = List{String};
@@ -153,7 +153,7 @@ fn String camelToPascal(
@export("bgstr_camel_to_pascal")
{
String res = str.copy(alloc);
- usz i;
+ sz i;
while (i < str.len && str[i] == '_') ++i;
if (i < str.len) res[i] = str[i].to_upper();
return res;
@@ -193,7 +193,7 @@ fn String pascalToCamel(
@export("bgstr_pascal_to_camel")
{
String res = str.copy(alloc);
- usz i;
+ sz i;
while (i < str.len && str[i] == '_') ++i;
if (i < str.len) res[i] = str[i].to_lower();
return res;
@@ -273,18 +273,18 @@ fn ListString parseSnakeCase(
tokens.init(alloc, str.len / 2);
// Treat possible beginning '_'
- usz first = 0;
+ sz first = 0;
while (first < str.len && str[first] == '_') ++first;
if (first > 0) tokens.push(str[0..first-1]);
// Treat possible closing '_'
- usz last = str.len - 1;
+ sz last = str.len - 1;
while (last > 0 && str[last] == '_') --last;
// Treat the rest [first..last]
- for (usz i = first; i <= last;) {
+ for (sz i = first; i <= last;) {
while (i <= last && str[i] == '_') ++i;
- usz begin = i;
+ sz begin = i;
while (i <= last && str[i] != '_') ++i;
tokens.push(str[begin..i-1]);
}
@@ -324,17 +324,17 @@ fn ListString parseCamelCase(
tokens.init(alloc, str.len / 2);
// Erase possible beginning '_'
- isz first = 0;
+ sz first = 0;
while (first < str.len && str[first] == '_') ++first;
if (first > 0) tokens.push(str[0..first-1]);
// Erase possible closing '_'
- isz last = str.len - 1;
+ sz last = str.len - 1;
while (last >= 0 && str[last] == '_') --last;
// Treat the rest [first..last]
- for (usz i = first; i <= last;) {
- usz begin = i++;
+ for (sz i = first; i <= last;) {
+ sz begin = i++;
// Handle several upper cases and digits in a row
bool is_prev_digit = false;
@@ -465,7 +465,7 @@ macro String convertToSnakeOrScreaming(
ListString* tokens,
bool $to_snake)
{
- usz size = 0;
+ sz size = 0;
foreach (t : tokens) {
size += t.len;
@@ -476,11 +476,11 @@ macro String convertToSnakeOrScreaming(
--size;
// If last token is '_', we do not insert '_' after prelast token
- usz last_token_index = tokens.len() - ((*tokens)[^1][0] == '_' ? 2 : 1);
+ sz last_token_index = tokens.len() - ((*tokens)[^1][0] == '_' ? 2 : 1);
- String res = (String) allocator::alloc_array(alloc, char, size);
+ String res = (String)alloc::alloc_array(alloc, char, size);
- usz last = 0;
+ sz last = 0;
foreach (i, t : tokens) {
res[last:t.len] = t[..];
@@ -515,22 +515,22 @@ macro String convertToCamelOrPascal(
ListString* tokens,
bool $to_camel)
{
- usz size = 0;
+ sz size = 0;
foreach (t : tokens) {
size += t.len;
}
- String res = (String) allocator::alloc_array(alloc, char, size);
+ String res = (String)alloc::alloc_array(alloc, char, size);
$if $to_camel:
bool has_underscore = (*tokens)[0][0] == '_';
$endif
- usz last = 0;
+ sz last = 0;
foreach (i, t : *tokens) {
res[last:t.len] = t[..];
- usz offset = 1;
+ sz offset = 1;
$if $to_camel:
if (i == (has_underscore ? 1 : 0)) offset = 0;
$endif
@@ -545,7 +545,7 @@ macro String convertToCamelOrPascal(
res[last] = res[last].to_upper();
$endif
- for (usz j = last + offset; j < last + t.len; ++j) {
+ for (sz j = last + offset; j < last + t.len; ++j) {
res[j] = res[j].to_lower();
}
diff --git a/bindgen.c3l/src/clang.c3i b/bindgen.c3l/src/clang.c3i
index 820d246..15cd39d 100644
--- a/bindgen.c3l/src/clang.c3i
+++ b/bindgen.c3l/src/clang.c3i
@@ -1,8218 +1,8119 @@
module clang;
-import libc; // for Time_t
-
-/*-------------------------------*\
-| |
-| File CXErrorCode.h |
-| |
-\*-------------------------------*/
-
-/**
- * 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.
- */
-typedef CXErrorCode = inline CInt;
-
-/**
- * No error.
- */
-const CXErrorCode 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.
- */
-const CXErrorCode ERROR_FAILURE = 1;
-
-/**
- * libclang crashed while performing the requested operation.
- */
-const CXErrorCode ERROR_CRASHED = 2;
-
-/**
- * The function detected that the arguments violate the function
- * contract.
- */
-const CXErrorCode ERROR_INVALID_ARGUMENTS = 3;
-
-/**
- * An AST deserialization error has occurred.
- */
-const CXErrorCode ERROR_AST_READ_ERROR = 4;
-
-
-/*-------------------------------*\
-| |
-| File CXString.h |
-| |
-\*-------------------------------*/
-
-/**
- * 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.
- */
+import libc;
+
+<*
+ 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.
+*>
+constdef CXErrorCode : CInt {
+
+ <*
+ No error.
+ *>
+ 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.
+ *>
+ ERROR_FAILURE = 1,
+
+ <*
+ libclang crashed while performing the requested operation.
+ *>
+ ERROR_CRASHED = 2,
+
+ <*
+ The function detected that the arguments violate the function
+ contract.
+ *>
+ ERROR_INVALID_ARGUMENTS = 3,
+
+ <*
+ An AST deserialization error has occurred.
+ *>
+ ERROR_AST_READ_ERROR = 4
+}
+
+<*
+ 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.
+*>
struct CXString {
void* data;
CUInt private_flags;
}
+
struct CXStringSet {
CXString* strings;
CUInt count;
}
-/**
- * Retrieve the character data associated with the given string.
- */
-fn ZString getCString(
- CXString string)
-@extern("clang_getCString");
-
-/**
- * Free the given string.
- */
-fn void disposeString(
- CXString string)
-@extern("clang_disposeString");
-
-/**
- * Free the given string set.
- */
-fn void disposeStringSet(
- CXStringSet* set)
-@extern("clang_disposeStringSet");
-
-
-/*-------------------------------*\
-| |
-| File CXFile.h |
-| |
-\*-------------------------------*/
-
-/**
- * A particular source file that is part of a translation unit.
- */
-typedef CXFile = inline void*;
-
-/**
- * Retrieve the complete file and path name of the given file.
- */
-fn CXString getFileName(
- CXFile sfile)
-@extern("clang_getFileName");
-
-/**
- * Retrieve the last modification time of the given file.
- */
-fn Time_t getFileTime(
- CXFile sfile)
-@extern("clang_getFileTime");
-
-/**
- * Uniquely identifies a CXFile, that refers to the same underlying file,
- * across an indexing session.
- */
+<*
+ 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()`.
+*>
+extern fn ZString getCString(
+ CXString string)
+@cname("clang_getCString");
+
+<*
+ Free the given string.
+*>
+extern fn void disposeString(
+ CXString string)
+@cname("clang_disposeString");
+
+<*
+ Free the given string set.
+*>
+extern fn void disposeStringSet(
+ CXStringSet* set)
+@cname("clang_disposeStringSet");
+
+<*
+ Return the timestamp for use with Clang's
+ \c -fbuild-session-timestamp= option.
+*>
+extern fn CULongLong getBuildSessionTimestamp()
+@cname("clang_getBuildSessionTimestamp");
+
+alias CXVirtualFileOverlay = void*;
+
+<*
+ Create a \c CXVirtualFileOverlay object.
+ Must be disposed with \c clang_VirtualFileOverlay_dispose().
+ \param options is reserved, always pass 0.
+*>
+extern fn CXVirtualFileOverlay virtualFileOverlay_create(
+ CUInt options)
+@cname("clang_VirtualFileOverlay_create");
+
+<*
+ 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.
+*>
+extern fn CXErrorCode virtualFileOverlay_addFileMapping(
+ CXVirtualFileOverlay,
+ ZString virtual_path,
+ ZString real_path)
+@cname("clang_VirtualFileOverlay_addFileMapping");
+
+<*
+ 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.
+*>
+extern fn CXErrorCode virtualFileOverlay_setCaseSensitivity(
+ CXVirtualFileOverlay,
+ CInt case_sensitive)
+@cname("clang_VirtualFileOverlay_setCaseSensitivity");
+
+<*
+ 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.
+*>
+extern fn CXErrorCode virtualFileOverlay_writeToBuffer(
+ CXVirtualFileOverlay,
+ CUInt options,
+ ZString* out_buffer_ptr,
+ CUInt* out_buffer_size)
+@cname("clang_VirtualFileOverlay_writeToBuffer");
+
+<*
+ free memory allocated by libclang, such as the buffer returned by
+ \c CXVirtualFileOverlay() or \c clang_ModuleMapDescriptor_writeToBuffer().
+ \param buffer memory pointer to free.
+*>
+extern fn void free(
+ void* buffer)
+@cname("clang_free");
+
+<*
+ Dispose a \c CXVirtualFileOverlay object.
+*>
+extern fn void virtualFileOverlay_dispose(
+ CXVirtualFileOverlay)
+@cname("clang_VirtualFileOverlay_dispose");
+
+alias CXModuleMapDescriptor = void*;
+
+<*
+ Create a \c CXModuleMapDescriptor object.
+ Must be disposed with \c clang_ModuleMapDescriptor_dispose().
+ \param options is reserved, always pass 0.
+*>
+extern fn CXModuleMapDescriptor moduleMapDescriptor_create(
+ CUInt options)
+@cname("clang_ModuleMapDescriptor_create");
+
+<*
+ Sets the framework module name that the module.modulemap describes.
+ \returns 0 for success, non-zero to indicate an error.
+*>
+extern fn CXErrorCode moduleMapDescriptor_setFrameworkModuleName(
+ CXModuleMapDescriptor,
+ ZString name)
+@cname("clang_ModuleMapDescriptor_setFrameworkModuleName");
+
+<*
+ Sets the umbrella header name that the module.modulemap describes.
+ \returns 0 for success, non-zero to indicate an error.
+*>
+extern fn CXErrorCode moduleMapDescriptor_setUmbrellaHeader(
+ CXModuleMapDescriptor,
+ ZString name)
+@cname("clang_ModuleMapDescriptor_setUmbrellaHeader");
+
+<*
+ 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.
+*>
+extern fn CXErrorCode moduleMapDescriptor_writeToBuffer(
+ CXModuleMapDescriptor,
+ CUInt options,
+ ZString* out_buffer_ptr,
+ CUInt* out_buffer_size)
+@cname("clang_ModuleMapDescriptor_writeToBuffer");
+
+<*
+ Dispose a \c CXModuleMapDescriptor object.
+*>
+extern fn void moduleMapDescriptor_dispose(
+ CXModuleMapDescriptor)
+@cname("clang_ModuleMapDescriptor_dispose");
+
+alias CXFile = void*;
+
+<*
+ Retrieve the complete file and path name of the given file.
+*>
+extern fn CXString getFileName(
+ CXFile s_file)
+@cname("clang_getFileName");
+
+<*
+ Retrieve the last modification time of the given file.
+*>
+extern fn Time_t getFileTime(
+ CXFile s_file)
+@cname("clang_getFileTime");
+
+<*
+ Uniquely identifies a CXFile, that refers to the same underlying file,
+ across an indexing session.
+*>
struct CXFileUniqueID {
- CLongLong[3] data;
+ CULongLong[3] data;
}
-/**
- * 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.
- */
-fn CInt getFileUniqueID(
- CXFile file,
- CXFileUniqueID* out_id)
-@extern("clang_getFileUniqueID");
-
-/**
- * Returns non-zero if the \c file1 and \c file2 point to the same file,
- * or they are both NULL.
- */
-fn CInt isEqual_File(
- CXFile file1,
- CXFile file2)
-@extern("clang_File_isEqual");
-
-/**
- * Returns the real path name of \c file.
- *
- * An empty string may be returned. Use \c clang_getFileName() in that case.
- */
-fn CXString tryGetRealPathName_File(
- CXFile file)
-@extern("clang_File_tryGetRealPathName");
-
-
-/*-------------------------------*\
-| |
-| File CXSourceLocation.h |
-| |
-\*-------------------------------*/
-
-/**
- * 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.
- */
+<*
+ 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.
+*>
+extern fn CInt getFileUniqueID(
+ CXFile file,
+ CXFileUniqueID* out_id)
+@cname("clang_getFileUniqueID");
+
+<*
+ Returns non-zero if the \c file1 and \c file2 point to the same file,
+ or they are both NULL.
+*>
+extern fn CInt file_isEqual(
+ CXFile file_1,
+ CXFile file_2)
+@cname("clang_File_isEqual");
+
+<*
+ Returns the real path name of \c file.
+ An empty string may be returned. Use \c clang_getFileName() in that case.
+*>
+extern fn CXString file_tryGetRealPathName(
+ CXFile file)
+@cname("clang_File_tryGetRealPathName");
+
+<*
+ 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.
+*>
struct CXSourceLocation {
void*[2] ptr_data;
CUInt 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.
- */
+<*
+ 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.
+*>
struct CXSourceRange {
void*[2] ptr_data;
CUInt begin_int_data;
CUInt end_int_data;
}
-/**
- * Retrieve a NULL (invalid) source location.
- */
-fn CXSourceLocation getNullLocation()
-@extern("clang_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.
- */
-fn CUInt equalLocations(
- CXSourceLocation loc1,
- CXSourceLocation loc2)
-@extern("clang_equalLocations");
-
-/**
- * Returns non-zero if the given source location is in a system header.
- */
-fn CInt isInSystemHeader_Location(
- CXSourceLocation location)
-@extern("clang_Location_isInSystemHeader");
-
-/**
- * Returns non-zero if the given source location is in the main file of
- * the corresponding translation unit.
- */
-fn CInt isFromMainFile_Location(
- CXSourceLocation location)
-@extern("clang_Location_isFromMainFile");
-
-/**
- * Retrieve a NULL (invalid) source range.
- */
-fn CXSourceRange getNullRange()
-@extern("clang_getNullRange");
-
-/**
- * Retrieve a source range given the beginning and ending source
- * locations.
- */
-fn CXSourceRange getRange(
- CXSourceLocation begin,
- CXSourceLocation end)
-@extern("clang_getRange");
-
-/**
- * Determine whether two ranges are equivalent.
- *
- * \returns non-zero if the ranges are the same, zero if they differ.
- */
-fn CUInt equalRanges(
- CXSourceRange range1,
- CXSourceRange range2)
-@extern("clang_equalRanges");
-
-/**
- * Returns non-zero if \p range is null.
- */
-fn CInt isNull_Range(
- CXSourceRange range)
-@extern("clang_Range_isNull");
-
-/**
- * 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.
- */
-fn void getExpansionLocation(
- CXSourceLocation location,
- CXFile* file,
- CUInt* line,
- CUInt* column,
- CUInt* offset)
-@extern("clang_getExpansionLocation");
-
-/**
- * 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 CInt 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.
- */
-fn void getPresumedLocation(
- CXSourceLocation location,
- CXString* filename,
- CUInt* line,
- CUInt* column)
-@extern("clang_getPresumedLocation");
-
-/**
- * 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.
- */
-fn void getInstantiationLocation(
- CXSourceLocation location,
- CXFile* file,
- CUInt* line,
- CUInt* column,
- CUInt* offset)
-@extern("clang_getInstantiationLocation");
-
-/**
- * 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.
- */
-fn void getSpellingLocation(
- CXSourceLocation location,
- CXFile* file,
- CUInt* line,
- CUInt* column,
- CUInt* offset)
-@extern("clang_getSpellingLocation");
-
-/**
- * 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.
- */
-fn void getFileLocation(
- CXSourceLocation location,
- CXFile* file,
- CUInt* line,
- CUInt* column,
- CUInt* offset)
-@extern("clang_getFileLocation");
-
-/**
- * Retrieve a source location representing the first character within a
- * source range.
- */
-fn CXSourceLocation getRangeStart(
- CXSourceRange range)
-@extern("clang_getRangeStart");
-
-/**
- * Retrieve a source location representing the last character within a
- * source range.
- */
-fn CXSourceLocation getRangeEnd(
- CXSourceRange range)
-@extern("clang_getRangeEnd");
-
-/**
- * Identifies an array of ranges.
- */
+<*
+ Retrieve a NULL (invalid) source location.
+*>
+extern fn CXSourceLocation getNullLocation()
+@cname("clang_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.
+*>
+extern fn CUInt equalLocations(
+ CXSourceLocation loc_1,
+ CXSourceLocation loc_2)
+@cname("clang_equalLocations");
+
+<*
+ 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.
+*>
+extern fn CUInt isBeforeInTranslationUnit(
+ CXSourceLocation loc_1,
+ CXSourceLocation loc_2)
+@cname("clang_isBeforeInTranslationUnit");
+
+<*
+ Returns non-zero if the given source location is in a system header.
+*>
+extern fn CInt location_isInSystemHeader(
+ CXSourceLocation location)
+@cname("clang_Location_isInSystemHeader");
+
+<*
+ Returns non-zero if the given source location is in the main file of
+ the corresponding translation unit.
+*>
+extern fn CInt location_isFromMainFile(
+ CXSourceLocation location)
+@cname("clang_Location_isFromMainFile");
+
+<*
+ Retrieve a NULL (invalid) source range.
+*>
+extern fn CXSourceRange getNullRange()
+@cname("clang_getNullRange");
+
+<*
+ Retrieve a source range given the beginning and ending source
+ locations.
+*>
+extern fn CXSourceRange getRange(
+ CXSourceLocation begin,
+ CXSourceLocation end)
+@cname("clang_getRange");
+
+<*
+ Determine whether two ranges are equivalent.
+ \returns non-zero if the ranges are the same, zero if they differ.
+*>
+extern fn CUInt equalRanges(
+ CXSourceRange range_1,
+ CXSourceRange range_2)
+@cname("clang_equalRanges");
+
+<*
+ Returns non-zero if \p range is null.
+*>
+extern fn CInt range_isNull(
+ CXSourceRange range)
+@cname("clang_Range_isNull");
+
+<*
+ 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.
+*>
+extern fn void getExpansionLocation(
+ CXSourceLocation location,
+ CXFile* file,
+ CUInt* line,
+ CUInt* column,
+ CUInt* offset)
+@cname("clang_getExpansionLocation");
+
+<*
+ 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.
+*>
+extern fn void getPresumedLocation(
+ CXSourceLocation location,
+ CXString* filename,
+ CUInt* line,
+ CUInt* column)
+@cname("clang_getPresumedLocation");
+
+<*
+ 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.
+*>
+extern fn void getInstantiationLocation(
+ CXSourceLocation location,
+ CXFile* file,
+ CUInt* line,
+ CUInt* column,
+ CUInt* offset)
+@cname("clang_getInstantiationLocation");
+
+<*
+ 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.
+*>
+extern fn void getSpellingLocation(
+ CXSourceLocation location,
+ CXFile* file,
+ CUInt* line,
+ CUInt* column,
+ CUInt* offset)
+@cname("clang_getSpellingLocation");
+
+<*
+ 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.
+*>
+extern fn void getFileLocation(
+ CXSourceLocation location,
+ CXFile* file,
+ CUInt* line,
+ CUInt* column,
+ CUInt* offset)
+@cname("clang_getFileLocation");
+
+<*
+ Retrieve a source location representing the first character within a
+ source range.
+*>
+extern fn CXSourceLocation getRangeStart(
+ CXSourceRange range)
+@cname("clang_getRangeStart");
+
+<*
+ Retrieve a source location representing the last character within a
+ source range.
+*>
+extern fn CXSourceLocation getRangeEnd(
+ CXSourceRange range)
+@cname("clang_getRangeEnd");
+
+<*
+ Identifies an array of ranges.
+*>
struct CXSourceRangeList {
- /* The number of ranges in the \c ranges array. */
CUInt count;
- /*
- * An array of \c CXSourceRanges.
- */
CXSourceRange* ranges;
}
-/**
- * Destroy the given \c CXSourceRangeList.
- */
-fn void disposeSourceRangeList(
- CXSourceRangeList* ranges)
-@extern("clang_disposeSourceRangeList");
-
-
-/*-------------------------------*\
-| |
-| File CXDiagnostic.h |
-| |
-\*-------------------------------*/
-
-/**
- * Describes the severity of a particular diagnostic.
- */
-typedef CXDiagnosticSeverity = inline CInt;
-
-/**
- * A diagnostic that has been suppressed, e.g., by a command-line
- * option.
- */
-const CXDiagnosticSeverity DIAGNOSTIC_IGNORED = 0;
-
-/**
- * This diagnostic is a note that should be attached to the
- * previous (non-note) diagnostic.
- */
-const CXDiagnosticSeverity DIAGNOSTIC_NOTE = 1;
-
-/**
- * This diagnostic indicates suspicious code that may not be
- * wrong.
- */
-const CXDiagnosticSeverity DIAGNOSTIC_WARNING = 2;
-
-/**
- * This diagnostic indicates that the code is ill-formed.
- */
-const CXDiagnosticSeverity DIAGNOSTIC_ERROR = 3;
-
-/**
- * This diagnostic indicates that the code is ill-formed such
- * that future parser recovery is unlikely to produce useful
- * results.
- */
-const CXDiagnosticSeverity DIAGNOSTIC_FATAL = 4;
-
-
-/**
- * A single diagnostic, containing the diagnostic's severity,
- * location, text, source ranges, and fix-it hints.
- */
-typedef CXDiagnostic = inline void*;
-
-/**
- * A group of CXDiagnostics.
- */
-typedef CXDiagnosticSet = inline void*;
-
-/**
- * Determine the number of diagnostics in a CXDiagnosticSet.
- */
-fn CUInt getNumDiagnosticsInSet(
- CXDiagnosticSet diags)
-@extern("clang_getNumDiagnosticsInSet");
-
-/**
- * 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().
- */
-fn CXDiagnostic getDiagnosticInSet(
- CXDiagnosticSet diags,
- CUInt index)
-@extern("clang_getDiagnosticInSet");
-
-/**
- * Describes the kind of error that occurred (if any) in a call to
- * \c clang_loadDiagnostics.
- */
-typedef CXLoadDiag_Error = inline CInt;
-/**
- * Indicates that no error occurred.
- */
-const CXLoadDiag_Error LOAD_DIAG_NONE = 0;
-
-/**
- * Indicates that an unknown error occurred while attempting to
- * deserialize diagnostics.
- */
-const CXLoadDiag_Error LOAD_DIAG_UNKNOWN = 1;
-
-/**
- * Indicates that the file containing the serialized diagnostics
- * could not be opened.
- */
-const CXLoadDiag_Error LOAD_DIAG_CANNOT_LOAD = 2;
-
-/**
- * Indicates that the serialized diagnostics file is invalid or
- * corrupt.
- */
-const CXLoadDiag_Error LOAD_DIAG_INVALID_FILE = 3;
-
-/**
- * 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().
- */
-fn CXDiagnosticSet loadDiagnostics(
- ZString file,
- CXLoadDiag_Error* error,
- CXString* errorString)
-@extern("clang_loadDiagnostics");
-
-/**
- * Release a CXDiagnosticSet and all of its contained diagnostics.
- */
-fn void disposeDiagnosticSet(
- CXDiagnosticSet diags)
-@extern("clang_disposeDiagnosticSet");
-
-/**
- * Retrieve the child diagnostics of a CXDiagnostic.
- *
- * This CXDiagnosticSet does not need to be released by
- * clang_disposeDiagnosticSet.
- */
-fn CXDiagnosticSet getChildDiagnostics(
- CXDiagnostic d)
-@extern("clang_getChildDiagnostics");
-
-/**
- * Destroy a diagnostic.
- */
-fn void disposeDiagnostic(
- CXDiagnostic diagnostic)
-@extern("clang_disposeDiagnostic");
-
-/**
- * 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().
- */
-typedef CXDiagnosticDisplayOptions = inline CInt;
-
-/**
- * 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.
- */
-const CXDiagnosticDisplayOptions DIAGNOSTIC_DISPLAY_SOURCE_LOCATION = 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.
- */
-const CXDiagnosticDisplayOptions DIAGNOSTIC_DISPLAY_COLUMN = 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.
- */
-const CXDiagnosticDisplayOptions DIAGNOSTIC_DISPLAY_SOURCE_RANGES = 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.
- */
-const CXDiagnosticDisplayOptions DIAGNOSTIC_DISPLAY_OPTION = 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.
- */
-const CXDiagnosticDisplayOptions DIAGNOSTIC_DISPLAY_CATEGORY_ID = 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.
- */
-const CXDiagnosticDisplayOptions DIAGNOSTIC_DISPLAY_CATEGORY_NAME = 0x20;
-
-/**
- * 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.
- */
-fn CXString formatDiagnostic(
- CXDiagnostic diagnostic,
- CUInt options)
-@extern("clang_formatDiagnostic");
-
-/**
- * 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().
- */
-fn CUInt defaultDiagnosticDisplayOptions()
-@extern("clang_defaultDiagnosticDisplayOptions");
-
-/**
- * Determine the severity of the given diagnostic.
- */
-fn CXDiagnosticSeverity getDiagnosticSeverity(
- CXDiagnostic d)
-@extern("clang_getDiagnosticSeverity");
-
-/**
- * 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.
- */
-fn CXSourceLocation getDiagnosticLocation(
- CXDiagnostic d)
-@extern("clang_getDiagnosticLocation");
-
-/**
- * Retrieve the text of the given diagnostic.
- */
-fn CXString getDiagnosticSpelling(
- CXDiagnostic d)
-@extern("clang_getDiagnosticSpelling");
-
-/**
- * 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".
- */
-fn CXString getDiagnosticOption(
- CXDiagnostic diag,
- CXString* disable)
-@extern("clang_getDiagnosticOption");
-
-/**
- * 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.
- */
-fn CUInt getDiagnosticCategory(
- CXDiagnostic d)
-@extern("clang_getDiagnosticCategory");
-
-/**
- * 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.
- */
-fn CXString getDiagnosticCategoryName(
- CUInt category)
-@extern("clang_getDiagnosticCategoryName")
-@deprecated("Use clang_getDiagnosticCategoryText()");
-
-/**
- * Retrieve the diagnostic category text for a given diagnostic.
- *
- * \returns The text of the given diagnostic category.
- */
-fn CXString getDiagnosticCategoryText(
- CXDiagnostic d)
-@extern("clang_getDiagnosticCategoryText");
-
-/**
- * Determine the number of source ranges associated with the given
- * diagnostic.
- */
-fn CUInt getDiagnosticNumRanges(
- CXDiagnostic d)
-@extern("clang_getDiagnosticNumRanges");
-
-/**
- * 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.
- */
-fn CXSourceRange getDiagnosticRange(
- CXDiagnostic diagnostic,
- CUInt range)
-@extern("clang_getDiagnosticRange");
-
-/**
- * Determine the number of fix-it hints associated with the
- * given diagnostic.
- */
-fn CUInt getDiagnosticNumFixIts(
- CXDiagnostic diagnostic)
-@extern("clang_getDiagnosticNumFixIts");
-
-/**
- * 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.
- */
-fn CXString getDiagnosticFixIt(
- CXDiagnostic diagnostic,
- CUInt fix_it,
- CXSourceRange* replacement_range)
-@extern("clang_getDiagnosticFixIt");
-
-
-/*-------------------------------*\
-| |
-| File CXCompilationDatabase.h |
-| |
-\*-------------------------------*/
-
-/**
- * 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
- */
-typedef CXCompilationDatabase = inline void*;
-
-/**
- * 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.
- */
-typedef CXCompileCommands = inline void*;
-
-/**
- * Represents the command line invocation to compile a specific file.
- */
-typedef CXCompileCommand = inline void*;
-
-/**
- * Error codes for Compilation Database
- */
-typedef CXCompilationDatabase_Error = inline CInt;
-
-/*
- * No error occurred
- */
-const CXCompilationDatabase_Error COMPILATION_DATABASE_NO_ERROR = 0;
-/*
- * Database can not be loaded
- */
-const CXCompilationDatabase_Error COMPILATION_DATABASE_CAN_NOT_LOAD_DATA_BASE = 1;
-
-/**
- * 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.
- */
-fn CXCompilationDatabase fromDirectory_CompilationDatabase(
- ZString build_dir,
- CXCompilationDatabase_Error* error_code)
-@extern("clang_CompilationDatabase_fromDirectory");
-
-/**
- * Free the given compilation database
- */
-fn void dispose_CompilationDatabase(
- CXCompilationDatabase database)
-@extern("clang_CompilationDatabase_dispose");
-
-/**
- * Find the compile commands used for a file. The compile commands
- * must be freed by \c clang_CompileCommands_dispose.
- */
-fn CXCompileCommands getCompileCommands_CompilationDatabase(
- CXCompilationDatabase database,
- ZString complete_fileName)
-@extern("clang_CompilationDatabase_getCompileCommands");
-
-/**
- * Get all the compile commands in the given compilation database.
- */
-fn CXCompileCommands getAllCompileCommands_CompilationDatabase(
- CXCompilationDatabase database)
-@extern("clang_CompilationDatabase_getAllCompileCommands");
-
-/**
- * Free the given CompileCommands
- */
-fn void dispose_CompileCommands(
- CXCompileCommands commands)
-@extern("clang_CompileCommands_dispose");
-
-/**
- * Get the number of CompileCommand we have for a file
- */
-fn CUInt getSize_CompileCommands(
- CXCompileCommands commands)
-@extern("clang_CompileCommands_getSize");
-
-/**
- * Get the I'th CompileCommand for a file
- *
- * Note : 0 <= i < clang_CompileCommands_getSize(CXCompileCommands)
- */
-fn CXCompileCommand getCommand_CompileCommands(
- CXCompileCommands commands,
- CUInt i)
-@extern("clang_CompileCommands_getCommand");
-
-/**
- * Get the working directory where the CompileCommand was executed from
- */
-fn CXString getDirectory_CompileCommand(
- CXCompileCommand command)
-@extern("clang_CompileCommand_getDirectory");
-
-/**
- * Get the filename associated with the CompileCommand.
- */
-fn CXString getFilename_CompileCommand(
- CXCompileCommand command)
-@extern("clang_CompileCommand_getFilename");
-
-/**
- * Get the number of arguments in the compiler invocation.
- *
- */
-fn CUInt getNumArgs_CompileCommand(
- CXCompileCommand command)
-@extern("clang_CompileCommand_getNumArgs");
-
-/**
- * Get the I'th argument value in the compiler invocations
- *
- * Invariant :
- * - argument 0 is the compiler executable
- */
-fn CXString getArg_CompileCommand(
- CXCompileCommand command,
- CUInt i)
-@extern("clang_CompileCommand_getArg");
-
-/**
- * Get the number of source mappings for the compiler invocation.
- */
-fn CUInt getNumMappedSources_CompileCommand(
- CXCompileCommand command)
-@extern("clang_CompileCommand_getNumMappedSources");
-
-/**
- * Get the I'th mapped source path for the compiler invocation.
- */
-fn CXString getMappedSourcePath_CompileCommand(
- CXCompileCommand command,
- CUInt i)
-@extern("clang_CompileCommand_getMappedSourcePath");
-
-/**
- * Get the I'th mapped source content for the compiler invocation.
- */
-fn CXString getMappedSourceContent_CompileCommand(
- CXCompileCommand command,
- CUInt i)
-@extern("clang_CompileCommand_getMappedSourceContent");
-
-
-/*-------------------------------*\
-| |
-| File BuildSystem.h |
-| |
-\*-------------------------------*/
-
-/**
- * Return the timestamp for use with Clang's
- * \c -fbuild-session-timestamp= option.
- */
-fn CULongLong getBuildSessionTimestamp()
-@extern("clang_getBuildSessionTimestamp");
-
-/**
- * Object encapsulating information about overlaying virtual
- * file/directories over the real file system.
- */
-typedef CXVirtualFileOverlay = inline void*;
-
-/**
- * Create a \c CXVirtualFileOverlay object.
- * Must be disposed with \c clang_VirtualFileOverlay_dispose().
- *
- * \param options is reserved, always pass 0.
- */
-fn CXVirtualFileOverlay createVirtualFileOverlay(
- CUInt options)
-@extern("clang_VirtualFileOverlay_create");
-
-/**
- * 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.
- */
-fn CXErrorCode addFileMapping_VirtualFileOverlay(
- CXVirtualFileOverlay file_overlay,
- ZString virtual_path,
- ZString real_path)
-@extern("clang_VirtualFileOverlay_addFileMapping");
-
-/**
- * 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.
- */
-fn CXErrorCode setCaseSensitivity_VirtualFileOverlay(
- CXVirtualFileOverlay file_overaly,
- CInt case_sensitive)
-@extern("clang_VirtualFileOverlay_setCaseSensitivity");
-
-/**
- * Write out the \c CXVirtualFileOverlay object to a CChar 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.
- */
-fn CXErrorCode writeToBuffer_VirtualFileOverlay(
- CXVirtualFileOverlay file_overaly,
- CUInt options,
- CChar** out_buffer_ptr,
- CUInt* out_buffer_size)
-@extern("clang_VirtualFileOverlay_writeToBuffer");
-
-/**
- * free memory allocated by libclang, such as the buffer returned by
- * \c CXVirtualFileOverlay() or \c clang_ModuleMapDescriptor_writeToBuffer().
- *
- * \param buffer memory pointer to free.
- */
-fn void free(
- void* buffer)
-@extern("clang_free");
-
-/**
- * Dispose a \c CXVirtualFileOverlay object.
- */
-fn void dispose_VirtualFileOverlay(
- CXVirtualFileOverlay file_overlay)
-@extern("clang_VirtualFileOverlay_dispose");
-
-/**
- * Object encapsulating information about a module.modulemap file.
- */
-typedef CXModuleMapDescriptor = inline void*;
-
-/**
- * Create a \c CXModuleMapDescriptor object.
- * Must be disposed with \c clang_ModuleMapDescriptor_dispose().
- *
- * \param options is reserved, always pass 0.
- */
-fn CXModuleMapDescriptor createModuleMapDescriptor(
- CUInt options)
-@extern("clang_ModuleMapDescriptor_create");
-
-/**
- * Sets the framework module name that the module.modulemap describes.
- * \returns 0 for success, non-zero to indicate an error.
- */
-fn CXErrorCode setFrameworkModuleName_ModuleMapDescriptor(
- CXModuleMapDescriptor descriptor,
- ZString name)
-@extern("clang_ModuleMapDescriptor_setFrameworkModuleName");
-
-/**
- * Sets the umbrella header name that the module.modulemap describes.
- * \returns 0 for success, non-zero to indicate an error.
- */
-fn CXErrorCode setUmbrellaHeader_ModuleMapDescriptor(
- CXModuleMapDescriptor descriptor,
- ZString name)
-@extern("clang_ModuleMapDescriptor_setUmbrellaHeader");
-
-/**
- * Write out the \c CXModuleMapDescriptor object to a CChar 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.
- */
-fn CXErrorCode writeToBuffer_ModuleMapDescriptor(
- CXModuleMapDescriptor descriptor,
- CUInt options,
- CChar** out_buffer_ptr,
- CUInt* out_buffer_size)
-@extern("clang_ModuleMapDescriptor_writeToBuffer");
-
-/**
- * Dispose a \c CXModuleMapDescriptor object.
- */
-fn void dispose_ModuleMapDescriptor(
- CXModuleMapDescriptor descriptor)
-@extern("clang_ModuleMapDescriptor_dispose");
-
-
-/*-------------------------------*\
-| |
-| File Documentation.h |
-| |
-\*-------------------------------*/
-
-/**
- * A parsed comment.
- */
-struct CXComment {
- void* ast_node;
- CXTranslationUnit translation_unit;
+<*
+ Destroy the given \c CXSourceRangeList.
+*>
+extern fn void disposeSourceRangeList(
+ CXSourceRangeList* ranges)
+@cname("clang_disposeSourceRangeList");
+
+<*
+ Describes the severity of a particular diagnostic.
+*>
+constdef CXDiagnosticSeverity : CInt {
+
+ <*
+ A diagnostic that has been suppressed, e.g., by a command-line
+ option.
+ *>
+ DIAGNOSTIC_IGNORED = 0,
+
+ <*
+ This diagnostic is a note that should be attached to the
+ previous (non-note) diagnostic.
+ *>
+ DIAGNOSTIC_NOTE = 1,
+
+ <*
+ This diagnostic indicates suspicious code that may not be
+ wrong.
+ *>
+ DIAGNOSTIC_WARNING = 2,
+
+ <*
+ This diagnostic indicates that the code is ill-formed.
+ *>
+ DIAGNOSTIC_ERROR = 3,
+
+ <*
+ This diagnostic indicates that the code is ill-formed such
+ that future parser recovery is unlikely to produce useful
+ results.
+ *>
+ DIAGNOSTIC_FATAL = 4
+}
+
+alias CXDiagnostic = void*;
+
+alias CXDiagnosticSet = void*;
+
+<*
+ Determine the number of diagnostics in a CXDiagnosticSet.
+*>
+extern fn CUInt getNumDiagnosticsInSet(
+ CXDiagnosticSet diags)
+@cname("clang_getNumDiagnosticsInSet");
+
+<*
+ 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().
+*>
+extern fn CXDiagnostic getDiagnosticInSet(
+ CXDiagnosticSet diags,
+ CUInt index)
+@cname("clang_getDiagnosticInSet");
+
+<*
+ Describes the kind of error that occurred (if any) in a call to
+ \c clang_loadDiagnostics.
+*>
+constdef CXLoadDiag_Error : CInt {
+
+ <*
+ Indicates that no error occurred.
+ *>
+ LOAD_DIAG_NONE = 0,
+
+ <*
+ Indicates that an unknown error occurred while attempting to
+ deserialize diagnostics.
+ *>
+ LOAD_DIAG_UNKNOWN = 1,
+
+ <*
+ Indicates that the file containing the serialized diagnostics
+ could not be opened.
+ *>
+ LOAD_DIAG_CANNOT_LOAD = 2,
+
+ <*
+ Indicates that the serialized diagnostics file is invalid or
+ corrupt.
+ *>
+ LOAD_DIAG_INVALID_FILE = 3
}
-/**
- * Given a cursor that represents a documentable entity (e.g.,
- * declaration), return the associated parsed comment as a
- * \c CXComment_FullComment AST node.
- */
-fn CXComment getParsedComment_Cursor(
- CXCursor c)
-@extern("clang_Cursor_getParsedComment");
-
-/**
- * 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).
- */
-typedef CXCommentKind = inline CInt;
-
-/**
- * Null comment. No AST node is constructed at the requested location
- * because there is no text or a syntax error.
- */
-const CXCommentKind COMMENT_NULL = 0;
-
-/**
- * Plain text. Inline content.
- */
-const CXCommentKind COMMENT_TEXT = 1;
-
-/**
- * A command with word-like arguments that is considered inline content.
- *
- * For example: \\c command.
- */
-const CXCommentKind COMMENT_INLINE_COMMAND = 2;
-
-/**
- * HTML start tag with attributes (name-value pairs). Considered
- * inline content.
- *
- * For example:
- * \verbatim
- *
- * \endverbatim
- */
-const CXCommentKind COMMENT_HTML_START_TAG = 3;
-
-/**
- * HTML end tag. Considered inline content.
- *
- * For example:
- * \verbatim
- *
- * \endverbatim
- */
-const CXCommentKind COMMENT_HTML_END_TAG = 4;
-
-/**
- * A paragraph, contains inline comment. The paragraph itself is
- * block content.
- */
-const CXCommentKind COMMENT_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.
- */
-const CXCommentKind COMMENT_BLOCK_COMMAND = 6;
-
-/**
- * A \\param or \\arg command that describes the function parameter
- * (name, passing direction, description).
- *
- * For example: \\param [in] ParamName description.
- */
-const CXCommentKind COMMENT_PARAM_COMMAND = 7;
-
-/**
- * A \\tparam command that describes a template parameter (name and
- * description).
- *
- * For example: \\tparam T description.
- */
-const CXCommentKind COMMENT_TPARAM_COMMAND = 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
- */
-const CXCommentKind COMMENT_VERBATIM_BLOCK_COMMAND = 9;
-
-/**
- * A line of text that is contained within a
- * CXComment_VerbatimBlockCommand node.
- */
-const CXCommentKind COMMENT_VERBATIM_BLOCK_LINE = 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.
- */
-const CXCommentKind COMMENT_VERBATIM_LINE = 11;
-
-/**
- * A full comment attached to a declaration, contains block content.
- */
-const CXCommentKind COMMENT_FULL_COMMENT = 12;
-
-/**
- * The most appropriate rendering mode for an inline command, chosen on
- * command semantics in Doxygen.
- */
-typedef CXCommentInlineCommandRenderKind = inline CInt;
-/**
- * Command argument should be rendered in a normal font.
- */
-const CXCommentInlineCommandRenderKind COMMENT_INLINE_COMMAND_RENDER_KIND_NORMAL = 0;
-
-/**
- * Command argument should be rendered in a bold font.
- */
-const CXCommentInlineCommandRenderKind COMMENT_INLINE_COMMAND_RENDER_KIND_BOLD = 1;
-
-/**
- * Command argument should be rendered in a monospaced font.
- */
-const CXCommentInlineCommandRenderKind COMMENT_INLINE_COMMAND_RENDER_KIND_MONOSPACED = 2;
-
-/**
- * Command argument should be rendered emphasized (typically italic
- * font).
- */
-const CXCommentInlineCommandRenderKind COMMENT_INLINE_COMMAND_RENDER_KIND_EMPHASIZED = 3;
-
-/**
- * Command argument should not be rendered (since it only defines an anchor).
- */
-const CXCommentInlineCommandRenderKind COMMENT_INLINE_COMMAND_RENDER_KIND_ANCHOR = 4;
-
-/**
- * Describes parameter passing direction for \\param or \\arg command.
- */
-typedef CXCommentParamPassDirection = inline CInt;
-
-/**
- * The parameter is an input parameter.
- */
-const CXCommentParamPassDirection COMMENT_PARAM_PASS_DIRECTION_IN = 0;
-
-/**
- * The parameter is an output parameter.
- */
-const CXCommentParamPassDirection COMMENT_PARAM_PASS_DIRECTION_OUT = 1;
-
-/**
- * The parameter is an input and output parameter.
- */
-const CXCommentParamPassDirection COMMENT_PARAM_PASS_DIRECTION_IN_OUT = 2;
-
-/**
- * \param Comment AST node of any kind.
- *
- * \returns the type of the AST node.
- */
-fn CXCommentKind getKind_Comment(
- CXComment comment)
-@extern("clang_Comment_getKind");
-
-/**
- * \param Comment AST node of any kind.
- *
- * \returns number of children of the AST node.
- */
-fn CUInt getNumChildren_Comment(
- CXComment comment)
-@extern("clang_Comment_getNumChildren");
-
-/**
- * \param Comment AST node of any kind.
- *
- * \param ChildIdx child index (zero-based).
- *
- * \returns the specified child of the AST node.
- */
-fn CXComment getChild_Comment(
- CXComment comment,
- CUInt child_idx)
-@extern("clang_Comment_getChild");
-
-/**
- * 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.
- */
-fn CUInt isWhitespace_Comment(
- CXComment comment)
-@extern("clang_Comment_isWhitespace");
-
-/**
- * \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.
- */
-fn CUInt hasTrailingNewlineInlineContentComment(
- CXComment comment)
-@extern("clang_InlineContentComment_hasTrailingNewline");
-
-/**
- * \param Comment a \c CXComment_Text AST node.
- *
- * \returns text contained in the AST node.
- */
-fn CXString getTextTextComment(
- CXComment comment)
-@extern("clang_TextComment_getText");
-
-/**
- * \param Comment a \c CXComment_InlineCommand AST node.
- *
- * \returns name of the inline command.
- */
-fn CXString getCommandNameInlineCommandComment(
- CXComment comment)
-@extern("clang_InlineCommandComment_getCommandName");
-
-/**
- * \param Comment a \c CXComment_InlineCommand AST node.
- *
- * \returns the most appropriate rendering mode, chosen on command
- * semantics in Doxygen.
- */
-fn CXCommentInlineCommandRenderKind getRenderKindInlineCommandComment(
- CXComment comment)
-@extern("clang_InlineCommandComment_getRenderKind");
-
-/**
- * \param Comment a \c CXComment_InlineCommand AST node.
- *
- * \returns number of command arguments.
- */
-fn CUInt getNumArgsInlineCommandComment(
- CXComment comment)
-@extern("clang_InlineCommandComment_getNumArgs");
-
-/**
- * \param Comment a \c CXComment_InlineCommand AST node.
- *
- * \param ArgIdx argument index (zero-based).
- *
- * \returns text of the specified argument.
- */
-fn CXString getArgTextInlineCommandComment(
- CXComment comment,
- CUInt arg_idx)
-@extern("clang_InlineCommandComment_getArgText");
-
-/**
- * \param Comment a \c CXComment_HTMLStartTag or \c CXComment_HTMLEndTag AST
- * node.
- *
- * \returns HTML tag name.
- */
-fn CXString getTagNameHTMLTagComment(
- CXComment comment)
-@extern("clang_HTMLTagComment_getTagName");
-
-/**
- * \param Comment a \c CXComment_HTMLStartTag AST node.
- *
- * \returns non-zero if tag is self-closing (for example, <br />).
- */
-fn CUInt isSelfClosingHTMLStartTagComment(
- CXComment comment)
-@extern("clang_HTMLStartTagComment_isSelfClosing");
-
-/**
- * \param Comment a \c CXComment_HTMLStartTag AST node.
- *
- * \returns number of attributes (name-value pairs) attached to the start tag.
- */
-fn CUInt getNumAttrsHTMLStartTag(
- CXComment comment)
-@extern("clang_HTMLStartTag_getNumAttrs");
-
-/**
- * \param Comment a \c CXComment_HTMLStartTag AST node.
- *
- * \param AttrIdx attribute index (zero-based).
- *
- * \returns name of the specified attribute.
- */
-fn CXString getAttrNameHTMLStartTag(
- CXComment comment,
- CUInt attr_idx)
-@extern("clang_HTMLStartTag_getAttrName");
-
-/**
- * \param Comment a \c CXComment_HTMLStartTag AST node.
- *
- * \param AttrIdx attribute index (zero-based).
- *
- * \returns value of the specified attribute.
- */
-fn CXString getAttrValueHTMLStartTag(
- CXComment comment,
- CUInt attr_idx)
-@extern("clang_HTMLStartTag_getAttrValue");
-
-/**
- * \param Comment a \c CXComment_BlockCommand AST node.
- *
- * \returns name of the block command.
- */
-fn CXString getCommandNameCXBlockCommandComment(
- CXComment comment)
-@extern("clang_BlockCommandComment_getCommandName");
-
-/**
- * \param Comment a \c CXComment_BlockCommand AST node.
- *
- * \returns number of word-like arguments.
- */
-fn CUInt getNumArgsBlockCommandComment(
- CXComment comment)
-@extern("clang_BlockCommandComment_getNumArgs");
-
-/**
- * \param Comment a \c CXComment_BlockCommand AST node.
- *
- * \param ArgIdx argument index (zero-based).
- *
- * \returns text of the specified word-like argument.
- */
-fn CXString getArgTextBlockCommandComment(
- CXComment comment,
- CUInt arg_idx)
-@extern("clang_BlockCommandComment_getArgText");
-
-/**
- * \param Comment a \c CXComment_BlockCommand or
- * \c CXComment_VerbatimBlockCommand AST node.
- *
- * \returns paragraph argument of the block command.
- */
-fn CXComment getParagraphBlockCommandComment(
- CXComment comment)
-@extern("clang_BlockCommandComment_getParagraph");
-
-/**
- * \param Comment a \c CXComment_ParamCommand AST node.
- *
- * \returns parameter name.
- */
-fn CXString getParamNameParamCommandComment(
- CXComment comment)
-@extern("clang_ParamCommandComment_getParamName");
-
-/**
- * \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.
- */
-fn CUInt isParamIndexValidParamCommandComment(
- CXComment comment)
-@extern("clang_ParamCommandComment_isParamIndexValid");
-
-/**
- * \param Comment a \c CXComment_ParamCommand AST node.
- *
- * \returns zero-based parameter index in function prototype.
- */
-fn CUInt getParamIndexParamCommandComment(
- CXComment comment)
-@extern("clang_ParamCommandComment_getParamIndex");
-
-/**
- * \param Comment a \c CXComment_ParamCommand AST node.
- *
- * \returns non-zero if parameter passing direction was specified explicitly in
- * the comment.
- */
-fn CUInt isDirectionExplicitParamCommandComment(
- CXComment comment)
-@extern("clang_ParamCommandComment_isDirectionExplicit");
-
-/**
- * \param Comment a \c CXComment_ParamCommand AST node.
- *
- * \returns parameter passing direction.
- */
-fn CXCommentParamPassDirection getDirectionParamCommandComment(
- CXComment comment)
-@extern("clang_ParamCommandComment_getDirection");
-
-/**
- * \param Comment a \c CXComment_TParamCommand AST node.
- *
- * \returns template parameter name.
- */
-fn CXString getParamNameTParamCommandComment(
- CXComment comment)
-@extern("clang_TParamCommandComment_getParamName");
-
-/**
- * \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.
- */
-fn CUInt isParamPositionValidTParamCommandComment(
- CXComment comment)
-@extern("clang_TParamCommandComment_isParamPositionValid");
-
-/**
- * \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 class TT>
- * void test(TT aaa);
- * \endverbatim
- * for C and TT nesting depth is 0,
- * for T nesting depth is 1.
- */
-fn CUInt getDepthTParamCommandComment(
- CXComment comment)
-@extern("clang_TParamCommandComment_getDepth");
-
-/**
- * \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 class TT>
- * void test(TT 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.
- */
-fn CUInt getIndexTParamCommandComment(
- CXComment comment,
- CUInt depth)
-@extern("clang_TParamCommandComment_getIndex");
-
-/**
- * \param Comment a \c CXComment_VerbatimBlockLine AST node.
- *
- * \returns text contained in the AST node.
- */
-fn CXString getTextVerbatimBlockLineComment(
- CXComment comment)
-@extern("clang_VerbatimBlockLineComment_getText");
-
-/**
- * \param Comment a \c CXComment_VerbatimLine AST node.
- *
- * \returns text contained in the AST node.
- */
-fn CXString getTextVerbatimLineComment(
- CXComment comment)
-@extern("clang_VerbatimLineComment_getText");
-
-/**
- * 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.
- */
-fn CXString getAsStringHTMLTagComment(
- CXComment comment)
-@extern("clang_HTMLTagComment_getAsString");
-
-/**
- * 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 \ list with arguments
- * sorted in function prototype order. CSS classes used:
- * \li "param-name-index-NUMBER" for parameter name (\- );
- * \li "param-descr-index-NUMBER" for parameter description (\
- );
- * \li "param-name-index-invalid" and "param-descr-index-invalid" are used if
- * parameter index is invalid.
- *
- * Template parameter documentation is rendered as a \
list with
- * parameters sorted in template parameter list order. CSS classes used:
- * \li "tparam-name-index-NUMBER" for parameter name (\- );
- * \li "tparam-descr-index-NUMBER" for parameter description (\
- );
- * \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.
- */
-fn CXString getAsHTMLFullComment(
- CXComment comment)
-@extern("clang_FullComment_getAsHTML");
-
-/**
- * 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.
- */
-fn CXString getAsXMLFullComment(
- CXComment comment)
-@extern("clang_FullComment_getAsXML");
-
-/**
- * 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.
- */
-typedef CXAPISet = inline void*;
-
-/**
- * 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.
- */
-fn CXErrorCode createAPISet(
- CXTranslationUnit tu,
- CXAPISet* out_api)
-@extern("clang_createAPISet");
-
-/**
- * Dispose of an APISet.
- *
- * The provided \c CXAPISet can not be used after this function is called.
- */
-fn void disposeAPISet(
- CXAPISet api)
-@extern("clang_disposeAPISet");
-
-/**
- * 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.
- */
-fn CXString getSymbolGraphForUSR(
- ZString usr,
- CXAPISet api)
-@extern("clang_getSymbolGraphForUSR");
-
-/**
- * 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.
- */
-fn CXString getSymbolGraphForCursor(
- CXCursor cursor)
-@extern("clang_getSymbolGraphForCursor");
-
-
-/*-------------------------------*\
-| |
-| File FatalErrorHandler.h |
-| |
-\*-------------------------------*/
-
-/**
- * Installs error handler that prints error message to stderr and calls abort().
- * Replaces currently installed error handler (if any).
- */
-fn void installAbortingLLVMFatalErrorHandler()
-@extern("clang_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).
- */
-fn void uninstallLLVMFatalErrorHandler()
-@extern("clang_uninstall_llvm_fatal_error_handler");
-
-
-/*-------------------------------*\
-| |
-| File Rewrite.h |
-| |
-\*-------------------------------*/
-
-typedef CXRewriter = void*;
-
-/**
- * Create CXRewriter.
- */
-fn CXRewriter create_Rewriter(
- CXTranslationUnit tu)
-@extern("clang_CXRewriter_create");
-
-/**
- * Insert the specified string at the specified location in the original buffer.
- */
-fn void insertTextBefore_Rewriter(
- CXRewriter rew,
- CXSourceLocation loc,
- ZString insert)
-@extern("clang_CXRewriter_insertTextBefore");
-
-/**
- * Replace the specified range of characters in the input with the specified
- * replacement.
- */
-fn void replaceText_Rewriter(
- CXRewriter rew,
- CXSourceRange to_be_replaced,
- ZString replacement)
-@extern("clang_CXRewriter_replaceText");
-
-/**
- * Remove the specified range.
- */
-fn void removeText_Rewriter(
- CXRewriter rew,
- CXSourceRange to_be_removed)
-@extern("clang_CXRewriter_removeText");
-
-/**
- * Save all changed files to disk.
- * Returns 1 if any files were not saved successfully, returns 0 otherwise.
- */
-fn CInt overwriteChangedFiles_Rewriter(
- CXRewriter rew)
-@extern("clang_CXRewriter_overwriteChangedFiles");
-
-/**
- * Write out rewritten version of the main file to stdout.
- */
-fn void writeMainFileToStdOut_Rewriter(
- CXRewriter rew)
-@extern("clang_CXRewriter_writeMainFileToStdOut");
-
-/**
- * Free the given CXRewriter.
- */
-fn void dispose_Rewriter(
- CXRewriter rew)
-@extern("clang_CXRewriter_dispose");
-
-
-/*-------------------------------*\
-| |
-| File Index.h |
-| |
-\*-------------------------------*/
-
-/**
- * An "index" that consists of a set of translation units that would
- * typically be linked together into an executable or library.
- */
-typedef CXIndex = inline void*;
-
-/**
- * An opaque type representing target information for a given translation
- * unit.
- */
-typedef CXTargetInfo = inline void*;
-
-/**
- * A single translation unit, which resides in an index.
- */
-typedef CXTranslationUnit = inline void*;
-
-/**
- * Opaque pointer representing client data that will be passed through
- * to various callbacks and visitors.
- */
-typedef CXClientData = inline void*;
-
-/**
- * Provides the contents of a file that has not yet been saved to disk.
- *
- * Each CXUnsavedFile instance provides the name of a file on the
- * system along with the current contents of that file that have not
- * yet been saved to disk.
- */
+<*
+ 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().
+*>
+extern fn CXDiagnosticSet loadDiagnostics(
+ ZString file,
+ CXLoadDiag_Error* error,
+ CXString* error_string)
+@cname("clang_loadDiagnostics");
+
+<*
+ Release a CXDiagnosticSet and all of its contained diagnostics.
+*>
+extern fn void disposeDiagnosticSet(
+ CXDiagnosticSet diags)
+@cname("clang_disposeDiagnosticSet");
+
+<*
+ Retrieve the child diagnostics of a CXDiagnostic.
+ This CXDiagnosticSet does not need to be released by
+ clang_disposeDiagnosticSet.
+*>
+extern fn CXDiagnosticSet getChildDiagnostics(
+ CXDiagnostic d)
+@cname("clang_getChildDiagnostics");
+
+<*
+ Destroy a diagnostic.
+*>
+extern fn void disposeDiagnostic(
+ CXDiagnostic diagnostic)
+@cname("clang_disposeDiagnostic");
+
+<*
+ 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().
+*>
+constdef CXDiagnosticDisplayOptions : CInt {
+
+ <*
+ 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.
+ *>
+ DIAGNOSTIC_DISPLAY_SOURCE_LOCATION = 1,
+
+ <*
+ If displaying the source-location information of the
+ diagnostic, also include the column number.
+ This option corresponds to the clang flag \c -fshow-column.
+ *>
+ DIAGNOSTIC_DISPLAY_COLUMN = 2,
+
+ <*
+ 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.
+ *>
+ DIAGNOSTIC_DISPLAY_SOURCE_RANGES = 4,
+
+ <*
+ 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.
+ *>
+ DIAGNOSTIC_DISPLAY_OPTION = 8,
+
+ <*
+ 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.
+ *>
+ DIAGNOSTIC_DISPLAY_CATEGORY_ID = 16,
+
+ <*
+ 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.
+ *>
+ DIAGNOSTIC_DISPLAY_CATEGORY_NAME = 32
+}
+
+<*
+ 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.
+*>
+extern fn CXString formatDiagnostic(
+ CXDiagnostic diagnostic,
+ CUInt options)
+@cname("clang_formatDiagnostic");
+
+<*
+ 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().
+*>
+extern fn CUInt defaultDiagnosticDisplayOptions()
+@cname("clang_defaultDiagnosticDisplayOptions");
+
+<*
+ Determine the severity of the given diagnostic.
+*>
+extern fn CXDiagnosticSeverity getDiagnosticSeverity(
+ CXDiagnostic)
+@cname("clang_getDiagnosticSeverity");
+
+<*
+ 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.
+*>
+extern fn CXSourceLocation getDiagnosticLocation(
+ CXDiagnostic)
+@cname("clang_getDiagnosticLocation");
+
+<*
+ Retrieve the text of the given diagnostic.
+*>
+extern fn CXString getDiagnosticSpelling(
+ CXDiagnostic)
+@cname("clang_getDiagnosticSpelling");
+
+<*
+ 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".
+*>
+extern fn CXString getDiagnosticOption(
+ CXDiagnostic diag,
+ CXString* disable)
+@cname("clang_getDiagnosticOption");
+
+<*
+ 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.
+*>
+extern fn CUInt getDiagnosticCategory(
+ CXDiagnostic)
+@cname("clang_getDiagnosticCategory");
+
+<*
+ 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.
+*>
+extern fn CXString getDiagnosticCategoryName(
+ CUInt category)
+@cname("clang_getDiagnosticCategoryName");
+
+<*
+ Retrieve the diagnostic category text for a given diagnostic.
+ \returns The text of the given diagnostic category.
+*>
+extern fn CXString getDiagnosticCategoryText(
+ CXDiagnostic)
+@cname("clang_getDiagnosticCategoryText");
+
+<*
+ Determine the number of source ranges associated with the given
+ diagnostic.
+*>
+extern fn CUInt getDiagnosticNumRanges(
+ CXDiagnostic)
+@cname("clang_getDiagnosticNumRanges");
+
+<*
+ 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.
+*>
+extern fn CXSourceRange getDiagnosticRange(
+ CXDiagnostic diagnostic,
+ CUInt range)
+@cname("clang_getDiagnosticRange");
+
+<*
+ Determine the number of fix-it hints associated with the
+ given diagnostic.
+*>
+extern fn CUInt getDiagnosticNumFixIts(
+ CXDiagnostic diagnostic)
+@cname("clang_getDiagnosticNumFixIts");
+
+<*
+ 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.
+*>
+extern fn CXString getDiagnosticFixIt(
+ CXDiagnostic diagnostic,
+ CUInt fix_it,
+ CXSourceRange* replacement_range)
+@cname("clang_getDiagnosticFixIt");
+
+alias CXIndex = void*;
+
+alias CXTargetInfo = void*;
+
+alias CXTranslationUnit = void*;
+
+alias CXClientData = void*;
+
+<*
+ Provides the contents of a file that has not yet been saved to disk.
+ Each CXUnsavedFile instance provides the name of a file on the
+ system along with the current contents of that file that have not
+ yet been saved to disk.
+*>
struct CXUnsavedFile {
- /*
- * The file whose contents have not yet been saved.
- *
- * This file must already exist in the file system.
- */
ZString filename;
-
- /*
- * A buffer containing the unsaved contents of this file.
- */
ZString contents;
+ CULong length;
+}
- /*
- * The length of the unsaved contents of this buffer.
- */
- ulong length;
+<*
+ Describes the availability of a particular entity, which indicates
+ whether the use of this entity will result in a warning or error due to
+ it being deprecated or unavailable.
+*>
+constdef CXAvailabilityKind : CInt {
+
+ <*
+ The entity is available.
+ *>
+ AVAILABILITY_AVAILABLE = 0,
+
+ <*
+ The entity is available, but has been deprecated (and its use is
+ not recommended).
+ *>
+ AVAILABILITY_DEPRECATED = 1,
+
+ <*
+ The entity is not available; any use of it will be an error.
+ *>
+ AVAILABILITY_NOT_AVAILABLE = 2,
+
+ <*
+ The entity is available, but not accessible; any use of it will be
+ an error.
+ *>
+ AVAILABILITY_NOT_ACCESSIBLE = 3
}
-/**
- * Describes the availability of a particular entity, which indicates
- * whether the use of this entity will result in a warning or error due to
- * it being deprecated or unavailable.
- */
-typedef CXAvailabilityKind = inline CInt;
-
-/**
- * The entity is available.
- */
-const CXAvailabilityKind AVAILABILITY_AVAILABLE = 0;
-/*
- * The entity is available, but has been deprecated (and its use is
- * not recommended).
- */
-const CXAvailabilityKind AVAILABILITY_DEPRECATED = 1;
-/*
- * The entity is not available; any use of it will be an error.
- */
-const CXAvailabilityKind AVAILABILITY_NOT_AVAILABLE = 2;
-/*
- * The entity is available, but not accessible; any use of it will be
- * an error.
- */
-const CXAvailabilityKind AVAILABILITY_NOT_ACCESSIBLE = 3;
-
-/**
- * Describes a version number of the form major.minor.subminor.
- */
+<*
+ Describes a version number of the form major.minor.subminor.
+*>
struct CXVersion {
- /*
- * The major version number, e.g., the '10' in '10.7.3'. A negative
- * value indicates that there is no version number at all.
- */
CInt major;
-
- /*
- * The minor version number, e.g., the '7' in '10.7.3'. This value
- * will be negative if no minor version number was provided, e.g., for
- * version '10'.
- */
CInt minor;
-
- /*
- * The subminor version number, e.g., the '3' in '10.7.3'. This value
- * will be negative if no minor or subminor version number was provided,
- * e.g., in version '10' or '10.7'.
- */
CInt subminor;
}
-/**
- * Describes the exception specification of a cursor.
- *
- * A negative value indicates that the cursor is not a function declaration.
- */
-typedef CXCursor_ExceptionSpecificationKind = inline CInt;
-
-/**
- * The cursor has no exception specification.
- */
-const CXCursor_ExceptionSpecificationKind CURSOR_EXCEPTION_SPECIFICATION_KIND_NONE = 0;
-/**
- * The cursor has exception specification throw()
- */
-const CXCursor_ExceptionSpecificationKind CURSOR_EXCEPTION_SPECIFICATION_KIND_DYNAMIC_NONE = 1;
-/**
- * The cursor has exception specification throw(T1, T2)
- */
-const CXCursor_ExceptionSpecificationKind CURSOR_EXCEPTION_SPECIFICATION_KIND_DYNAMIC = 2;
-/**
- * The cursor has exception specification throw(...).
- */
-const CXCursor_ExceptionSpecificationKind CURSOR_EXCEPTION_SPECIFICATION_KIND_MS_ANY = 3;
-/**
- * The cursor has exception specification basic noexcept.
- */
-const CXCursor_ExceptionSpecificationKind CURSOR_EXCEPTION_SPECIFICATION_KIND_BASIC_NOEXCEPT = 4;
-/**
- * The cursor has exception specification computed noexcept.
- */
-const CXCursor_ExceptionSpecificationKind CURSOR_EXCEPTION_SPECIFICATION_KIND_COMPUTED_NOEXCEPT = 5;
-/**
- * The exception specification has not yet been evaluated.
- */
-const CXCursor_ExceptionSpecificationKind CURSOR_EXCEPTION_SPECIFICATION_KIND_UNEVALUATED = 6;
-/**
- * The exception specification has not yet been instantiated.
- */
-const CXCursor_ExceptionSpecificationKind CURSOR_EXCEPTION_SPECIFICATION_KIND_UNINSTANTIATED = 7;
-/**
- * The exception specification has not been parsed yet.
- */
-const CXCursor_ExceptionSpecificationKind CURSOR_EXCEPTION_SPECIFICATION_KIND_UNPARSED = 8;
-/**
- * The cursor has a __declspec(nothrow) exception specification.
- */
-const CXCursor_ExceptionSpecificationKind CURSOR_EXCEPTION_SPECIFICATION_KIND_NO_THROW = 9;
-
-
-/**
- * Provides a shared context for creating translation units.
- *
- * It provides two options:
- *
- * - excludeDeclarationsFromPCH: When non-zero, allows enumeration of "local"
- * declarations (when loading any new translation units). A "local" declaration
- * is one that belongs in the translation unit itself and not in a precompiled
- * header that was used by the translation unit. If zero, all declarations
- * will be enumerated.
- *
- * Here is an example:
- *
- * \code
- * // excludeDeclsFromPCH = 1, displayDiagnostics=1
- * Idx = clang_createIndex(1, 1);
- *
- * // IndexTest.pch was produced with the following command:
- * // "clang -x c IndexTest.h -emit-ast -o IndexTest.pch"
- * TU = clang_createTranslationUnit(Idx, "IndexTest.pch");
- *
- * // This will load all the symbols from 'IndexTest.pch'
- * clang_visitChildren(clang_getTranslationUnitCursor(TU),
- * TranslationUnitVisitor, 0);
- * clang_disposeTranslationUnit(TU);
- *
- * // This will load all the symbols from 'IndexTest.c', excluding symbols
- * // from 'IndexTest.pch'.
- * CChar *args[] = { "-Xclang", "-include-pch=IndexTest.pch" };
- * TU = clang_createTranslationUnitFromSourceFile(Idx, "IndexTest.c", 2, args,
- * 0, 0);
- * clang_visitChildren(clang_getTranslationUnitCursor(TU),
- * TranslationUnitVisitor, 0);
- * clang_disposeTranslationUnit(TU);
- * \endcode
- *
- * This process of creating the 'pch', loading it separately, and using it (via
- * -include-pch) allows 'excludeDeclsFromPCH' to remove redundant callbacks
- * (which gives the indexer the same performance benefit as the compiler).
- */
-fn CXIndex createIndex(
- CInt excludeDeclarationsFromPCH,
- CInt displayDiagnostics)
-@extern("clang_createIndex");
-
-/**
- * Destroy the given index.
- *
- * The index must not be destroyed until all of the translation units created
- * within that index have been destroyed.
- */
-fn void disposeIndex(
- CXIndex index)
-@extern("clang_disposeIndex");
-
-typedef CXChoice = inline CInt;
-
-/*
- * Use the default value of an option that may depend on the process
- * environment.
- */
-const CXChoice CHOICE_DEFAULT = 0;
-/*
- * Enable the option.
- */
-const CXChoice CHOICE_ENABLED = 1;
-/*
- * Disable the option.
- */
-const CXChoice CHOICE_DISABLED = 2;
-
-typedef CXGlobalOptFlags = inline CInt;
-/*
- * Used to indicate that no special CXIndex options are needed.
- */
-
-const CXGlobalOptFlags GLOBAL_OPT_FLAGS_NONE = 0x0;
-
-/*
- * Used to indicate that threads that libclang creates for indexing
- * purposes should use background priority.
- *
- * Affects #clang_indexSourceFile, #clang_indexTranslationUnit,
- * #clang_parseTranslationUnit, #clang_saveTranslationUnit.
- */
-const CXGlobalOptFlags GLOBAL_OPT_FLAGS_THREAD_BACKGROUND_PRIORITY_FOR_INDEXING = 0x1;
-/*
- * Used to indicate that threads that libclang creates for editing
- * purposes should use background priority.
- *
- * Affects #clang_reparseTranslationUnit, #clang_codeCompleteAt,
- * #clang_annotateTokens
- */
-const CXGlobalOptFlags GLOBAL_OPT_FLAGS_THREAD_BACKGROUND_PRIORITY_FOR_EDITING = 0x2;
-/*
- * Used to indicate that all threads that libclang creates should use
- * background priority.
- */
-const CXGlobalOptFlags GLOBAL_OPT_FLAGS_THREAD_BACKGROUND_PRIORITY_FOR_ALL = GLOBAL_OPT_FLAGS_THREAD_BACKGROUND_PRIORITY_FOR_INDEXING | GLOBAL_OPT_FLAGS_THREAD_BACKGROUND_PRIORITY_FOR_EDITING;
-
-
-/**
- * Index initialization options.
- *
- * 0 is the default value of each member of this struct except for Size.
- * Initialize the struct in one of the following three ways to avoid adapting
- * code each time a new member is added to it:
- * \code
- * CXIndexOptions Opts;
- * memset(&Opts, 0, sizeof(Opts));
- * Opts.Size = sizeof(CXIndexOptions);
- * \endcode
- * or explicitly initialize the first data member and zero-initialize the rest:
- * \code
- * CXIndexOptions Opts = { sizeof(CXIndexOptions) };
- * \endcode
- * or to prevent the -Wmissing-field-initializers warning for the above version:
- * \code
- * CXIndexOptions Opts{};
- * Opts.Size = sizeof(CXIndexOptions);
- * \endcode
- */
-struct CXIndexOptions {
- /*
- * The size of struct CXIndexOptions used for option versioning.
- *
- * Always initialize this member to sizeof(CXIndexOptions), or assign
- * sizeof(CXIndexOptions) to it right after creating a CXIndexOptions object.
- */
- CUInt size;
+<*
+ Describes the exception specification of a cursor.
+ A negative value indicates that the cursor is not a function declaration.
+*>
+constdef CXCursor_ExceptionSpecificationKind : CInt {
+
+ <*
+ The cursor has no exception specification.
+ *>
+ CURSOR_EXCEPTION_SPECIFICATION_KIND_NONE = 0,
+
+ <*
+ The cursor has exception specification throw()
+ *>
+ CURSOR_EXCEPTION_SPECIFICATION_KIND_DYNAMIC_NONE = 1,
+
+ <*
+ The cursor has exception specification throw(T1, T2)
+ *>
+ CURSOR_EXCEPTION_SPECIFICATION_KIND_DYNAMIC = 2,
+
+ <*
+ The cursor has exception specification throw(...).
+ *>
+ CURSOR_EXCEPTION_SPECIFICATION_KIND_MS_ANY = 3,
+
+ <*
+ The cursor has exception specification basic noexcept.
+ *>
+ CURSOR_EXCEPTION_SPECIFICATION_KIND_BASIC_NOEXCEPT = 4,
+
+ <*
+ The cursor has exception specification computed noexcept.
+ *>
+ CURSOR_EXCEPTION_SPECIFICATION_KIND_COMPUTED_NOEXCEPT = 5,
+
+ <*
+ The exception specification has not yet been evaluated.
+ *>
+ CURSOR_EXCEPTION_SPECIFICATION_KIND_UNEVALUATED = 6,
+
+ <*
+ The exception specification has not yet been instantiated.
+ *>
+ CURSOR_EXCEPTION_SPECIFICATION_KIND_UNINSTANTIATED = 7,
+
+ <*
+ The exception specification has not been parsed yet.
+ *>
+ CURSOR_EXCEPTION_SPECIFICATION_KIND_UNPARSED = 8,
+
+ <*
+ The cursor has a __declspec(nothrow) exception specification.
+ *>
+ CURSOR_EXCEPTION_SPECIFICATION_KIND_NO_THROW = 9
+}
+
+<*
+ Provides a shared context for creating translation units.
+ It provides two options:
+ - excludeDeclarationsFromPCH: When non-zero, allows enumeration of "local"
+ declarations (when loading any new translation units). A "local" declaration
+ is one that belongs in the translation unit itself and not in a precompiled
+ header that was used by the translation unit. If zero, all declarations
+ will be enumerated.
+ Here is an example:
+ \code
+ // excludeDeclsFromPCH = 1, displayDiagnostics=1
+ Idx = clang_createIndex(1, 1);
+ // IndexTest.pch was produced with the following command:
+ // "clang -x c IndexTest.h -emit-ast -o IndexTest.pch"
+ TU = clang_createTranslationUnit(Idx, "IndexTest.pch");
+ // This will load all the symbols from 'IndexTest.pch'
+ clang_visitChildren(clang_getTranslationUnitCursor(TU),
+ TranslationUnitVisitor, 0);
+ clang_disposeTranslationUnit(TU);
+ // This will load all the symbols from 'IndexTest.c', excluding symbols
+ // from 'IndexTest.pch'.
+ char *args[] = { "-Xclang", "-include-pch=IndexTest.pch" };
+ TU = clang_createTranslationUnitFromSourceFile(Idx, "IndexTest.c", 2, args,
+ 0, 0);
+ clang_visitChildren(clang_getTranslationUnitCursor(TU),
+ TranslationUnitVisitor, 0);
+ clang_disposeTranslationUnit(TU);
+ \endcode
+ This process of creating the 'pch', loading it separately, and using it (via
+ -include-pch) allows 'excludeDeclsFromPCH' to remove redundant callbacks
+ (which gives the indexer the same performance benefit as the compiler).
+*>
+extern fn CXIndex createIndex(
+ CInt exclude_declarations_from_pch,
+ CInt display_diagnostics)
+@cname("clang_createIndex");
+
+<*
+ Destroy the given index.
+ The index must not be destroyed until all of the translation units created
+ within that index have been destroyed.
+*>
+extern fn void disposeIndex(
+ CXIndex index)
+@cname("clang_disposeIndex");
+
+constdef CXChoice : CInt {
- /*
- * A CXChoice enumerator that specifies the indexing priority policy.
- * \sa CXGlobalOpt_ThreadBackgroundPriorityForIndexing
- */
- CChar thread_background_priority_for_indexing;
+ <*
+ Use the default value of an option that may depend on the process
+ environment.
+ *>
+ CHOICE_DEFAULT = 0,
- /*
- * A CXChoice enumerator that specifies the editing priority policy.
- * \sa CXGlobalOpt_ThreadBackgroundPriorityForEditing
- */
- CChar thread_background_priority_for_editing;
+ <*
+ Enable the option.
+ *>
+ CHOICE_ENABLED = 1,
+
+ <*
+ Disable the option.
+ *>
+ CHOICE_DISABLED = 2
+}
+
+constdef CXGlobalOptFlags : CInt {
+
+ <*
+ Used to indicate that no special CXIndex options are needed.
+ *>
+ GLOBAL_OPT_NONE = 0,
+
+ <*
+ Used to indicate that threads that libclang creates for indexing
+ purposes should use background priority.
+ Affects #clang_indexSourceFile, #clang_indexTranslationUnit,
+ #clang_parseTranslationUnit, #clang_saveTranslationUnit.
+ *>
+ GLOBAL_OPT_THREAD_BACKGROUND_PRIORITY_FOR_INDEXING = 1,
+
+ <*
+ Used to indicate that threads that libclang creates for editing
+ purposes should use background priority.
+ Affects #clang_reparseTranslationUnit, #clang_codeCompleteAt,
+ #clang_annotateTokens
+ *>
+ GLOBAL_OPT_THREAD_BACKGROUND_PRIORITY_FOR_EDITING = 2,
+
+ <*
+ Used to indicate that all threads that libclang creates should use
+ background priority.
+ *>
+ GLOBAL_OPT_THREAD_BACKGROUND_PRIORITY_FOR_ALL = 3
+}
+<*
+ Index initialization options.
+ 0 is the default value of each member of this struct except for Size.
+ Initialize the struct in one of the following three ways to avoid adapting
+ code each time a new member is added to it:
+ \code
+ CXIndexOptions Opts;
+ memset(&Opts, 0, sizeof(Opts));
+ Opts.Size = sizeof(CXIndexOptions);
+ \endcode
+ or explicitly initialize the first data member and zero-initialize the rest:
+ \code
+ CXIndexOptions Opts = { sizeof(CXIndexOptions) };
+ \endcode
+ or to prevent the -Wmissing-field-initializers warning for the above version:
+ \code
+ CXIndexOptions Opts{};
+ Opts.Size = sizeof(CXIndexOptions);
+ \endcode
+*>
+struct CXIndexOptions {
+ CUInt size;
+ char thread_background_priority_for_indexing;
+ char thread_background_priority_for_editing;
bitstruct : ushort {
- /*
- * \see clang_createIndex()
- */
- bool exclude_declarations_from_pch;
-
- /*
- * \see clang_createIndex()
- */
- bool display_diagnostics;
-
- /*
- * Store PCH in memory. If zero, PCH are stored in temporary files.
- */
- bool store_preambles_in_memory;
+ CUInt exclude_declarations_from_pch : 0..0;
+ CUInt display_diagnostics : 1..1;
+ CUInt store_preambles_in_memory : 2..2;
+ CUInt x : 3..15;
}
-
- /*
- * The path to a directory, in which to store temporary PCH files. If null or
- * empty, the default system temporary directory is used. These PCH files are
- * deleted on clean exit but stay on disk if the program crashes or is killed.
- *
- * This option is ignored if \a StorePreamblesInMemory is non-zero.
- *
- * Libclang does not create the directory at the specified path in the file
- * system. Therefore it must exist, or storing PCH files will fail.
- */
ZString preamble_storage_path;
-
- /*
- * Specifies a path which will contain log files for certain libclang
- * invocations. A null value implies that libclang invocations are not logged.
- */
ZString invocation_emission_path;
}
-/**
- * Provides a shared context for creating translation units.
- *
- * Call this function instead of clang_createIndex() if you need to configure
- * the additional options in CXIndexOptions.
- *
- * \returns The created index or null in case of error, such as an unsupported
- * value of options->Size.
- *
- * For example:
- * \code
- * CXIndex createIndex(ZString ApplicationTemporaryPath) {
- * const CInt ExcludeDeclarationsFromPCH = 1;
- * const CInt DisplayDiagnostics = 1;
- * CXIndex Idx;
- * #if CINDEX_VERSION_MINOR >= 64
- * CXIndexOptions Opts;
- * memset(&Opts, 0, sizeof(Opts));
- * Opts.Size = sizeof(CXIndexOptions);
- * Opts.ThreadBackgroundPriorityForIndexing = 1;
- * Opts.ExcludeDeclarationsFromPCH = ExcludeDeclarationsFromPCH;
- * Opts.DisplayDiagnostics = DisplayDiagnostics;
- * Opts.PreambleStoragePath = ApplicationTemporaryPath;
- * Idx = clang_createIndexWithOptions(&Opts);
- * if (Idx)
- * return Idx;
- * fprintf(stderr,
- * "clang_createIndexWithOptions() failed. "
- * "CINDEX_VERSION_MINOR = %d, sizeof(CXIndexOptions) = %u\n",
- * CINDEX_VERSION_MINOR, Opts.Size);
- * #else
- * (void)ApplicationTemporaryPath;
- * #endif
- * Idx = clang_createIndex(ExcludeDeclarationsFromPCH, DisplayDiagnostics);
- * clang_CXIndex_setGlobalOptions(
- * Idx, clang_CXIndex_getGlobalOptions(Idx) |
- * CXGlobalOpt_ThreadBackgroundPriorityForIndexing);
- * return Idx;
- * }
- * \endcode
- *
- * \sa clang_createIndex()
- */
-fn CXIndex createIndexWithOptions(
- CXIndexOptions *options)
-@extern("clang_createIndexWithOptions");
-
-/**
- * Sets general options associated with a CXIndex.
- *
- * This function is DEPRECATED. Set
- * CXIndexOptions::ThreadBackgroundPriorityForIndexing and/or
- * CXIndexOptions::ThreadBackgroundPriorityForEditing and call
- * clang_createIndexWithOptions() instead.
- *
- * For example:
- * \code
- * CXIndex idx = ...;
- * clang_CXIndex_setGlobalOptions(idx,
- * clang_CXIndex_getGlobalOptions(idx) |
- * CXGlobalOpt_ThreadBackgroundPriorityForIndexing);
- * \endcode
- *
- * \param options A bitmask of options, a bitwise OR of CXGlobalOpt_XXX flags.
- */
-fn void setGlobalOptions_Index(
- CXIndex index,
- CUInt options)
-@extern("clang_CXIndex_setGlobalOptions")
-@deprecated("Set CXIndexOptions::ThreadBackgroundPriorityForIndexing and/or CXIndexOptions::ThreadBackgroundPriorityForEditing and call clang_createIndexWithOptions() instead.");
-
-/**
- * Gets the general options associated with a CXIndex.
- *
- * This function allows to obtain the final option values used by libclang after
- * specifying the option policies via CXChoice enumerators.
- *
- * \returns A bitmask of options, a bitwise OR of CXGlobalOpt_XXX flags that
- * are associated with the given CXIndex object.
- */
-fn CUInt getGlobalOptions_Index(
- CXIndex index)
-@extern("clang_CXIndex_getGlobalOptions");
-
-/**
- * Sets the invocation emission path option in a CXIndex.
- *
- * This function is DEPRECATED. Set CXIndexOptions::InvocationEmissionPath and
- * call clang_createIndexWithOptions() instead.
- *
- * The invocation emission path specifies a path which will contain log
- * files for certain libclang invocations. A null value (default) implies that
- * libclang invocations are not logged..
- */
-fn void setInvocationEmissionPathOption_Index(
- CXIndex self,
- ZString path)
-@extern("clang_CXIndex_setInvocationEmissionPathOption")
-@deprecated("Set CXIndexOptions::InvocationEmissionPath and call clang_createIndexWithOptions() instead.");
-
-/**
- * Determine whether the given header is guarded against
- * multiple inclusions, either with the conventional
- * \#ifndef/\#define/\#endif macro guards or with \#pragma once.
- */
-fn CUInt isFileMultipleIncludeGuarded(
- CXTranslationUnit tu,
- CXFile file)
-@extern("clang_isFileMultipleIncludeGuarded");
-
-/**
- * Retrieve a file handle within the given translation unit.
- *
- * \param tu the translation unit
- *
- * \param file_name the name of the file.
- *
- * \returns the file handle for the named file in the translation unit \p tu,
- * or a NULL file handle if the file was not a part of this translation unit.
- */
-fn CXFile getFile(
- CXTranslationUnit tu,
- ZString file_name)
-@extern("clang_getFile");
-
-/**
- * Retrieve the buffer associated with the given file.
- *
- * \param tu the translation unit
- *
- * \param file the file for which to retrieve the buffer.
- *
- * \param size [out] if non-NULL, will be set to the size of the buffer.
- *
- * \returns a pointer to the buffer in memory that holds the contents of
- * \p file, or a NULL pointer when the file is not loaded.
- */
-fn ZString getFileContents(
- CXTranslationUnit tu,
- CXFile file,
- usz *size)
-@extern("clang_getFileContents");
-
-/**
- * Retrieves the source location associated with a given file/line/column
- * in a particular translation unit.
- */
-fn CXSourceLocation getLocation(
- CXTranslationUnit tu,
- CXFile file,
- CUInt line,
- CUInt column)
-@extern("clang_getLocation");
-
-/**
- * Retrieves the source location associated with a given character offset
- * in a particular translation unit.
- */
-fn CXSourceLocation getLocationForOffset(
- CXTranslationUnit tu,
- CXFile file,
- CUInt offset)
-@extern("clang_getLocationForOffset");
-
-/**
- * Retrieve all ranges that were skipped by the preprocessor.
- *
- * The preprocessor will skip lines when they are surrounded by an
- * if/ifdef/ifndef directive whose condition does not evaluate to true.
- */
-fn CXSourceRangeList* getSkippedRanges(
- CXTranslationUnit tu,
- CXFile file)
-@extern("clang_getSkippedRanges");
-
-/**
- * Retrieve all ranges from all files that were skipped by the
- * preprocessor.
- *
- * The preprocessor will skip lines when they are surrounded by an
- * if/ifdef/ifndef directive whose condition does not evaluate to true.
- */
-fn CXSourceRangeList* getAllSkippedRanges(
- CXTranslationUnit tu)
-@extern("clang_getAllSkippedRanges");
-
-/**
- * Determine the number of diagnostics produced for the given
- * translation unit.
- */
-fn CUInt getNumDiagnostics(
- CXTranslationUnit unit)
-@extern("clang_getNumDiagnostics");
-
-/**
- * Retrieve a diagnostic associated with the given translation unit.
- *
- * \param Unit the translation unit 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().
- */
-fn CXDiagnostic getDiagnostic(
- CXTranslationUnit unit,
- CUInt index)
-@extern("clang_getDiagnostic");
-
-/**
- * Retrieve the complete set of diagnostics associated with a
- * translation unit.
- *
- * \param Unit the translation unit to query.
- */
-fn CXDiagnosticSet getDiagnosticSetFromTU(
- CXTranslationUnit unit)
-@extern("clang_getDiagnosticSetFromTU");
-
-/**
- * Get the original translation unit source file name.
- */
-fn CXString getTranslationUnitSpelling(
- CXTranslationUnit ct_unit)
-@extern("clang_getTranslationUnitSpelling");
-
-/**
- * Return the CXTranslationUnit for a given source file and the provided
- * command line arguments one would pass to the compiler.
- *
- * Note: The 'source_filename' argument is optional. If the caller provides a
- * NULL pointer, the name of the source file is expected to reside in the
- * specified command line arguments.
- *
- * Note: When encountered in 'clang_command_line_args', the following options
- * are ignored:
- *
- * '-c'
- * '-emit-ast'
- * '-fsyntax-only'
- * '-o \