LibClang API Reference

Clang.jl supports dumping original C documentation in comments, below is the documentation generated from libclang's comments.

Clang.LibClang.clang_CXIndex_setGlobalOptionsMethod
clang_CXIndex_setGlobalOptions(arg1, options)

Sets general options associated with a CXIndex.

For example:

 CXIndex idx = ...;
 clang_CXIndex_setGlobalOptions(idx,
     clang_CXIndex_getGlobalOptions(idx) |
     CXGlobalOpt_ThreadBackgroundPriorityForIndexing);

Parameters

  • options: A bitmask of options, a bitwise OR of CXGlobalOpt_XXX flags.
Clang.LibClang.clang_CXIndex_setInvocationEmissionPathOptionMethod
clang_CXIndex_setInvocationEmissionPathOption(arg1, Path)

Sets the invocation emission path option in a CXIndex.

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..

Clang.LibClang.clang_CXXMethod_isVirtualMethod
clang_CXXMethod_isVirtual(C)

Determine if a C++ member function or member function template is explicitly declared 'virtual' or if it overrides a virtual method from one of the base classes.

Clang.LibClang.clang_Comment_getChildMethod
clang_Comment_getChild(Comment, ChildIdx)

Parameters

  • Comment: AST node of any kind.
  • ChildIdx: child index (zero-based).

Returns

the specified child of the AST node.

Clang.LibClang.clang_Comment_isWhitespaceMethod
clang_Comment_isWhitespace(Comment)

A CXComment_Paragraph node is considered whitespace if it contains only CXComment_Text nodes that are empty or whitespace.

Other AST nodes (except CXComment_Paragraph and CXComment_Text) are never considered whitespace.

Returns

non-zero if Comment is whitespace.

Clang.LibClang.clang_Cursor_EvaluateMethod
clang_Cursor_Evaluate(C)

If cursor is a statement declaration tries to evaluate the statement and if its variable, tries to evaluate its initializer, into its corresponding type. If it's an expression, tries to evaluate the expression.

Clang.LibClang.clang_Cursor_getArgumentMethod
clang_Cursor_getArgument(C, i)

Retrieve the argument cursor of a function or method.

The argument cursor can be determined for calls as well as for declarations of functions or methods. For other cursors and for invalid indices, an invalid cursor is returned.

Clang.LibClang.clang_Cursor_getCommentRangeMethod
clang_Cursor_getCommentRange(C)

Given a cursor that represents a declaration, return the associated comment's source range. The range may include multiple consecutive comments with whitespace in between.

Clang.LibClang.clang_Cursor_getNumArgumentsMethod
clang_Cursor_getNumArguments(C)

Retrieve the number of non-variadic arguments associated with a given cursor.

The number of arguments can be determined for calls as well as for declarations of functions or methods. For other cursors -1 is returned.

Clang.LibClang.clang_Cursor_getNumTemplateArgumentsMethod
clang_Cursor_getNumTemplateArguments(C)

Returns the number of template args of a function decl representing a template specialization.

If the argument cursor cannot be converted into a template function declaration, -1 is returned.

For example, for the following declaration and specialization: template <typename T, int kInt, bool kBool> void foo() { ... }

template <> void foo<float, -7, true>();

The value 3 would be returned from this call.

Clang.LibClang.clang_Cursor_getObjCSelectorIndexMethod
clang_Cursor_getObjCSelectorIndex(arg1)

If the cursor points to a selector identifier in an Objective-C method or message expression, this returns the selector index.

After getting a cursor with #clang_getCursor, this can be called to determine if the location points to a selector identifier.

Returns

The selector index if the cursor is an Objective-C method or message expression and the cursor is pointing to a selector identifier, or -1 otherwise.

Clang.LibClang.clang_Cursor_getOffsetOfFieldMethod
clang_Cursor_getOffsetOfField(C)

Return the offset of the field represented by the Cursor.

If the cursor is not a field declaration, -1 is returned. If the cursor semantic parent is not a record field declaration, CXTypeLayoutError_Invalid is returned. If the field's type declaration is an incomplete type, CXTypeLayoutError_Incomplete is returned. If the field's type declaration is a dependent type, CXTypeLayoutError_Dependent is returned. If the field's name S is not found, CXTypeLayoutError_InvalidFieldName is returned.

Clang.LibClang.clang_Cursor_getParsedCommentMethod
clang_Cursor_getParsedComment(C)

Given a cursor that represents a documentable entity (e.g., declaration), return the associated parsed comment as a CXComment_FullComment AST node.

Clang.LibClang.clang_Cursor_getSpellingNameRangeMethod
clang_Cursor_getSpellingNameRange(arg1, pieceIndex, options)

Retrieve a range for a piece that forms the cursors spelling name. Most of the times there is only one range for the complete spelling but for Objective-C methods and Objective-C message expressions, there are multiple pieces for each selector identifier.

Parameters

  • pieceIndex: the index of the spelling name piece. If this is greater than the actual number of pieces, it will return a NULL (invalid) range.
  • options: Reserved.
Clang.LibClang.clang_Cursor_getStorageClassMethod
clang_Cursor_getStorageClass(arg1)

Returns the storage class for a function or variable declaration.

If the passed in Cursor is not a function or variable declaration, CX_SC_Invalid is returned else the storage class.

Clang.LibClang.clang_Cursor_getTemplateArgumentKindMethod
clang_Cursor_getTemplateArgumentKind(C, I)

Retrieve the kind of the I'th template argument of the CXCursor C.

If the argument CXCursor does not represent a FunctionDecl, an invalid template argument kind is returned.

For example, for the following declaration and specialization: template <typename T, int kInt, bool kBool> void foo() { ... }

template <> void foo<float, -7, true>();

For I = 0, 1, and 2, Type, Integral, and Integral will be returned, respectively.

Clang.LibClang.clang_Cursor_getTemplateArgumentTypeMethod
clang_Cursor_getTemplateArgumentType(C, I)

Retrieve a CXType representing the type of a TemplateArgument of a function decl representing a template specialization.

If the argument CXCursor does not represent a FunctionDecl whose I'th template argument has a kind of CXTemplateArgKind_Integral, an invalid type is returned.

For example, for the following declaration and specialization: template <typename T, int kInt, bool kBool> void foo() { ... }

template <> void foo<float, -7, true>();

If called with I = 0, "float", will be returned. Invalid types will be returned for I == 1 or 2.

Clang.LibClang.clang_Cursor_getTemplateArgumentUnsignedValueMethod
clang_Cursor_getTemplateArgumentUnsignedValue(C, I)

Retrieve the value of an Integral TemplateArgument (of a function decl representing a template specialization) as an unsigned long long.

It is undefined to call this function on a CXCursor that does not represent a FunctionDecl or whose I'th template argument is not an integral value.

For example, for the following declaration and specialization: template <typename T, int kInt, bool kBool> void foo() { ... }

template <> void foo<float, 2147483649, true>();

If called with I = 1 or 2, 2147483649 or true will be returned, respectively. For I == 0, this function's behavior is undefined.

Clang.LibClang.clang_Cursor_getTemplateArgumentValueMethod
clang_Cursor_getTemplateArgumentValue(C, I)

Retrieve the value of an Integral TemplateArgument (of a function decl representing a template specialization) as a signed long long.

It is undefined to call this function on a CXCursor that does not represent a FunctionDecl or whose I'th template argument is not an integral value.

For example, for the following declaration and specialization: template <typename T, int kInt, bool kBool> void foo() { ... }

template <> void foo<float, -7, true>();

If called with I = 1 or 2, -7 or true will be returned, respectively. For I == 0, this function's behavior is undefined.

Clang.LibClang.clang_Cursor_hasVarDeclExternalStorageMethod
clang_Cursor_hasVarDeclExternalStorage(cursor)

If cursor refers to a variable declaration that has external storage returns 1. If cursor refers to a variable declaration that doesn't have external storage returns 0. Otherwise returns -1.

Clang.LibClang.clang_Cursor_hasVarDeclGlobalStorageMethod
clang_Cursor_hasVarDeclGlobalStorage(cursor)

If cursor refers to a variable declaration that has global storage returns 1. If cursor refers to a variable declaration that doesn't have global storage returns 0. Otherwise returns -1.

Clang.LibClang.clang_Cursor_isDynamicCallMethod
clang_Cursor_isDynamicCall(C)

Given a cursor pointing to a C++ method call or an Objective-C message, returns non-zero if the method/message is "dynamic", meaning:

For a C++ method: the call is virtual. For an Objective-C message: the receiver is an object instance, not 'super' or a specific class.

If the method/message is "static" or the cursor does not point to a method/message, it will return zero.

Clang.LibClang.clang_Cursor_isExternalSymbolMethod
clang_Cursor_isExternalSymbol(C, language, definedIn, isGenerated)

Returns non-zero if the given cursor points to a symbol marked with external_source_symbol attribute.

Parameters

  • language: If non-NULL, and the attribute is present, will be set to the 'language' string from the attribute.
  • definedIn: If non-NULL, and the attribute is present, will be set to the 'definedIn' string from the attribute.
  • isGenerated: If non-NULL, and the attribute is present, will be set to non-zero if the 'generated_declaration' is set in the attribute.
Clang.LibClang.clang_Cursor_isObjCOptionalMethod
clang_Cursor_isObjCOptional(C)

Given a cursor that represents an Objective-C method or property declaration, return non-zero if the declaration was affected by "\@optional". Returns zero if the cursor is not such a declaration or it is "\@required".

Clang.LibClang.clang_FullComment_getAsHTMLMethod
clang_FullComment_getAsHTML(Comment)

Convert a given full parsed comment to an HTML fragment.

Specific details of HTML layout are subject to change. Don't try to parse this HTML back into an AST, use other APIs instead.

Currently the following CSS classes are used:

  • "para-brief" for

and equivalent commands;

  • "para-returns" for \returns paragraph and equivalent commands;

  • "word-returns" for the "Returns" word in \returns paragraph.

Function argument documentation is rendered as a <dl> list with arguments sorted in function prototype order. CSS classes used:

  • "param-name-index-NUMBER" for parameter name (<dt>);

  • "param-descr-index-NUMBER" for parameter description (<dd>);

  • "param-name-index-invalid" and "param-descr-index-invalid" are used if parameter index is invalid.

Template parameter documentation is rendered as a <dl> list with parameters sorted in template parameter list order. CSS classes used:

  • "tparam-name-index-NUMBER" for parameter name (<dt>);

  • "tparam-descr-index-NUMBER" for parameter description (<dd>);

  • "tparam-name-index-other" and "tparam-descr-index-other" are used for names inside template template parameters;

  • "tparam-name-index-invalid" and "tparam-descr-index-invalid" are used if parameter position is invalid.

Parameters

  • Comment: a CXComment_FullComment AST node.

Returns

string containing an HTML fragment.

Clang.LibClang.clang_FullComment_getAsXMLMethod
clang_FullComment_getAsXML(Comment)

Convert a given full parsed comment to an XML document.

A Relax NG schema for the XML can be found in comment-xml-schema.rng file inside clang source tree.

Parameters

  • Comment: a CXComment_FullComment AST node.

Returns

string containing an XML document.

Clang.LibClang.clang_HTMLStartTag_getAttrNameMethod
clang_HTMLStartTag_getAttrName(Comment, AttrIdx)

Parameters

  • Comment: a CXComment_HTMLStartTag AST node.
  • AttrIdx: attribute index (zero-based).

Returns

name of the specified attribute.

Clang.LibClang.clang_HTMLStartTag_getAttrValueMethod
clang_HTMLStartTag_getAttrValue(Comment, AttrIdx)

Parameters

  • Comment: a CXComment_HTMLStartTag AST node.
  • AttrIdx: attribute index (zero-based).

Returns

value of the specified attribute.

Clang.LibClang.clang_HTMLTagComment_getAsStringMethod
clang_HTMLTagComment_getAsString(Comment)

Convert an HTML tag AST node to string.

Parameters

  • Comment: a CXComment_HTMLStartTag or CXComment_HTMLEndTag AST node.

Returns

string containing an HTML tag.

Clang.LibClang.clang_IndexAction_createMethod
clang_IndexAction_create(CIdx)

An indexing action/session, to be applied to one or multiple translation units.

Parameters

  • CIdx: The index object with which the index action will be associated.
Clang.LibClang.clang_IndexAction_disposeMethod
clang_IndexAction_dispose(arg1)

Destroy the given index action.

The index action must not be destroyed until all of the translation units created within that index action have been destroyed.

Clang.LibClang.clang_ModuleMapDescriptor_writeToBufferMethod
clang_ModuleMapDescriptor_writeToBuffer(arg1, options, out_buffer_ptr, out_buffer_size)

Write out the CXModuleMapDescriptor object to a char buffer.

Parameters

  • options: is reserved, always pass 0.
  • out_buffer_ptr: pointer to receive the buffer pointer, which should be disposed using clang_free().
  • out_buffer_size: pointer to receive the buffer size.

Returns

0 for success, non-zero to indicate an error.

Clang.LibClang.clang_Module_getNameMethod
clang_Module_getName(Module)

Parameters

  • Module: a module object.

Returns

the name of the module, e.g. for the 'std.vector' sub-module it will return "vector".

Clang.LibClang.clang_Module_getParentMethod
clang_Module_getParent(Module)

Parameters

  • Module: a module object.

Returns

the parent of a sub-module or NULL if the given module is top-level, e.g. for 'std.vector' it will return the 'std' module.

Clang.LibClang.clang_Module_getTopLevelHeaderMethod
clang_Module_getTopLevelHeader(arg1, Module, Index)

Parameters

  • Module: a module object.
  • Index: top level header index (zero-based).

Returns

the specified top level header associated with the module.

Clang.LibClang.clang_TParamCommandComment_getDepthMethod
clang_TParamCommandComment_getDepth(Comment)

For example,

     template<typename C, template<typename T> class TT>
     void test(TT<int> aaa);

for C and TT nesting depth is 0, for T nesting depth is 1.

Parameters

  • Comment: a CXComment_TParamCommand AST node.

Returns

zero-based nesting depth of this parameter in the template parameter list.

Clang.LibClang.clang_TParamCommandComment_getIndexMethod
clang_TParamCommandComment_getIndex(Comment, Depth)

For example,

     template<typename C, template<typename T> class TT>
     void test(TT<int> aaa);

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.

Parameters

  • Comment: a CXComment_TParamCommand AST node.

Returns

zero-based parameter index in the template parameter list at a given nesting depth.

Clang.LibClang.clang_Type_getAlignOfMethod
clang_Type_getAlignOf(T)

Return the alignment of a type in bytes as per C++[expr.alignof] standard.

If the type declaration is invalid, CXTypeLayoutError_Invalid is returned. If the type declaration is an incomplete type, CXTypeLayoutError_Incomplete is returned. If the type declaration is a dependent type, CXTypeLayoutError_Dependent is returned. If the type declaration is not a constant size type, CXTypeLayoutError_NotConstantSize is returned.

Clang.LibClang.clang_Type_getCXXRefQualifierMethod
clang_Type_getCXXRefQualifier(T)

Retrieve the ref-qualifier kind of a function or method.

The ref-qualifier is returned for C++ functions or methods. For other types or non-C++ declarations, CXRefQualifier_None is returned.

Clang.LibClang.clang_Type_getClassTypeMethod
clang_Type_getClassType(T)

Return the class type of an member pointer type.

If a non-member-pointer type is passed in, an invalid type is returned.

Clang.LibClang.clang_Type_getModifiedTypeMethod
clang_Type_getModifiedType(T)

Return the type that was modified by this attributed type.

If the type is not an attributed type, an invalid type is returned.

Clang.LibClang.clang_Type_getObjCProtocolDeclMethod
clang_Type_getObjCProtocolDecl(T, i)

Retrieve the decl for a protocol reference for an ObjC object/id.

If the type is not an ObjC object or there are not enough protocol references, an invalid cursor is returned.

Clang.LibClang.clang_Type_getObjCTypeArgMethod
clang_Type_getObjCTypeArg(T, i)

Retrieve a type argument associated with an ObjC object.

If the type is not an ObjC or the index is not valid, an invalid type is returned.

Clang.LibClang.clang_Type_getOffsetOfMethod
clang_Type_getOffsetOf(T, S)

Return the offset of a field named S in a record of type T in bits as it would be returned by __offsetof__ as per C++11[18.2p4]

If the cursor is not a record field declaration, CXTypeLayoutError_Invalid is returned. If the field's type declaration is an incomplete type, CXTypeLayoutError_Incomplete is returned. If the field's type declaration is a dependent type, CXTypeLayoutError_Dependent is returned. If the field's name S is not found, CXTypeLayoutError_InvalidFieldName is returned.

Clang.LibClang.clang_Type_getSizeOfMethod
clang_Type_getSizeOf(T)

Return the size of a type in bytes as per C++[expr.sizeof] standard.

If the type declaration is invalid, CXTypeLayoutError_Invalid is returned. If the type declaration is an incomplete type, CXTypeLayoutError_Incomplete is returned. If the type declaration is a dependent type, CXTypeLayoutError_Dependent is returned.

Clang.LibClang.clang_Type_getTemplateArgumentAsTypeMethod
clang_Type_getTemplateArgumentAsType(T, i)

Returns the type template argument of a template class specialization at given index.

This function only returns template type arguments and does not handle template template arguments or variadic packs.

Clang.LibClang.clang_Type_isTransparentTagTypedefMethod
clang_Type_isTransparentTagTypedef(T)

Determine if a typedef is 'transparent' tag.

A typedef is considered 'transparent' if it shares a name and spelling location with its underlying tag type, as is the case with the NS_ENUM macro.

Returns

non-zero if transparent and zero otherwise.

Clang.LibClang.clang_Type_visitFieldsMethod
clang_Type_visitFields(T, visitor, client_data)

Visit the fields of a particular type.

This function visits all the direct fields of the given cursor, invoking the given visitor function with the cursors of each visited field. The traversal may be ended prematurely, if the visitor returns CXFieldVisit_Break.

Parameters

  • T: the record type whose field may be visited.
  • visitor: the visitor function that will be invoked for each field of T.
  • client_data: pointer data supplied by the client, which will be passed to the visitor each time it is invoked.

Returns

a non-zero value if the traversal was terminated prematurely by the visitor returning CXFieldVisit_Break.

Clang.LibClang.clang_VirtualFileOverlay_addFileMappingMethod
clang_VirtualFileOverlay_addFileMapping(arg1, virtualPath, realPath)

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.

Clang.LibClang.clang_VirtualFileOverlay_writeToBufferMethod
clang_VirtualFileOverlay_writeToBuffer(arg1, options, out_buffer_ptr, out_buffer_size)

Write out the CXVirtualFileOverlay object to a char buffer.

Parameters

  • options: is reserved, always pass 0.
  • out_buffer_ptr: pointer to receive the buffer pointer, which should be disposed using clang_free().
  • out_buffer_size: pointer to receive the buffer size.

Returns

0 for success, non-zero to indicate an error.

Clang.LibClang.clang_annotateTokensMethod
clang_annotateTokens(TU, Tokens, NumTokens, Cursors)

Annotate the given set of tokens by providing cursors for each token that can be mapped to a specific entity within the abstract syntax tree.

This token-annotation routine is equivalent to invoking clang_getCursor() for the source locations of each of the tokens. The cursors provided are filtered, so that only those cursors that have a direct correspondence to the token are accepted. For example, given a function call f(x), clang_getCursor() would provide the following cursors:

  • when the cursor is over the 'f', a DeclRefExpr cursor referring to 'f'. * when the cursor is over the '(' or the ')', a CallExpr referring to 'f'. * when the cursor is over the 'x', a DeclRefExpr cursor referring to 'x'.

Only the first and last of these cursors will occur within the annotate, since the tokens "f" and "x' directly refer to a function and a variable, respectively, but the parentheses are just a small part of the full syntax of the function call expression, which is not provided as an annotation.

Parameters

  • TU: the translation unit that owns the given tokens.
  • Tokens: the set of tokens to annotate.
  • NumTokens: the number of tokens in Tokens.
  • Cursors: an array of NumTokens cursors, whose contents will be replaced with the cursors corresponding to each token.
Clang.LibClang.clang_codeCompleteAtMethod
clang_codeCompleteAt(TU, complete_filename, complete_line, complete_column, unsaved_files, num_unsaved_files, options)

Perform code completion at a given location in a translation unit.

This function performs code completion at a particular file, line, and column within source code, providing results that suggest potential code snippets based on the context of the completion. The basic model for code completion is that Clang will parse a complete source file, performing syntax checking up to the location where code-completion has been requested. At that point, a special code-completion token is passed to the parser, which recognizes this token and determines, based on the current location in the C/Objective-C/C++ grammar and the state of semantic analysis, what completions to provide. These completions are returned via a new CXCodeCompleteResults structure.

Code completion itself is meant to be triggered by the client when the user types punctuation characters or whitespace, at which point the code-completion location will coincide with the cursor. For example, if p is a pointer, code-completion might be triggered after the "-" and then after the ">" in p->. When the code-completion location is after the ">", the completion results will provide, e.g., the members of the struct that "p" points to. The client is responsible for placing the cursor at the beginning of the token currently being typed, then filtering the results based on the contents of the token. For example, when code-completing for the expression p->get, the client should provide the location just after the ">" (e.g., pointing at the "g") to this code-completion hook. Then, the client can filter the results based on the current token text ("get"), only showing those results that start with "get". The intent of this interface is to separate the relatively high-latency acquisition of code-completion results from the filtering of results on a per-character basis, which must have a lower latency.

Parameters

  • TU: The translation unit in which code-completion should occur. The source files for this translation unit need not be completely up-to-date (and the contents of those source files may be overridden via unsaved_files). Cursors referring into the translation unit may be invalidated by this invocation.
  • complete_filename: The name of the source file where code completion should be performed. This filename may be any file included in the translation unit.
  • complete_line: The line at which code-completion should occur.
  • complete_column: The column at which code-completion should occur. Note that the column should point just after the syntactic construct that initiated code completion, and not in the middle of a lexical token.
  • unsaved_files: the Files that have not yet been saved to disk but may be required for parsing or code completion, including the contents of those files. The contents and name of these files (as specified by CXUnsavedFile) are copied when necessary, so the client only needs to guarantee their validity until the call to this function returns.
  • num_unsaved_files: The number of unsaved file entries in unsaved_files.
  • options: Extra options that control the behavior of code completion, expressed as a bitwise OR of the enumerators of the CXCodeComplete_Flags enumeration. The clang_defaultCodeCompleteOptions() function returns a default set of code-completion options.

Returns

If successful, a new CXCodeCompleteResults structure containing code-completion results, which should eventually be freed with clang_disposeCodeCompleteResults(). If code completion fails, returns NULL.

Clang.LibClang.clang_codeCompleteGetContainerKindMethod
clang_codeCompleteGetContainerKind(Results, IsIncomplete)

Returns the cursor kind for the container for the current code completion context. The container is only guaranteed to be set for contexts where a container exists (i.e. member accesses or Objective-C message sends); if there is not a container, this function will return CXCursor_InvalidCode.

Parameters

  • Results: the code completion results to query
  • IsIncomplete: on return, this value will be false if Clang has complete information about the container. If Clang does not have complete information, this value will be true.

Returns

the container kind, or CXCursor_InvalidCode if there is not a container

Clang.LibClang.clang_codeCompleteGetContainerUSRMethod
clang_codeCompleteGetContainerUSR(Results)

Returns the USR for the container for the current code completion context. If there is not a container for the current context, this function will return the empty string.

Parameters

  • Results: the code completion results to query

Returns

the USR for the container

Clang.LibClang.clang_codeCompleteGetContextsMethod
clang_codeCompleteGetContexts(Results)

Determines what completions are appropriate for the context the given code completion.

Parameters

  • Results: the code completion results to query

Returns

the kinds of completions that are appropriate for use along with the given code completion results.

Clang.LibClang.clang_codeCompleteGetDiagnosticMethod
clang_codeCompleteGetDiagnostic(Results, Index)

Retrieve a diagnostic associated with the given code completion.

Parameters

  • Results: the code completion results to query.
  • Index: the zero-based diagnostic number to retrieve.

Returns

the requested diagnostic. This diagnostic must be freed via a call to clang_disposeDiagnostic().

Clang.LibClang.clang_codeCompleteGetObjCSelectorMethod
clang_codeCompleteGetObjCSelector(Results)

Returns the currently-entered selector for an Objective-C message send, formatted like "initWithFoo:bar:". Only guaranteed to return a non-empty string for CXCompletionContext_ObjCInstanceMessage and CXCompletionContext_ObjCClassMessage.

Parameters

  • Results: the code completion results to query

Returns

the selector (or partial selector) that has been entered thus far for an Objective-C message send.

Clang.LibClang.clang_createIndexMethod
clang_createIndex(excludeDeclarationsFromPCH, displayDiagnostics)

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:

   // 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);

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).

Clang.LibClang.clang_createTranslationUnit2Method
clang_createTranslationUnit2(CIdx, ast_filename, out_TU)

Create a translation unit from an AST file (-emit-ast).

Parameters

Returns

Zero on success, otherwise returns an error code.

Clang.LibClang.clang_createTranslationUnitFromSourceFileMethod
clang_createTranslationUnitFromSourceFile(CIdx, source_filename, num_clang_command_line_args, clang_command_line_args, num_unsaved_files, unsaved_files)

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 <output file>' (both '-o' and '<output file>' are ignored)

Parameters

  • CIdx: The index object with which the translation unit will be associated.
  • source_filename: The name of the source file to load, or NULL if the source file is included in clang_command_line_args.
  • num_clang_command_line_args: The number of command-line arguments in clang_command_line_args.
  • clang_command_line_args: The command-line arguments that would be passed to the clang executable if it were being invoked out-of-process. These command-line options will be parsed and will affect how the translation unit is parsed. Note that the following options are ignored: '-c', '-emit-ast', '-fsyntax-only' (which is the default), and '-o <output file>'.
  • num_unsaved_files: the number of unsaved file entries in unsaved_files.
  • unsaved_files: the files that have not yet been saved to disk but may be required for code completion, including the contents of those files. The contents and name of these files (as specified by CXUnsavedFile) are copied when necessary, so the client only needs to guarantee their validity until the call to this function returns.
Clang.LibClang.clang_defaultEditingTranslationUnitOptionsMethod
clang_defaultEditingTranslationUnitOptions()

Returns the set of flags that is suitable for parsing a translation unit that is being edited.

The set of flags returned provide options for clang_parseTranslationUnit() to indicate that the translation unit is likely to be reparsed many times, either explicitly (via clang_reparseTranslationUnit()) or implicitly (e.g., by code completion (clang_codeCompletionAt())). The returned flag set contains an unspecified set of optimizations (e.g., the precompiled preamble) geared toward improving the performance of these routines. The set of optimizations enabled may change from one version to the next.

Clang.LibClang.clang_defaultReparseOptionsMethod
clang_defaultReparseOptions(TU)

Returns the set of flags that is suitable for reparsing a translation unit.

The set of flags returned provide options for clang_reparseTranslationUnit() by default. The returned flag set contains an unspecified set of optimizations geared toward common uses of reparsing. The set of optimizations enabled may change from one version to the next.

Clang.LibClang.clang_defaultSaveOptionsMethod
clang_defaultSaveOptions(TU)

Returns the set of flags that is suitable for saving a translation unit.

The set of flags returned provide options for clang_saveTranslationUnit() by default. The returned flag set contains an unspecified set of options that save translation units with the most commonly-requested data.

Clang.LibClang.clang_disposeIndexMethod
clang_disposeIndex(index)

Destroy the given index.

The index must not be destroyed until all of the translation units created within that index have been destroyed.

Clang.LibClang.clang_equalLocationsMethod
clang_equalLocations(loc1, loc2)

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.

Clang.LibClang.clang_equalRangesMethod
clang_equalRanges(range1, range2)

Determine whether two ranges are equivalent.

Returns

non-zero if the ranges are the same, zero if they differ.

Clang.LibClang.clang_equalTypesMethod
clang_equalTypes(A, B)

Determine whether two CXTypes represent the same type.

Returns

non-zero if the CXTypes represent the same type and zero otherwise.

Clang.LibClang.clang_findIncludesInFileMethod
clang_findIncludesInFile(TU, file, visitor)

Find #import/#include directives in a specific file.

Parameters

  • TU: translation unit containing the file to query.
  • file: to search for #import/#include directives.
  • visitor: callback that will receive pairs of CXCursor/CXSourceRange for each directive found.

Returns

one of the CXResult enumerators.

Clang.LibClang.clang_findReferencesInFileMethod
clang_findReferencesInFile(cursor, file, visitor)

Find references of a declaration in a specific file.

Parameters

  • cursor: pointing to a declaration or a reference of one.
  • file: to search for references.
  • visitor: callback that will receive pairs of CXCursor/CXSourceRange for each reference found. The CXSourceRange will point inside the file; if the reference is inside a macro (and not a macro argument) the CXSourceRange will be invalid.

Returns

one of the CXResult enumerators.

Clang.LibClang.clang_formatDiagnosticMethod
clang_formatDiagnostic(Diagnostic, Options)

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 clang_defaultDiagnosticDisplayOptions() function returns the set of options that most closely mimics the behavior of the clang compiler.

Parameters

  • Diagnostic: The diagnostic to print.
  • Options: A set of options that control the diagnostic display, created by combining CXDiagnosticDisplayOptions values.

Returns

A new string containing for formatted diagnostic.

Clang.LibClang.clang_getAllSkippedRangesMethod
clang_getAllSkippedRanges(tu)

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.

Clang.LibClang.clang_getArgTypeMethod
clang_getArgType(T, i)

Retrieve the type of a parameter of a function type.

If a non-function type is passed in or the function does not have enough parameters, an invalid type is returned.

Clang.LibClang.clang_getCXXAccessSpecifierMethod
clang_getCXXAccessSpecifier(arg1)

Returns the access control level for the referenced object.

If the cursor refers to a C++ declaration, its access control level within its parent scope is returned. Otherwise, if the cursor refers to a base specifier or access specifier, the specifier itself is returned.

Clang.LibClang.clang_getCanonicalCursorMethod
clang_getCanonicalCursor(arg1)

Retrieve the canonical cursor corresponding to the given cursor.

In the C family of languages, many kinds of entities can be declared several times within a single translation unit. For example, a structure type can be forward-declared (possibly multiple times) and later defined:

 struct X;
 struct X;
 struct X {
   int member;
 };

The declarations and the definition of X are represented by three different cursors, all of which are declarations of the same underlying entity. One of these cursor is considered the "canonical" cursor, which is effectively the representative for the underlying entity. One can determine if two cursors are declarations of the same underlying entity by comparing their canonical cursors.

Returns

The canonical cursor for the entity referred to by the given cursor.

Clang.LibClang.clang_getCanonicalTypeMethod
clang_getCanonicalType(T)

Return the canonical type for a CXType.

Clang's type system explicitly models typedefs and all the ways a specific type can be represented. The canonical type is the underlying type with all the "sugar" removed. For example, if 'T' is a typedef for 'int', the canonical type for 'T' would be 'int'.

Clang.LibClang.clang_getClangVersionMethod
clang_getClangVersion()

Return a version string, suitable for showing to a user, but not intended to be parsed (the format is not guaranteed to be stable).

Clang.LibClang.clang_getCompletionAnnotationMethod
clang_getCompletionAnnotation(completion_string, annotation_number)

Retrieve the annotation associated with the given completion string.

Parameters

  • completion_string: the completion string to query.
  • annotation_number: the 0-based index of the annotation of the completion string.

Returns

annotation string associated with the completion at index annotation_number, or a NULL string if that annotation is not available.

Clang.LibClang.clang_getCompletionAvailabilityMethod
clang_getCompletionAvailability(completion_string)

Determine the availability of the entity that this code-completion string refers to.

Parameters

  • completion_string: The completion string to query.

Returns

The availability of the completion string.

Clang.LibClang.clang_getCompletionChunkCompletionStringMethod
clang_getCompletionChunkCompletionString(completion_string, chunk_number)

Retrieve the completion string associated with a particular chunk within a completion string.

Parameters

  • completion_string: the completion string to query.
  • chunk_number: the 0-based index of the chunk in the completion string.

Returns

the completion string associated with the chunk at index chunk_number.

Clang.LibClang.clang_getCompletionChunkKindMethod
clang_getCompletionChunkKind(completion_string, chunk_number)

Determine the kind of a particular chunk within a completion string.

Parameters

  • completion_string: the completion string to query.
  • chunk_number: the 0-based index of the chunk in the completion string.

Returns

the kind of the chunk at the index chunk_number.

Clang.LibClang.clang_getCompletionChunkTextMethod
clang_getCompletionChunkText(completion_string, chunk_number)

Retrieve the text associated with a particular chunk within a completion string.

Parameters

  • completion_string: the completion string to query.
  • chunk_number: the 0-based index of the chunk in the completion string.

Returns

the text associated with the chunk at index chunk_number.

Clang.LibClang.clang_getCompletionFixItMethod
clang_getCompletionFixIt(results, completion_index, fixit_index, replacement_range)

Fix-its that must be applied before inserting the text for the corresponding completion.

By default, clang_codeCompleteAt() only returns completions with empty fix-its. Extra completions with non-empty fix-its should be explicitly requested by setting CXCodeComplete_IncludeCompletionsWithFixIts.

For the clients to be able to compute position of the cursor after applying fix-its, the following conditions are guaranteed to hold for replacement_range of the stored fix-its: - Ranges in the fix-its are guaranteed to never contain the completion point (or identifier under completion point, if any) inside them, except at the start or at the end of the range. - If a fix-it range starts or ends with completion point (or starts or ends after the identifier under completion point), it will contain at least one character. It allows to unambiguously recompute completion point after applying the fix-it.

The intuition is that provided fix-its change code around the identifier we complete, but are not allowed to touch the identifier itself or the completion point. One example of completions with corrections are the ones replacing '.' with '->' and vice versa:

std::unique_ptr<std::vector<int>> vec_ptr; In 'vec_ptr.^', one of the completions is 'push_back', it requires replacing '.' with '->'. In 'vec_ptr->^', one of the completions is 'release', it requires replacing '->' with '.'.

Parameters

  • results: The structure keeping all completion results
  • completion_index: The index of the completion
  • fixit_index: The index of the fix-it for the completion at completion_index
  • replacement_range: The fix-it range that must be replaced before the completion at completion_index can be applied

Returns

The fix-it string that must replace the code at replacement_range before the completion at completion_index can be applied

Clang.LibClang.clang_getCompletionNumAnnotationsMethod
clang_getCompletionNumAnnotations(completion_string)

Retrieve the number of annotations associated with the given completion string.

Parameters

  • completion_string: the completion string to query.

Returns

the number of annotations associated with the given completion string.

Clang.LibClang.clang_getCompletionNumFixItsMethod
clang_getCompletionNumFixIts(results, completion_index)

Retrieve the number of fix-its for the given completion index.

Calling this makes sense only if CXCodeComplete_IncludeCompletionsWithFixIts option was set.

Parameters

  • results: The structure keeping all completion results
  • completion_index: The index of the completion

Returns

The number of fix-its which must be applied before the completion at completion_index can be applied

Clang.LibClang.clang_getCompletionParentMethod
clang_getCompletionParent(completion_string, kind)

Retrieve the parent context of the given completion string.

The parent context of a completion string is the semantic parent of the declaration (if any) that the code completion represents. For example, a code completion for an Objective-C method would have the method's class or protocol as its context.

Parameters

  • completion_string: The code completion string whose parent is being queried.
  • kind: DEPRECATED: always set to CXCursor_NotImplemented if non-NULL.

Returns

The name of the completion parent, e.g., "NSObject" if the completion string represents a method in the NSObject class.

Clang.LibClang.clang_getCompletionPriorityMethod
clang_getCompletionPriority(completion_string)

Determine the priority of this code completion.

The priority of a code completion indicates how likely it is that this particular completion is the completion that the user will select. The priority is selected by various internal heuristics.

Parameters

  • completion_string: The completion string to query.

Returns

The priority of this completion string. Smaller values indicate higher-priority (more likely) completions.

Clang.LibClang.clang_getCursorMethod
clang_getCursor(arg1, arg2)

Map a source location to the cursor that describes the entity at that location in the source code.

clang_getCursor() maps an arbitrary source location within a translation unit down to the most specific cursor that describes the entity at that location. For example, given an expression x + y, invoking clang_getCursor() with a source location pointing to "x" will return the cursor for "x"; similarly for "y". If the cursor points anywhere between "x" or "y" (e.g., on the + or the whitespace around it), clang_getCursor() will return a cursor referring to the "+" expression.

Returns

a cursor representing the entity at the given source location, or a NULL cursor if no such entity can be found.

Clang.LibClang.clang_getCursorAvailabilityMethod
clang_getCursorAvailability(cursor)

Determine the availability of the entity that this cursor refers to, taking the current target platform into account.

Parameters

  • cursor: The cursor to query.

Returns

The availability of the cursor.

Clang.LibClang.clang_getCursorCompletionStringMethod
clang_getCursorCompletionString(cursor)

Retrieve a completion string for an arbitrary declaration or macro definition cursor.

Parameters

  • cursor: The cursor to query.

Returns

A non-context-sensitive completion string for declaration and macro definition cursors, or NULL for other kinds of cursors.

Clang.LibClang.clang_getCursorDefinitionMethod
clang_getCursorDefinition(arg1)

For a cursor that is either a reference to or a declaration of some entity, retrieve a cursor that describes the definition of that entity.

Some entities can be declared multiple times within a translation unit, but only one of those declarations can also be a definition. For example, given:

  int f(int, int);
  int g(int x, int y) { return f(x, y); }
  int f(int a, int b) { return a + b; }
  int f(int, int);

there are three declarations of the function "f", but only the second one is a definition. The clang_getCursorDefinition() function will take any cursor pointing to a declaration of "f" (the first or fourth lines of the example) or a cursor referenced that uses "f" (the call to "f' inside "g") and will return a declaration cursor pointing to the definition (the second "f" declaration).

If given a cursor for which there is no corresponding definition, e.g., because there is no definition of that entity within this translation unit, returns a NULL cursor.

Clang.LibClang.clang_getCursorDisplayNameMethod
clang_getCursorDisplayName(arg1)

Retrieve the display name for the entity referenced by this cursor.

The display name contains extra information that helps identify the cursor, such as the parameters of a function or template or the arguments of a class template specialization.

Clang.LibClang.clang_getCursorExtentMethod
clang_getCursorExtent(arg1)

Retrieve the physical extent of the source construct referenced by the given cursor.

The extent of a cursor starts with the file/line/column pointing at the first character within the source construct that the cursor refers to and ends with the last character within that source construct. For a declaration, the extent covers the declaration itself. For a reference, the extent covers the location of the reference (e.g., where the referenced entity was actually used).

Clang.LibClang.clang_getCursorLexicalParentMethod
clang_getCursorLexicalParent(cursor)

Determine the lexical parent of the given cursor.

The lexical parent of a cursor is the cursor in which the given cursor was actually written. For many declarations, the lexical and semantic parents are equivalent (the semantic parent is returned by clang_getCursorSemanticParent()). They diverge when declarations or definitions are provided out-of-line. For example:

 class C {
  void f();
 };
 void C::f() { }

In the out-of-line definition of C::f, the semantic parent is the class C, of which this function is a member. The lexical parent is the place where the declaration actually occurs in the source code; in this case, the definition occurs in the translation unit. In general, the lexical parent for a given entity can change without affecting the semantics of the program, and the lexical parent of different declarations of the same entity may be different. Changing the semantic parent of a declaration, on the other hand, can have a major impact on semantics, and redeclarations of a particular entity should all have the same semantic context.

In the example above, both declarations of C::f have C as their semantic context, while the lexical context of the first C::f is C and the lexical context of the second C::f is the translation unit.

For declarations written in the global scope, the lexical parent is the translation unit.

Clang.LibClang.clang_getCursorLocationMethod
clang_getCursorLocation(arg1)

Retrieve the physical location of the source constructor referenced by the given cursor.

The location of a declaration is typically the location of the name of that declaration, where the name of that declaration would occur if it is unnamed, or some keyword that introduces that particular declaration. The location of a reference is where that reference occurs within the source code.

Clang.LibClang.clang_getCursorPlatformAvailabilityMethod
clang_getCursorPlatformAvailability(cursor, always_deprecated, deprecated_message, always_unavailable, unavailable_message, availability, availability_size)

Determine the availability of the entity that this cursor refers to on any platforms for which availability information is known.

Note that the client is responsible for calling clang_disposeCXPlatformAvailability to free each of the platform-availability structures returned. There are min(N, availability_size) such structures.

Parameters

  • cursor: The cursor to query.
  • always_deprecated: If non-NULL, will be set to indicate whether the entity is deprecated on all platforms.
  • deprecated_message: If non-NULL, will be set to the message text provided along with the unconditional deprecation of this entity. The client is responsible for deallocating this string.
  • always_unavailable: If non-NULL, will be set to indicate whether the entity is unavailable on all platforms.
  • unavailable_message: If non-NULL, will be set to the message text provided along with the unconditional unavailability of this entity. The client is responsible for deallocating this string.
  • availability: If non-NULL, an array of CXPlatformAvailability instances that will be populated with platform availability information, up to either the number of platforms for which availability information is available (as returned by this function) or availability_size, whichever is smaller.
  • availability_size: The number of elements available in the availability array.

Returns

The number of platforms (N) for which availability information is available (which is unrelated to availability_size).

Clang.LibClang.clang_getCursorPrettyPrintedMethod
clang_getCursorPrettyPrinted(Cursor, Policy)

Pretty print declarations.

Parameters

  • Cursor: The cursor representing a declaration.
  • Policy: The policy to control the entities being printed. If NULL, a default policy is used.

Returns

The pretty printed declaration or the empty string for other cursors.

Clang.LibClang.clang_getCursorReferenceNameRangeMethod
clang_getCursorReferenceNameRange(C, NameFlags, PieceIndex)

Given a cursor that references something else, return the source range covering that reference.

Parameters

  • C: A cursor pointing to a member reference, a declaration reference, or an operator call.
  • NameFlags: A bitset with three independent flags: CXNameRange_WantQualifier, CXNameRange_WantTemplateArgs, and CXNameRange_WantSinglePiece.
  • PieceIndex: For contiguous names or when passing the flag CXNameRange_WantSinglePiece, only one piece with index 0 is available. When the CXNameRange_WantSinglePiece flag is not passed for a non-contiguous names, this index can be used to retrieve the individual pieces of the name. See also CXNameRange_WantSinglePiece.

Returns

The piece of the name pointed to by the given cursor. If there is no name, or if the PieceIndex is out-of-range, a null-cursor will be returned.

Clang.LibClang.clang_getCursorReferencedMethod
clang_getCursorReferenced(arg1)

For a cursor that is a reference, retrieve a cursor representing the entity that it references.

Reference cursors refer to other entities in the AST. For example, an Objective-C superclass reference cursor refers to an Objective-C class. This function produces the cursor for the Objective-C class from the cursor for the superclass reference. If the input cursor is a declaration or definition, it returns that declaration or definition unchanged. Otherwise, returns the NULL cursor.

Clang.LibClang.clang_getCursorResultTypeMethod
clang_getCursorResultType(C)

Retrieve the return type associated with a given cursor.

This only returns a valid type if the cursor refers to a function or method.

Clang.LibClang.clang_getCursorSemanticParentMethod
clang_getCursorSemanticParent(cursor)

Determine the semantic parent of the given cursor.

The semantic parent of a cursor is the cursor that semantically contains the given cursor. For many declarations, the lexical and semantic parents are equivalent (the lexical parent is returned by clang_getCursorLexicalParent()). They diverge when declarations or definitions are provided out-of-line. For example:

 class C {
  void f();
 };
 void C::f() { }

In the out-of-line definition of C::f, the semantic parent is the class C, of which this function is a member. The lexical parent is the place where the declaration actually occurs in the source code; in this case, the definition occurs in the translation unit. In general, the lexical parent for a given entity can change without affecting the semantics of the program, and the lexical parent of different declarations of the same entity may be different. Changing the semantic parent of a declaration, on the other hand, can have a major impact on semantics, and redeclarations of a particular entity should all have the same semantic context.

In the example above, both declarations of C::f have C as their semantic context, while the lexical context of the first C::f is C and the lexical context of the second C::f is the translation unit.

For global declarations, the semantic parent is the translation unit.

Clang.LibClang.clang_getCursorUSRMethod
clang_getCursorUSR(arg1)

Retrieve a Unified Symbol Resolution (USR) for the entity referenced by the given cursor.

A Unified Symbol Resolution (USR) is a string that identifies a particular entity (function, class, variable, etc.) within a program. USRs can be compared across translation units to determine, e.g., when references in one translation refer to an entity defined in another translation unit.

Clang.LibClang.clang_getCursorVisibilityMethod
clang_getCursorVisibility(cursor)

Describe the visibility of the entity referred to by a cursor.

This returns the default visibility if not explicitly specified by a visibility attribute. The default visibility may be changed by commandline arguments.

Parameters

  • cursor: The cursor to query.

Returns

The visibility of the cursor.

Clang.LibClang.clang_getDiagnosticMethod
clang_getDiagnostic(Unit, Index)

Retrieve a diagnostic associated with the given translation unit.

Parameters

  • Unit: the translation unit to query.
  • Index: the zero-based diagnostic number to retrieve.

Returns

the requested diagnostic. This diagnostic must be freed via a call to clang_disposeDiagnostic().

Clang.LibClang.clang_getDiagnosticCategoryMethod
clang_getDiagnosticCategory(arg1)

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.

Clang.LibClang.clang_getDiagnosticFixItMethod
clang_getDiagnosticFixIt(Diagnostic, FixIt, ReplacementRange)

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).

Parameters

  • Diagnostic: The diagnostic whose fix-its are being queried.
  • FixIt: The zero-based index of the fix-it.
  • 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 ReplacementRange.

Clang.LibClang.clang_getDiagnosticLocationMethod
clang_getDiagnosticLocation(arg1)

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.

Clang.LibClang.clang_getDiagnosticOptionMethod
clang_getDiagnosticOption(Diag, Disable)

Retrieve the name of the command-line option that enabled this diagnostic.

Parameters

  • Diag: The diagnostic to be queried.
  • 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".

Clang.LibClang.clang_getDiagnosticRangeMethod
clang_getDiagnosticRange(Diagnostic, Range)

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.

Parameters

  • Diagnostic: the diagnostic whose range is being extracted.
  • Range: the zero-based index specifying which range to

Returns

the requested source range.

Clang.LibClang.clang_getElementTypeMethod
clang_getElementType(T)

Return the element type of an array, complex, or vector type.

If a type is passed in that is not an array, complex, or vector type, an invalid type is returned.

Clang.LibClang.clang_getEnumConstantDeclUnsignedValueMethod
clang_getEnumConstantDeclUnsignedValue(C)

Retrieve the integer value of an enum constant declaration as an unsigned long long.

If the cursor does not reference an enum constant declaration, ULLONG_MAX is returned. Since this is also potentially a valid constant value, the kind of the cursor must be verified before calling this function.

Clang.LibClang.clang_getEnumConstantDeclValueMethod
clang_getEnumConstantDeclValue(C)

Retrieve the integer value of an enum constant declaration as a signed long long.

If the cursor does not reference an enum constant declaration, LLONG_MIN is returned. Since this is also potentially a valid constant value, the kind of the cursor must be verified before calling this function.

Clang.LibClang.clang_getEnumDeclIntegerTypeMethod
clang_getEnumDeclIntegerType(C)

Retrieve the integer type of an enum declaration.

If the cursor does not reference an enum declaration, an invalid type is returned.

Clang.LibClang.clang_getExpansionLocationMethod
clang_getExpansionLocation(location, file, line, column, offset)

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.

Parameters

  • location: the location within a source file that will be decomposed into its parts.
  • file: [out] if non-NULL, will be set to the file to which the given source location points.
  • line: [out] if non-NULL, will be set to the line to which the given source location points.
  • column: [out] if non-NULL, will be set to the column to which the given source location points.
  • offset: [out] if non-NULL, will be set to the offset into the buffer to which the given source location points.
Clang.LibClang.clang_getFieldDeclBitWidthMethod
clang_getFieldDeclBitWidth(C)

Retrieve the bit width of a bit field declaration as an integer.

If a cursor that is not a bit field declaration is passed in, -1 is returned.

Clang.LibClang.clang_getFileMethod
clang_getFile(tu, file_name)

Retrieve a file handle within the given translation unit.

Parameters

  • tu: the translation unit
  • file_name: the name of the file.

Returns

the file handle for the named file in the translation unit tu, or a NULL file handle if the file was not a part of this translation unit.

Clang.LibClang.clang_getFileContentsMethod
clang_getFileContents(tu, file, size)

Retrieve the buffer associated with the given file.

Parameters

  • tu: the translation unit
  • file: the file for which to retrieve the buffer.
  • 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 file, or a NULL pointer when the file is not loaded.

Clang.LibClang.clang_getFileLocationMethod
clang_getFileLocation(location, file, line, column, offset)

Retrieve the file, line, column, and offset represented by the given source location.

If the location refers into a macro expansion, return where the macro was expanded or where the macro argument was written, if the location points at a macro argument.

Parameters

  • location: the location within a source file that will be decomposed into its parts.
  • file: [out] if non-NULL, will be set to the file to which the given source location points.
  • line: [out] if non-NULL, will be set to the line to which the given source location points.
  • column: [out] if non-NULL, will be set to the column to which the given source location points.
  • offset: [out] if non-NULL, will be set to the offset into the buffer to which the given source location points.
Clang.LibClang.clang_getFileUniqueIDMethod
clang_getFileUniqueID(file, outID)

Retrieve the unique ID for the given file.

Parameters

  • file: the file to get the ID for.
  • outID: stores the returned CXFileUniqueID.

Returns

If there was a failure getting the unique ID, returns non-zero, otherwise returns 0.

Clang.LibClang.clang_getInclusionsMethod
clang_getInclusions(tu, visitor, client_data)

Visit the set of preprocessor inclusions in a translation unit. The visitor function is called with the provided data for every included file. This does not include headers included by the PCH file (unless one is inspecting the inclusions in the PCH file itself).

Clang.LibClang.clang_getInstantiationLocationMethod
clang_getInstantiationLocation(location, file, line, column, offset)

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.

Clang.LibClang.clang_getLocationMethod
clang_getLocation(tu, file, line, column)

Retrieves the source location associated with a given file/line/column in a particular translation unit.

Clang.LibClang.clang_getNumArgTypesMethod
clang_getNumArgTypes(T)

Retrieve the number of non-variadic parameters associated with a function type.

If a non-function type is passed in, -1 is returned.

Clang.LibClang.clang_getNumElementsMethod
clang_getNumElements(T)

Return the number of elements of an array or vector type.

If a type is passed in that is not an array or vector type, -1 is returned.

Clang.LibClang.clang_getNumOverloadedDeclsMethod
clang_getNumOverloadedDecls(cursor)

Determine the number of overloaded declarations referenced by a CXCursor_OverloadedDeclRef cursor.

Parameters

  • cursor: The cursor whose overloaded declarations are being queried.

Returns

The number of overloaded declarations referenced by cursor. If it is not a CXCursor_OverloadedDeclRef cursor, returns 0.

Clang.LibClang.clang_getOverloadedDeclMethod
clang_getOverloadedDecl(cursor, index)

Retrieve a cursor for one of the overloaded declarations referenced by a CXCursor_OverloadedDeclRef cursor.

Parameters

  • cursor: The cursor whose overloaded declarations are being queried.
  • index: The zero-based index into the set of overloaded declarations in the cursor.

Returns

A cursor representing the declaration referenced by the given cursor at the specified index. If the cursor does not have an associated set of overloaded declarations, or if the index is out of bounds, returns clang_getNullCursor();

Clang.LibClang.clang_getOverriddenCursorsMethod
clang_getOverriddenCursors(cursor, overridden, num_overridden)

Determine the set of methods that are overridden by the given method.

In both Objective-C and C++, a method (aka virtual member function, in C++) can override a virtual method in a base class. For Objective-C, a method is said to override any method in the class's base class, its protocols, or its categories' protocols, that has the same selector and is of the same kind (class or instance). If no such method exists, the search continues to the class's superclass, its protocols, and its categories, and so on. A method from an Objective-C implementation is considered to override the same methods as its corresponding method in the interface.

For C++, a virtual member function overrides any virtual member function with the same signature that occurs in its base classes. With multiple inheritance, a virtual member function can override several virtual member functions coming from different base classes.

In all cases, this function determines the immediate overridden method, rather than all of the overridden methods. For example, if a method is originally declared in a class A, then overridden in B (which in inherits from A) and also in C (which inherited from B), then the only overridden method returned from this function when invoked on C's method will be B's method. The client may then invoke this function again, given the previously-found overridden methods, to map out the complete method-override set.

Parameters

  • cursor: A cursor representing an Objective-C or C++ method. This routine will compute the set of methods that this method overrides.
  • overridden: A pointer whose pointee will be replaced with a pointer to an array of cursors, representing the set of overridden methods. If there are no overridden methods, the pointee will be set to NULL. The pointee must be freed via a call to clang_disposeOverriddenCursors().
  • num_overridden: A pointer to the number of overridden functions, will be set to the number of overridden functions in the array pointed to by overridden.
Clang.LibClang.clang_getPresumedLocationMethod
clang_getPresumedLocation(location, filename, line, column)

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

 #123 "dummy.c" 1
 static int func(void)
 {
     return 0;
 }

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

Parameters

  • location: the location within a source file that will be decomposed into its parts.
  • 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 clang_disposeString() once you've finished with it. For an invalid source location, an empty string is returned.
  • line: [out] if non-NULL, will be set to the line number of the source location. For an invalid source location, zero is returned.
  • column: [out] if non-NULL, will be set to the column number of the source location. For an invalid source location, zero is returned.
Clang.LibClang.clang_getRemappingsMethod
clang_getRemappings(path)

Retrieve a remapping.

Parameters

  • path: the path that contains metadata about remappings.

Returns

the requested remapping. This remapping must be freed via a call to clang_remap_dispose(). Can return NULL if an error occurred.

Clang.LibClang.clang_getRemappingsFromFileListMethod
clang_getRemappingsFromFileList(filePaths, numFiles)

Retrieve a remapping.

Parameters

  • filePaths: pointer to an array of file paths containing remapping info.
  • numFiles: number of file paths.

Returns

the requested remapping. This remapping must be freed via a call to clang_remap_dispose(). Can return NULL if an error occurred.

Clang.LibClang.clang_getResultTypeMethod
clang_getResultType(T)

Retrieve the return type associated with a function type.

If a non-function type is passed in, an invalid type is returned.

Clang.LibClang.clang_getSkippedRangesMethod
clang_getSkippedRanges(tu, file)

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.

Clang.LibClang.clang_getSpecializedCursorTemplateMethod
clang_getSpecializedCursorTemplate(C)

Given a cursor that may represent a specialization or instantiation of a template, retrieve the cursor that represents the template that it specializes or from which it was instantiated.

This routine determines the template involved both for explicit specializations of templates and for implicit instantiations of the template, both of which are referred to as "specializations". For a class template specialization (e.g., std::vector<bool>), this routine will return either the primary template (std::vector) or, if the specialization was instantiated from a class template partial specialization, the class template partial specialization. For a class template partial specialization and a function template specialization (including instantiations), this this routine will return the specialized template.

For members of a class template (e.g., member functions, member classes, or static data members), returns the specialized or instantiated member. Although not strictly "templates" in the C++ language, members of class templates have the same notions of specializations and instantiations that templates do, so this routine treats them similarly.

Parameters

  • C: A cursor that may be a specialization of a template or a member of a template.

Returns

If the given cursor is a specialization or instantiation of a template or a member thereof, the template or member that it specializes or from which it was instantiated. Otherwise, returns a NULL cursor.

Clang.LibClang.clang_getSpellingLocationMethod
clang_getSpellingLocation(location, file, line, column, offset)

Retrieve the file, line, column, and offset represented by the given source location.

If the location refers into a macro instantiation, return where the location was originally spelled in the source file.

Parameters

  • location: the location within a source file that will be decomposed into its parts.
  • file: [out] if non-NULL, will be set to the file to which the given source location points.
  • line: [out] if non-NULL, will be set to the line to which the given source location points.
  • column: [out] if non-NULL, will be set to the column to which the given source location points.
  • offset: [out] if non-NULL, will be set to the offset into the buffer to which the given source location points.
Clang.LibClang.clang_getTUResourceUsageNameMethod
clang_getTUResourceUsageName(kind)

Returns the human-readable null-terminated C string that represents the name of the memory category. This string should never be freed.

Clang.LibClang.clang_getTemplateCursorKindMethod
clang_getTemplateCursorKind(C)

Given a cursor that represents a template, determine the cursor kind of the specializations would be generated by instantiating the template.

This routine can be used to determine what flavor of function template, class template, or class template partial specialization is stored in the cursor. For example, it can describe whether a class template cursor is declared with "struct", "class" or "union".

Parameters

  • C: The cursor to query. This cursor should represent a template declaration.

Returns

The cursor kind of the specializations that would be generated by instantiating the template C. If C is not a template, returns CXCursor_NoDeclFound.

Clang.LibClang.clang_getTokenMethod
clang_getToken(TU, Location)

Get the raw lexical token starting with the given location.

Parameters

  • TU: the translation unit whose text is being tokenized.
  • Location: the source location with which the token starts.

Returns

The token starting with the given location or NULL if no such token exist. The returned pointer must be freed with clang_disposeTokens before the translation unit is destroyed.

Clang.LibClang.clang_getTokenSpellingMethod
clang_getTokenSpelling(arg1, arg2)

Determine the spelling of the given token.

The spelling of a token is the textual representation of that token, e.g., the text of an identifier or keyword.

Clang.LibClang.clang_getTranslationUnitCursorMethod
clang_getTranslationUnitCursor(arg1)

Retrieve the cursor that represents the given translation unit.

The translation unit cursor can be used to start traversing the various declarations within the given translation unit.

Clang.LibClang.clang_getTypeSpellingMethod
clang_getTypeSpelling(CT)

Pretty-print the underlying type using the rules of the language of the translation unit from which it came.

If the type is invalid, an empty string is returned.

Clang.LibClang.clang_indexLoc_getFileLocationMethod
clang_indexLoc_getFileLocation(loc, indexFile, file, line, column, offset)

Retrieve the CXIdxFile, file, line, column, and offset represented by the given CXIdxLoc.

If the location refers into a macro expansion, retrieves the location of the macro expansion and if it refers into a macro argument retrieves the location of the argument.

Clang.LibClang.clang_indexSourceFileMethod
clang_indexSourceFile(arg1, client_data, index_callbacks, index_callbacks_size, index_options, source_filename, command_line_args, num_command_line_args, unsaved_files, num_unsaved_files, out_TU, TU_options)

Index the given source file and the translation unit corresponding to that file via callbacks implemented through #IndexerCallbacks.

The rest of the parameters are the same as #clang_parseTranslationUnit.

Parameters

  • client_data: pointer data supplied by the client, which will be passed to the invoked callbacks.
  • index_callbacks: Pointer to indexing callbacks that the client implements.
  • index_callbacks_size: Size of #IndexerCallbacks structure that gets passed in index_callbacks.
  • index_options: A bitmask of options that affects how indexing is performed. This should be a bitwise OR of the CXIndexOpt_XXX flags.
  • out_TU:[out] pointer to store a CXTranslationUnit that can be reused after indexing is finished. Set to NULL if you do not require it.

Returns

0 on success or if there were errors from which the compiler could recover. If there is a failure from which there is no recovery, returns a non-zero CXErrorCode.

Clang.LibClang.clang_indexSourceFileFullArgvMethod
clang_indexSourceFileFullArgv(arg1, client_data, index_callbacks, index_callbacks_size, index_options, source_filename, command_line_args, num_command_line_args, unsaved_files, num_unsaved_files, out_TU, TU_options)

Same as clang_indexSourceFile but requires a full command line for command_line_args including argv[0]. This is useful if the standard library paths are relative to the binary.

Clang.LibClang.clang_indexTranslationUnitMethod
clang_indexTranslationUnit(arg1, client_data, index_callbacks, index_callbacks_size, index_options, arg6)

Index the given translation unit via callbacks implemented through #IndexerCallbacks.

The order of callback invocations is not guaranteed to be the same as when indexing a source file. The high level order will be:

-Preprocessor callbacks invocations -Declaration/reference callbacks invocations -Diagnostic callback invocations

The parameters are the same as #clang_indexSourceFile.

Returns

If there is a failure from which there is no recovery, returns non-zero, otherwise returns 0.

Clang.LibClang.clang_isFileMultipleIncludeGuardedMethod
clang_isFileMultipleIncludeGuarded(tu, file)

Determine whether the given header is guarded against multiple inclusions, either with the conventional #ifndef/#define/#endif macro guards or with #pragma once.

Clang.LibClang.clang_isInvalidDeclarationMethod
clang_isInvalidDeclaration(arg1)

Determine whether the given declaration is invalid.

A declaration is invalid if it could not be parsed successfully.

Returns

non-zero if the cursor represents a declaration and it is invalid, otherwise NULL.

Clang.LibClang.clang_isPreprocessingMethod
clang_isPreprocessing(arg1)
  • Determine whether the given cursor represents a preprocessing element, such as a preprocessor directive or macro instantiation.
Clang.LibClang.clang_isReferenceMethod
clang_isReference(arg1)

Determine whether the given cursor kind represents a simple reference.

Note that other kinds of cursors (such as expressions) can also refer to other cursors. Use clang_getCursorReferenced() to determine whether a particular cursor refers to another entity.

Clang.LibClang.clang_isUnexposedMethod
clang_isUnexposed(arg1)
  • Determine whether the given cursor represents a currently unexposed piece of the AST (e.g., CXCursor_UnexposedStmt).
Clang.LibClang.clang_loadDiagnosticsMethod
clang_loadDiagnostics(file, error, errorString)

Deserialize a set of diagnostics from a Clang diagnostics bitcode file.

Parameters

  • file: The name of the file to deserialize.
  • error: A pointer to a enum value recording if there was a problem deserializing the diagnostics.
  • 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().

Clang.LibClang.clang_parseTranslationUnit2Method
clang_parseTranslationUnit2(CIdx, source_filename, command_line_args, num_command_line_args, unsaved_files, num_unsaved_files, options, out_TU)

Parse the given source file and the translation unit corresponding to that file.

This routine is the main entry point for the Clang C API, providing the ability to parse a source file into a translation unit that can then be queried by other functions in the API. This routine accepts a set of command-line arguments so that the compilation can be configured in the same way that the compiler is configured on the command line.

Parameters

  • CIdx: The index object with which the translation unit will be associated.
  • source_filename: The name of the source file to load, or NULL if the source file is included in command_line_args.
  • command_line_args: The command-line arguments that would be passed to the clang executable if it were being invoked out-of-process. These command-line options will be parsed and will affect how the translation unit is parsed. Note that the following options are ignored: '-c', '-emit-ast', '-fsyntax-only' (which is the default), and '-o <output file>'.
  • num_command_line_args: The number of command-line arguments in command_line_args.
  • unsaved_files: the files that have not yet been saved to disk but may be required for parsing, including the contents of those files. The contents and name of these files (as specified by CXUnsavedFile) are copied when necessary, so the client only needs to guarantee their validity until the call to this function returns.
  • num_unsaved_files: the number of unsaved file entries in unsaved_files.
  • options: A bitmask of options that affects how the translation unit is managed but not its compilation. This should be a bitwise OR of the CXTranslationUnit_XXX flags.
  • out_TU:[out] A non-NULL pointer to store the created CXTranslationUnit, describing the parsed code and containing any diagnostics produced by the compiler.

Returns

Zero on success, otherwise returns an error code.

Clang.LibClang.clang_parseTranslationUnit2FullArgvMethod
clang_parseTranslationUnit2FullArgv(CIdx, source_filename, command_line_args, num_command_line_args, unsaved_files, num_unsaved_files, options, out_TU)

Same as clang_parseTranslationUnit2 but requires a full command line for command_line_args including argv[0]. This is useful if the standard library paths are relative to the binary.

Clang.LibClang.clang_remap_getFilenamesMethod
clang_remap_getFilenames(arg1, index, original, transformed)

Get the original and the associated filename from the remapping.

Parameters

  • original: If non-NULL, will be set to the original filename.
  • transformed: If non-NULL, will be set to the filename that the original is associated with.
Clang.LibClang.clang_reparseTranslationUnitMethod
clang_reparseTranslationUnit(TU, num_unsaved_files, unsaved_files, options)

Reparse the source files that produced this translation unit.

This routine can be used to re-parse the source files that originally created the given translation unit, for example because those source files have changed (either on disk or as passed via unsaved_files). The source code will be reparsed with the same command-line options as it was originally parsed.

Reparsing a translation unit invalidates all cursors and source locations that refer into that translation unit. This makes reparsing a translation unit semantically equivalent to destroying the translation unit and then creating a new translation unit with the same command-line arguments. However, it may be more efficient to reparse a translation unit using this routine.

Parameters

  • TU: The translation unit whose contents will be re-parsed. The translation unit must originally have been built with clang_createTranslationUnitFromSourceFile().
  • num_unsaved_files: The number of unsaved file entries in unsaved_files.
  • unsaved_files: The files that have not yet been saved to disk but may be required for parsing, including the contents of those files. The contents and name of these files (as specified by CXUnsavedFile) are copied when necessary, so the client only needs to guarantee their validity until the call to this function returns.
  • options: A bitset of options composed of the flags in CXReparse_Flags. The function clang_defaultReparseOptions() produces a default set of options recommended for most uses, based on the translation unit.

Returns

0 if the sources could be reparsed. A non-zero error code will be returned if reparsing was impossible, such that the translation unit is invalid. In such cases, the only valid call for TU is clang_disposeTranslationUnit(TU). The error codes returned by this routine are described by the CXErrorCode enum.

Clang.LibClang.clang_saveTranslationUnitMethod
clang_saveTranslationUnit(TU, FileName, options)

Saves a translation unit into a serialized representation of that translation unit on disk.

Any translation unit that was parsed without error can be saved into a file. The translation unit can then be deserialized into a new CXTranslationUnit with clang_createTranslationUnit() or, if it is an incomplete translation unit that corresponds to a header, used as a precompiled header when parsing other translation units.

Parameters

  • TU: The translation unit to save.
  • FileName: The file to which the translation unit will be saved.
  • options: A bitmask of options that affects how the translation unit is saved. This should be a bitwise OR of the CXSaveTranslationUnit_XXX flags.

Returns

A value that will match one of the enumerators of the CXSaveError enumeration. Zero (CXSaveError_None) indicates that the translation unit was saved successfully, while a non-zero value indicates that a problem occurred.

Clang.LibClang.clang_sortCodeCompletionResultsMethod
clang_sortCodeCompletionResults(Results, NumResults)

Sort the code-completion results in case-insensitive alphabetical order.

Parameters

  • Results: The set of results to sort.
  • NumResults: The number of results in Results.
Clang.LibClang.clang_toggleCrashRecoveryMethod
clang_toggleCrashRecovery(isEnabled)

Enable/disable crash recovery.

Parameters

  • isEnabled: Flag to indicate if crash recovery is enabled. A non-zero value enables crash recovery, while 0 disables it.
Clang.LibClang.clang_tokenizeMethod
clang_tokenize(TU, Range, Tokens, NumTokens)

Tokenize the source code described by the given range into raw lexical tokens.

Parameters

  • TU: the translation unit whose text is being tokenized.
  • Range: the source range in which text should be tokenized. All of the tokens produced by tokenization will fall within this source range,
  • Tokens: this pointer will be set to point to the array of tokens that occur within the given source range. The returned pointer must be freed with clang_disposeTokens() before the translation unit is destroyed.
  • NumTokens: will be set to the number of tokens in the *Tokens array.
Clang.LibClang.clang_visitChildrenMethod
clang_visitChildren(parent, visitor, client_data)

Visit the children of a particular cursor.

This function visits all the direct children of the given cursor, invoking the given visitor function with the cursors of each visited child. The traversal may be recursive, if the visitor returns CXChildVisit_Recurse. The traversal may also be ended prematurely, if the visitor returns CXChildVisit_Break.

Parameters

  • parent: the cursor whose child may be visited. All kinds of cursors can be visited, including invalid cursors (which, by definition, have no children).
  • visitor: the visitor function that will be invoked for each child of parent.
  • client_data: pointer data supplied by the client, which will be passed to the visitor each time it is invoked.

Returns

a non-zero value if the traversal was terminated prematurely by the visitor returning CXChildVisit_Break.

Clang.LibClang.CXAvailabilityKindType
CXAvailabilityKind

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.

EnumeratorNote
CXAvailability_AvailableThe entity is available.
CXAvailability_DeprecatedThe entity is available, but has been deprecated (and its use is not recommended).
CXAvailability_NotAvailableThe entity is not available; any use of it will be an error.
CXAvailability_NotAccessibleThe entity is available, but not accessible; any use of it will be an error.
Clang.LibClang.CXChildVisitResultType
CXChildVisitResult

Describes how the traversal of the children of a particular cursor should proceed after visiting a particular child cursor.

A value of this enumeration type should be returned by each CXCursorVisitor to indicate how clang_visitChildren() proceed.

EnumeratorNote
CXChildVisit_BreakTerminates the cursor traversal.
CXChildVisit_ContinueContinues the cursor traversal with the next sibling of the cursor just visited, without visiting its children.
CXChildVisit_RecurseRecursively traverse the children of this cursor, using the same visitor and client data.
Clang.LibClang.CXClientDataType

Opaque pointer representing client data that will be passed through to various callbacks and visitors.

Clang.LibClang.CXCodeComplete_FlagsType
CXCodeComplete_Flags

Flags that can be passed to clang_codeCompleteAt() to modify its behavior.

The enumerators in this enumeration can be bitwise-OR'd together to provide multiple options to clang_codeCompleteAt().

EnumeratorNote
CXCodeComplete_IncludeMacrosWhether to include macros within the set of code completions returned.
CXCodeComplete_IncludeCodePatternsWhether to include code patterns for language constructs within the set of code completions, e.g., for loops.
CXCodeComplete_IncludeBriefCommentsWhether to include brief documentation within the set of code completions returned.
CXCodeComplete_SkipPreambleWhether to speed up completion by omitting top- or namespace-level entities defined in the preamble. There's no guarantee any particular entity is omitted. This may be useful if the headers are indexed externally.
CXCodeComplete_IncludeCompletionsWithFixItsWhether to include completions with small fix-its, e.g. change '.' to '->' on member access, etc.
Clang.LibClang.CXCommentInlineCommandRenderKindType
CXCommentInlineCommandRenderKind

The most appropriate rendering mode for an inline command, chosen on command semantics in Doxygen.

EnumeratorNote
CXCommentInlineCommandRenderKind_NormalCommand argument should be rendered in a normal font.
CXCommentInlineCommandRenderKind_BoldCommand argument should be rendered in a bold font.
CXCommentInlineCommandRenderKind_MonospacedCommand argument should be rendered in a monospaced font.
CXCommentInlineCommandRenderKind_EmphasizedCommand argument should be rendered emphasized (typically italic font).
CXCommentInlineCommandRenderKind_AnchorCommand argument should not be rendered (since it only defines an anchor).
Clang.LibClang.CXCommentKindType
CXCommentKind

Describes the type of the comment AST node (CXComment). A comment node can be considered block content (e. g., paragraph), inline content (plain text) or neither (the root AST node).

EnumeratorNote
CXComment_NullNull comment. No AST node is constructed at the requested location because there is no text or a syntax error.
CXComment_TextPlain text. Inline content.
CXComment_InlineCommandA command with word-like arguments that is considered inline content. For example: \c command.
CXComment_HTMLStartTagHTML start tag with attributes (name-value pairs). Considered inline content. For example: c++ <br> <br /> <a href="http://example.org/">
CXComment_HTMLEndTagHTML end tag. Considered inline content. For example: c++ </a>
CXComment_ParagraphA paragraph, contains inline comment. The paragraph itself is block content.
CXComment_BlockCommandA 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: 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.
CXComment_ParamCommandA \param or \arg command that describes the function parameter (name, passing direction, description). For example: \param [in] ParamName description.
CXComment_TParamCommandA \tparam command that describes a template parameter (name and description). For example: \tparam T description.
CXComment_VerbatimBlockCommandA verbatim block command (e. g., preformatted code). Verbatim block has an opening and a closing command and contains multiple lines of text (CXComment_VerbatimBlockLine child nodes). For example: \verbatim aaa \endverbatim
CXComment_VerbatimBlockLineA line of text that is contained within a CXComment_VerbatimBlockCommand node.
CXComment_VerbatimLineA 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.
CXComment_FullCommentA full comment attached to a declaration, contains block content.
Clang.LibClang.CXCommentParamPassDirectionType
CXCommentParamPassDirection

Describes parameter passing direction for \param or \arg command.

EnumeratorNote
CXCommentParamPassDirection_InThe parameter is an input parameter.
CXCommentParamPassDirection_OutThe parameter is an output parameter.
CXCommentParamPassDirection_InOutThe parameter is an input and output parameter.
Clang.LibClang.CXCompileCommandsType

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 clang_CompileCommands_dispose.

Clang.LibClang.CXCompletionChunkKindType
CXCompletionChunkKind

Describes a single piece of text within a code-completion string.

Each "chunk" within a code-completion string (CXCompletionString) is either a piece of text with a specific "kind" that describes how that text should be interpreted by the client or is another completion string.

EnumeratorNote
CXCompletionChunk_OptionalA code-completion string that describes "optional" text that could be a part of the template (but is not required). The Optional chunk is the only kind of chunk that has a code-completion string for its representation, which is accessible via clang_getCompletionChunkCompletionString(). The code-completion string describes an additional part of the template that is completely optional. For example, optional chunks can be used to describe the placeholders for arguments that match up with defaulted function parameters, e.g. given: c++ void f(int x, float y = 3.14, double z = 2.71828); The code-completion string for this function would contain: - a TypedText chunk for "f". - a LeftParen chunk for "(". - a Placeholder chunk for "int x" - an Optional chunk containing the remaining defaulted arguments, e.g., - a Comma chunk for "," - a Placeholder chunk for "float y" - an Optional chunk containing the last defaulted argument: - a Comma chunk for "," - a Placeholder chunk for "double z" - a RightParen chunk for ")" There are many ways to handle Optional chunks. Two simple approaches are: - Completely ignore optional chunks, in which case the template for the function "f" would only include the first parameter ("int x"). - Fully expand all optional chunks, in which case the template for the function "f" would have all of the parameters.
CXCompletionChunk_TypedTextText that a user would be expected to type to get this code-completion result. There will be exactly one "typed text" chunk in a semantic string, which will typically provide the spelling of a keyword or the name of a declaration that could be used at the current code point. Clients are expected to filter the code-completion results based on the text in this chunk.
CXCompletionChunk_TextText that should be inserted as part of a code-completion result. A "text" chunk represents text that is part of the template to be inserted into user code should this particular code-completion result be selected.
CXCompletionChunk_PlaceholderPlaceholder text that should be replaced by the user. A "placeholder" chunk marks a place where the user should insert text into the code-completion template. For example, placeholders might mark the function parameters for a function declaration, to indicate that the user should provide arguments for each of those parameters. The actual text in a placeholder is a suggestion for the text to display before the user replaces the placeholder with real code.
CXCompletionChunk_InformativeInformative text that should be displayed but never inserted as part of the template. An "informative" chunk contains annotations that can be displayed to help the user decide whether a particular code-completion result is the right option, but which is not part of the actual template to be inserted by code completion.
CXCompletionChunk_CurrentParameterText that describes the current parameter when code-completion is referring to function call, message send, or template specialization. A "current parameter" chunk occurs when code-completion is providing information about a parameter corresponding to the argument at the code-completion point. For example, given a function c++ int add(int x, int y); and the source code add(, where the code-completion point is after the "(", the code-completion string will contain a "current parameter" chunk for "int x", indicating that the current argument will initialize that parameter. After typing further, to add(17, (where the code-completion point is after the ","), the code-completion string will contain a "current parameter" chunk to "int y".
CXCompletionChunk_LeftParenA left parenthesis ('('), used to initiate a function call or signal the beginning of a function parameter list.
CXCompletionChunk_RightParenA right parenthesis (')'), used to finish a function call or signal the end of a function parameter list.
CXCompletionChunk_LeftBracketA left bracket ('[').
CXCompletionChunk_RightBracketA right bracket (']').
CXCompletionChunk_LeftBraceA left brace ('{').
CXCompletionChunk_RightBraceA right brace ('}').
CXCompletionChunk_LeftAngleA left angle bracket ('<').
CXCompletionChunk_RightAngleA right angle bracket ('>').
CXCompletionChunk_CommaA comma separator (',').
CXCompletionChunk_ResultTypeText that specifies the result type of a given result. This special kind of informative chunk is not meant to be inserted into the text buffer. Rather, it is meant to illustrate the type that an expression using the given completion string would have.
CXCompletionChunk_ColonA colon (':').
CXCompletionChunk_SemiColonA semicolon (';').
CXCompletionChunk_EqualAn '=' sign.
CXCompletionChunk_HorizontalSpaceHorizontal space (' ').
CXCompletionChunk_VerticalSpaceVertical space ('\n'), after which it is generally a good idea to perform indentation.
Clang.LibClang.CXCompletionContextType
CXCompletionContext

Bits that represent the context under which completion is occurring.

The enumerators in this enumeration may be bitwise-OR'd together if multiple contexts are occurring simultaneously.

EnumeratorNote
CXCompletionContext_UnexposedThe context for completions is unexposed, as only Clang results should be included. (This is equivalent to having no context bits set.)
CXCompletionContext_AnyTypeCompletions for any possible type should be included in the results.
CXCompletionContext_AnyValueCompletions for any possible value (variables, function calls, etc.) should be included in the results.
CXCompletionContext_ObjCObjectValueCompletions for values that resolve to an Objective-C object should be included in the results.
CXCompletionContext_ObjCSelectorValueCompletions for values that resolve to an Objective-C selector should be included in the results.
CXCompletionContext_CXXClassTypeValueCompletions for values that resolve to a C++ class type should be included in the results.
CXCompletionContext_DotMemberAccessCompletions for fields of the member being accessed using the dot operator should be included in the results.
CXCompletionContext_ArrowMemberAccessCompletions for fields of the member being accessed using the arrow operator should be included in the results.
CXCompletionContext_ObjCPropertyAccessCompletions for properties of the Objective-C object being accessed using the dot operator should be included in the results.
CXCompletionContext_EnumTagCompletions for enum tags should be included in the results.
CXCompletionContext_UnionTagCompletions for union tags should be included in the results.
CXCompletionContext_StructTagCompletions for struct tags should be included in the results.
CXCompletionContext_ClassTagCompletions for C++ class names should be included in the results.
CXCompletionContext_NamespaceCompletions for C++ namespaces and namespace aliases should be included in the results.
CXCompletionContext_NestedNameSpecifierCompletions for C++ nested name specifiers should be included in the results.
CXCompletionContext_ObjCInterfaceCompletions for Objective-C interfaces (classes) should be included in the results.
CXCompletionContext_ObjCProtocolCompletions for Objective-C protocols should be included in the results.
CXCompletionContext_ObjCCategoryCompletions for Objective-C categories should be included in the results.
CXCompletionContext_ObjCInstanceMessageCompletions for Objective-C instance messages should be included in the results.
CXCompletionContext_ObjCClassMessageCompletions for Objective-C class messages should be included in the results.
CXCompletionContext_ObjCSelectorNameCompletions for Objective-C selector names should be included in the results.
CXCompletionContext_MacroNameCompletions for preprocessor macro names should be included in the results.
CXCompletionContext_NaturalLanguageNatural language completions should be included in the results.
CXCompletionContext_IncludedFile#include file completions should be included in the results.
CXCompletionContext_UnknownThe current context is unknown, so set all contexts.
Clang.LibClang.CXCompletionResultType
CXCompletionResult

A single result of code completion.

FieldNote
CursorKindThe kind of entity that this completion refers to. The cursor kind will be a macro, keyword, or a declaration (one of the *Decl cursor kinds), describing the entity that the completion is referring to. \todo In the future, we would like to provide a full cursor, to allow the client to extract additional information from declaration.
CompletionStringThe code-completion string that describes how to insert this code-completion result into the editing buffer.
Clang.LibClang.CXCompletionStringType

A semantic string that describes a code-completion result.

A semantic string that describes the formatting of a code-completion result as a single "template" of text that should be inserted into the source buffer when a particular code-completion result is selected. Each semantic string is made up of some number of "chunks", each of which contains some text along with a description of what that text means, e.g., the name of the entity being referenced, whether the text chunk is part of the template, or whether it is a "placeholder" that the user should replace with actual code,of a specific kind. See CXCompletionChunkKind for a description of the different kinds of chunks.

Clang.LibClang.CXCursorType
CXCursor

A cursor representing some element in the abstract syntax tree for a translation unit.

The cursor abstraction unifies the different kinds of entities in a program–declaration, statements, expressions, references to declarations, etc.–under a single "cursor" abstraction with a common set of operations. Common operation for a cursor include: getting the physical location in a source file where the cursor points, getting the name associated with a cursor, and retrieving cursors for any child nodes of a particular cursor.

Cursors can be produced in two specific ways. clang_getTranslationUnitCursor() produces a cursor for a translation unit, from which one can use clang_visitChildren() to explore the rest of the translation unit. clang_getCursor() maps from a physical source location to the entity that resides at that location, allowing one to map from the source code into the AST.

Clang.LibClang.CXCursorKindType
CXCursorKind

Describes the kind of entity that a cursor refers to.

EnumeratorNote
CXCursor_UnexposedDeclA declaration whose specific kind is not exposed via this interface. Unexposed declarations have the same operations as any other kind of declaration; one can extract their location information, spelling, find their definitions, etc. However, the specific kind of the declaration is not reported.
CXCursor_StructDeclA C or C++ struct.
CXCursor_UnionDeclA C or C++ union.
CXCursor_ClassDeclA C++ class.
CXCursor_EnumDeclAn enumeration.
CXCursor_FieldDeclA field (in C) or non-static data member (in C++) in a struct, union, or C++ class.
CXCursor_EnumConstantDeclAn enumerator constant.
CXCursor_FunctionDeclA function.
CXCursor_VarDeclA variable.
CXCursor_ParmDeclA function or method parameter.
CXCursor_ObjCInterfaceDeclAn Objective-C @interface.
CXCursor_ObjCCategoryDeclAn Objective-C @interface for a category.
CXCursor_ObjCProtocolDeclAn Objective-C @protocol declaration.
CXCursor_ObjCPropertyDeclAn Objective-C @property declaration.
CXCursor_ObjCIvarDeclAn Objective-C instance variable.
CXCursor_ObjCInstanceMethodDeclAn Objective-C instance method.
CXCursor_ObjCClassMethodDeclAn Objective-C class method.
CXCursor_ObjCImplementationDeclAn Objective-C @implementation.
CXCursor_ObjCCategoryImplDeclAn Objective-C @implementation for a category.
CXCursor_TypedefDeclA typedef.
CXCursor_CXXMethodA C++ class method.
CXCursor_NamespaceA C++ namespace.
CXCursor_LinkageSpecA linkage specification, e.g. 'extern "C"'.
CXCursor_ConstructorA C++ constructor.
CXCursor_DestructorA C++ destructor.
CXCursor_ConversionFunctionA C++ conversion function.
CXCursor_TemplateTypeParameterA C++ template type parameter.
CXCursor_NonTypeTemplateParameterA C++ non-type template parameter.
CXCursor_TemplateTemplateParameterA C++ template template parameter.
CXCursor_FunctionTemplateA C++ function template.
CXCursor_ClassTemplateA C++ class template.
CXCursor_ClassTemplatePartialSpecializationA C++ class template partial specialization.
CXCursor_NamespaceAliasA C++ namespace alias declaration.
CXCursor_UsingDirectiveA C++ using directive.
CXCursor_UsingDeclarationA C++ using declaration.
CXCursor_TypeAliasDeclA C++ alias declaration
CXCursor_ObjCSynthesizeDeclAn Objective-C @synthesize definition.
CXCursor_ObjCDynamicDeclAn Objective-C @dynamic definition.
CXCursor_CXXAccessSpecifierAn access specifier.
CXCursor_FirstDecl
CXCursor_LastDecl
CXCursor_FirstRef
CXCursor_ObjCSuperClassRef
CXCursor_ObjCProtocolRef
CXCursor_ObjCClassRef
CXCursor_TypeRefA reference to a type declaration. A type reference occurs anywhere where a type is named but not declared. For example, given: c++ typedef unsigned size_type; size_type size; The typedef is a declaration of size_type (CXCursor_TypedefDecl), while the type of the variable "size" is referenced. The cursor referenced by the type of size is the typedef for size_type.
CXCursor_CXXBaseSpecifier
CXCursor_TemplateRefA reference to a class template, function template, template template parameter, or class template partial specialization.
CXCursor_NamespaceRefA reference to a namespace or namespace alias.
CXCursor_MemberRefA reference to a member of a struct, union, or class that occurs in some non-expression context, e.g., a designated initializer.
CXCursor_LabelRefA reference to a labeled statement. This cursor kind is used to describe the jump to "start_over" in the goto statement in the following example: c++ start_over: ++counter; goto start_over; A label reference cursor refers to a label statement.
CXCursor_OverloadedDeclRefA reference to a set of overloaded functions or function templates that has not yet been resolved to a specific function or function template. An overloaded declaration reference cursor occurs in C++ templates where a dependent name refers to a function. For example: c++ template<typename T> void swap(T&, T&); struct X { ... }; void swap(X&, X&); template<typename T> void reverse(T* first, T* last) { while (first < last - 1) { swap(*first, *--last); ++first; } } struct Y { }; void swap(Y&, Y&); Here, the identifier "swap" is associated with an overloaded declaration reference. In the template definition, "swap" refers to either of the two "swap" functions declared above, so both results will be available. At instantiation time, "swap" may also refer to other functions found via argument-dependent lookup (e.g., the "swap" function at the end of the example). The functions clang_getNumOverloadedDecls() and clang_getOverloadedDecl() can be used to retrieve the definitions referenced by this cursor.
CXCursor_VariableRefA reference to a variable that occurs in some non-expression context, e.g., a C++ lambda capture list.
CXCursor_LastRef
CXCursor_FirstInvalid
CXCursor_InvalidFile
CXCursor_NoDeclFound
CXCursor_NotImplemented
CXCursor_InvalidCode
CXCursor_LastInvalid
CXCursor_FirstExpr
CXCursor_UnexposedExprAn expression whose specific kind is not exposed via this interface. Unexposed expressions have the same operations as any other kind of expression; one can extract their location information, spelling, children, etc. However, the specific kind of the expression is not reported.
CXCursor_DeclRefExprAn expression that refers to some value declaration, such as a function, variable, or enumerator.
CXCursor_MemberRefExprAn expression that refers to a member of a struct, union, class, Objective-C class, etc.
CXCursor_CallExprAn expression that calls a function.
CXCursor_ObjCMessageExprAn expression that sends a message to an Objective-C object or class.
CXCursor_BlockExprAn expression that represents a block literal.
CXCursor_IntegerLiteralAn integer literal.
CXCursor_FloatingLiteralA floating point number literal.
CXCursor_ImaginaryLiteralAn imaginary number literal.
CXCursor_StringLiteralA string literal.
CXCursor_CharacterLiteralA character literal.
CXCursor_ParenExprA parenthesized expression, e.g. "(1)". This AST node is only formed if full location information is requested.
CXCursor_UnaryOperatorThis represents the unary-expression's (except sizeof and alignof).
CXCursor_ArraySubscriptExpr[C99 6.5.2.1] Array Subscripting.
CXCursor_BinaryOperatorA builtin binary operation expression such as "x + y" or "x <= y".
CXCursor_CompoundAssignOperatorCompound assignment such as "+=".
CXCursor_ConditionalOperatorThe ?: ternary operator.
CXCursor_CStyleCastExprAn explicit cast in C (C99 6.5.4) or a C-style cast in C++ (C++ [expr.cast]), which uses the syntax (Type)expr. For example: (int)f.
CXCursor_CompoundLiteralExpr[C99 6.5.2.5]
CXCursor_InitListExprDescribes an C or C++ initializer list.
CXCursor_AddrLabelExprThe GNU address of label extension, representing &&label.
CXCursor_StmtExprThis is the GNU Statement Expression extension: ({int X=4; X;})
CXCursor_GenericSelectionExprRepresents a C11 generic selection.
CXCursor_GNUNullExprImplements the GNU __null extension, which is a name for a null pointer constant that has integral type (e.g., int or long) and is the same size and alignment as a pointer. The __null extension is typically only used by system headers, which define NULL as __null in C++ rather than using 0 (which is an integer that may not match the size of a pointer).
CXCursor_CXXStaticCastExprC++'s static_cast<> expression.
CXCursor_CXXDynamicCastExprC++'s dynamic_cast<> expression.
CXCursor_CXXReinterpretCastExprC++'s reinterpret_cast<> expression.
CXCursor_CXXConstCastExprC++'s const_cast<> expression.
CXCursor_CXXFunctionalCastExprRepresents an explicit C++ type conversion that uses "functional" notion (C++ [expr.type.conv]). Example: c++ x = int(0.5);
CXCursor_CXXTypeidExprA C++ typeid expression (C++ [expr.typeid]).
CXCursor_CXXBoolLiteralExpr[C++ 2.13.5] C++ Boolean Literal.
CXCursor_CXXNullPtrLiteralExpr[C++0x 2.14.7] C++ Pointer Literal.
CXCursor_CXXThisExprRepresents the "this" expression in C++
CXCursor_CXXThrowExpr[C++ 15] C++ Throw Expression. This handles 'throw' and 'throw' assignment-expression. When assignment-expression isn't present, Op will be null.
CXCursor_CXXNewExprA new expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)".
CXCursor_CXXDeleteExprA delete expression for memory deallocation and destructor calls, e.g. "delete[] pArray".
CXCursor_UnaryExprA unary expression. (noexcept, sizeof, or other traits)
CXCursor_ObjCStringLiteralAn Objective-C string literal i.e. "foo".
CXCursor_ObjCEncodeExprAn Objective-C @encode expression.
CXCursor_ObjCSelectorExprAn Objective-C @selector expression.
CXCursor_ObjCProtocolExprAn Objective-C @protocol expression.
CXCursor_ObjCBridgedCastExprAn Objective-C "bridged" cast expression, which casts between Objective-C pointers and C pointers, transferring ownership in the process. c++ NSString *str = (__bridge_transfer NSString *)CFCreateString();
CXCursor_PackExpansionExprRepresents a C++0x pack expansion that produces a sequence of expressions. A pack expansion expression contains a pattern (which itself is an expression) followed by an ellipsis. For example: c++ template<typename F, typename ...Types> void forward(F f, Types &&...args) { f(static_cast<Types&&>(args)...); }
CXCursor_SizeOfPackExprRepresents an expression that computes the length of a parameter pack. c++ template<typename ...Types> struct count { static const unsigned value = sizeof...(Types); };
CXCursor_ObjCBoolLiteralExprObjective-c Boolean Literal.
CXCursor_ObjCSelfExprRepresents the "self" expression in an Objective-C method.
CXCursor_OMPArraySectionExprOpenMP 5.0 [2.1.5, Array Section].
CXCursor_ObjCAvailabilityCheckExprRepresents an (...) check.
CXCursor_FixedPointLiteralFixed point literal
CXCursor_OMPArrayShapingExprOpenMP 5.0 [2.1.4, Array Shaping].
CXCursor_OMPIteratorExprOpenMP 5.0 [2.1.6 Iterators]
CXCursor_CXXAddrspaceCastExprOpenCL's addrspace_cast<> expression.
CXCursor_LastExpr
CXCursor_FirstStmt
CXCursor_UnexposedStmtA statement whose specific kind is not exposed via this interface. Unexposed statements have the same operations as any other kind of statement; one can extract their location information, spelling, children, etc. However, the specific kind of the statement is not reported.
CXCursor_LabelStmtA labelled statement in a function. This cursor kind is used to describe the "start_over:" label statement in the following example: c++ start_over: ++counter;
CXCursor_CompoundStmtA group of statements like { stmt stmt }. This cursor kind is used to describe compound statements, e.g. function bodies.
CXCursor_CaseStmtA case statement.
CXCursor_DefaultStmtA default statement.
CXCursor_IfStmtAn if statement
CXCursor_SwitchStmtA switch statement.
CXCursor_WhileStmtA while statement.
CXCursor_DoStmtA do statement.
CXCursor_ForStmtA for statement.
CXCursor_GotoStmtA goto statement.
CXCursor_IndirectGotoStmtAn indirect goto statement.
CXCursor_ContinueStmtA continue statement.
CXCursor_BreakStmtA break statement.
CXCursor_ReturnStmtA return statement.
CXCursor_GCCAsmStmtA GCC inline assembly statement extension.
CXCursor_AsmStmt
CXCursor_ObjCAtTryStmtObjective-C's overall @try-@catch-@finally statement.
CXCursor_ObjCAtCatchStmtObjective-C's @catch statement.
CXCursor_ObjCAtFinallyStmtObjective-C's @finally statement.
CXCursor_ObjCAtThrowStmtObjective-C's @throw statement.
CXCursor_ObjCAtSynchronizedStmtObjective-C's @synchronized statement.
CXCursor_ObjCAutoreleasePoolStmtObjective-C's autorelease pool statement.
CXCursor_ObjCForCollectionStmtObjective-C's collection statement.
CXCursor_CXXCatchStmtC++'s catch statement.
CXCursor_CXXTryStmtC++'s try statement.
CXCursor_CXXForRangeStmtC++'s for (* : *) statement.
CXCursor_SEHTryStmtWindows Structured Exception Handling's try statement.
CXCursor_SEHExceptStmtWindows Structured Exception Handling's except statement.
CXCursor_SEHFinallyStmtWindows Structured Exception Handling's finally statement.
CXCursor_MSAsmStmtA MS inline assembly statement extension.
CXCursor_NullStmtThe null statement ";": C99 6.8.3p3. This cursor kind is used to describe the null statement.
CXCursor_DeclStmtAdaptor class for mixing declarations with statements and expressions.
CXCursor_OMPParallelDirectiveOpenMP parallel directive.
CXCursor_OMPSimdDirectiveOpenMP SIMD directive.
CXCursor_OMPForDirectiveOpenMP for directive.
CXCursor_OMPSectionsDirectiveOpenMP sections directive.
CXCursor_OMPSectionDirectiveOpenMP section directive.
CXCursor_OMPSingleDirectiveOpenMP single directive.
CXCursor_OMPParallelForDirectiveOpenMP parallel for directive.
CXCursor_OMPParallelSectionsDirectiveOpenMP parallel sections directive.
CXCursor_OMPTaskDirectiveOpenMP task directive.
CXCursor_OMPMasterDirectiveOpenMP master directive.
CXCursor_OMPCriticalDirectiveOpenMP critical directive.
CXCursor_OMPTaskyieldDirectiveOpenMP taskyield directive.
CXCursor_OMPBarrierDirectiveOpenMP barrier directive.
CXCursor_OMPTaskwaitDirectiveOpenMP taskwait directive.
CXCursor_OMPFlushDirectiveOpenMP flush directive.
CXCursor_SEHLeaveStmtWindows Structured Exception Handling's leave statement.
CXCursor_OMPOrderedDirectiveOpenMP ordered directive.
CXCursor_OMPAtomicDirectiveOpenMP atomic directive.
CXCursor_OMPForSimdDirectiveOpenMP for SIMD directive.
CXCursor_OMPParallelForSimdDirectiveOpenMP parallel for SIMD directive.
CXCursor_OMPTargetDirectiveOpenMP target directive.
CXCursor_OMPTeamsDirectiveOpenMP teams directive.
CXCursor_OMPTaskgroupDirectiveOpenMP taskgroup directive.
CXCursor_OMPCancellationPointDirectiveOpenMP cancellation point directive.
CXCursor_OMPCancelDirectiveOpenMP cancel directive.
CXCursor_OMPTargetDataDirectiveOpenMP target data directive.
CXCursor_OMPTaskLoopDirectiveOpenMP taskloop directive.
CXCursor_OMPTaskLoopSimdDirectiveOpenMP taskloop simd directive.
CXCursor_OMPDistributeDirectiveOpenMP distribute directive.
CXCursor_OMPTargetEnterDataDirectiveOpenMP target enter data directive.
CXCursor_OMPTargetExitDataDirectiveOpenMP target exit data directive.
CXCursor_OMPTargetParallelDirectiveOpenMP target parallel directive.
CXCursor_OMPTargetParallelForDirectiveOpenMP target parallel for directive.
CXCursor_OMPTargetUpdateDirectiveOpenMP target update directive.
CXCursor_OMPDistributeParallelForDirectiveOpenMP distribute parallel for directive.
CXCursor_OMPDistributeParallelForSimdDirectiveOpenMP distribute parallel for simd directive.
CXCursor_OMPDistributeSimdDirectiveOpenMP distribute simd directive.
CXCursor_OMPTargetParallelForSimdDirectiveOpenMP target parallel for simd directive.
CXCursor_OMPTargetSimdDirectiveOpenMP target simd directive.
CXCursor_OMPTeamsDistributeDirectiveOpenMP teams distribute directive.
CXCursor_OMPTeamsDistributeSimdDirectiveOpenMP teams distribute simd directive.
CXCursor_OMPTeamsDistributeParallelForSimdDirectiveOpenMP teams distribute parallel for simd directive.
CXCursor_OMPTeamsDistributeParallelForDirectiveOpenMP teams distribute parallel for directive.
CXCursor_OMPTargetTeamsDirectiveOpenMP target teams directive.
CXCursor_OMPTargetTeamsDistributeDirectiveOpenMP target teams distribute directive.
CXCursor_OMPTargetTeamsDistributeParallelForDirectiveOpenMP target teams distribute parallel for directive.
CXCursor_OMPTargetTeamsDistributeParallelForSimdDirectiveOpenMP target teams distribute parallel for simd directive.
CXCursor_OMPTargetTeamsDistributeSimdDirectiveOpenMP target teams distribute simd directive.
CXCursor_BuiltinBitCastExprC++2a std::bit_cast expression.
CXCursor_OMPMasterTaskLoopDirectiveOpenMP master taskloop directive.
CXCursor_OMPParallelMasterTaskLoopDirectiveOpenMP parallel master taskloop directive.
CXCursor_OMPMasterTaskLoopSimdDirectiveOpenMP master taskloop simd directive.
CXCursor_OMPParallelMasterTaskLoopSimdDirectiveOpenMP parallel master taskloop simd directive.
CXCursor_OMPParallelMasterDirectiveOpenMP parallel master directive.
CXCursor_OMPDepobjDirectiveOpenMP depobj directive.
CXCursor_OMPScanDirectiveOpenMP scan directive.
CXCursor_OMPTileDirectiveOpenMP tile directive.
CXCursor_OMPCanonicalLoopOpenMP canonical loop.
CXCursor_OMPInteropDirectiveOpenMP interop directive.
CXCursor_OMPDispatchDirectiveOpenMP dispatch directive.
CXCursor_OMPMaskedDirectiveOpenMP masked directive.
CXCursor_OMPUnrollDirectiveOpenMP unroll directive.
CXCursor_OMPMetaDirectiveOpenMP metadirective directive.
CXCursor_OMPGenericLoopDirectiveOpenMP loop directive.
CXCursor_LastStmt
CXCursor_TranslationUnitCursor that represents the translation unit itself. The translation unit cursor exists primarily to act as the root cursor for traversing the contents of a translation unit.
CXCursor_FirstAttr
CXCursor_UnexposedAttrAn attribute whose specific kind is not exposed via this interface.
CXCursor_IBActionAttr
CXCursor_IBOutletAttr
CXCursor_IBOutletCollectionAttr
CXCursor_CXXFinalAttr
CXCursor_CXXOverrideAttr
CXCursor_AnnotateAttr
CXCursor_AsmLabelAttr
CXCursor_PackedAttr
CXCursor_PureAttr
CXCursor_ConstAttr
CXCursor_NoDuplicateAttr
CXCursor_CUDAConstantAttr
CXCursor_CUDADeviceAttr
CXCursor_CUDAGlobalAttr
CXCursor_CUDAHostAttr
CXCursor_CUDASharedAttr
CXCursor_VisibilityAttr
CXCursor_DLLExport
CXCursor_DLLImport
CXCursor_NSReturnsRetained
CXCursor_NSReturnsNotRetained
CXCursor_NSReturnsAutoreleased
CXCursor_NSConsumesSelf
CXCursor_NSConsumed
CXCursor_ObjCException
CXCursor_ObjCNSObject
CXCursor_ObjCIndependentClass
CXCursor_ObjCPreciseLifetime
CXCursor_ObjCReturnsInnerPointer
CXCursor_ObjCRequiresSuper
CXCursor_ObjCRootClass
CXCursor_ObjCSubclassingRestricted
CXCursor_ObjCExplicitProtocolImpl
CXCursor_ObjCDesignatedInitializer
CXCursor_ObjCRuntimeVisible
CXCursor_ObjCBoxable
CXCursor_FlagEnum
CXCursor_ConvergentAttr
CXCursor_WarnUnusedAttr
CXCursor_WarnUnusedResultAttr
CXCursor_AlignedAttr
CXCursor_LastAttr
CXCursor_PreprocessingDirective
CXCursor_MacroDefinition
CXCursor_MacroExpansion
CXCursor_MacroInstantiation
CXCursor_InclusionDirective
CXCursor_FirstPreprocessing
CXCursor_LastPreprocessing
CXCursor_ModuleImportDeclA module import declaration.
CXCursor_TypeAliasTemplateDecl
CXCursor_StaticAssertA static_assert or _Static_assert node
CXCursor_FriendDecla friend declaration.
CXCursor_FirstExtraDecl
CXCursor_LastExtraDecl
CXCursor_OverloadCandidateA code completion overload candidate.
Clang.LibClang.CXCursorVisitorType

Visitor invoked for each cursor found by a traversal.

This visitor function will be invoked for each cursor found by clang_visitCursorChildren(). Its first argument is the cursor being visited, its second argument is the parent visitor for that cursor, and its third argument is the client data provided to clang_visitCursorChildren().

The visitor should return one of the CXChildVisitResult values to direct clang_visitCursorChildren().

Clang.LibClang.CXCursor_ExceptionSpecificationKindType
CXCursor_ExceptionSpecificationKind

Describes the exception specification of a cursor.

A negative value indicates that the cursor is not a function declaration.

EnumeratorNote
CXCursor_ExceptionSpecificationKind_NoneThe cursor has no exception specification.
CXCursor_ExceptionSpecificationKind_DynamicNoneThe cursor has exception specification throw()
CXCursor_ExceptionSpecificationKind_DynamicThe cursor has exception specification throw(T1, T2)
CXCursor_ExceptionSpecificationKind_MSAnyThe cursor has exception specification throw(...).
CXCursor_ExceptionSpecificationKind_BasicNoexceptThe cursor has exception specification basic noexcept.
CXCursor_ExceptionSpecificationKind_ComputedNoexceptThe cursor has exception specification computed noexcept.
CXCursor_ExceptionSpecificationKind_UnevaluatedThe exception specification has not yet been evaluated.
CXCursor_ExceptionSpecificationKind_UninstantiatedThe exception specification has not yet been instantiated.
CXCursor_ExceptionSpecificationKind_UnparsedThe exception specification has not been parsed yet.
CXCursor_ExceptionSpecificationKind_NoThrowThe cursor has a __declspec(nothrow) exception specification.
Clang.LibClang.CXDiagnosticType

A single diagnostic, containing the diagnostic's severity, location, text, source ranges, and fix-it hints.

Clang.LibClang.CXDiagnosticDisplayOptionsType
CXDiagnosticDisplayOptions

Options to control the display of diagnostics.

The values in this enum are meant to be combined to customize the behavior of clang_formatDiagnostic().

EnumeratorNote
CXDiagnostic_DisplaySourceLocationDisplay 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, c++ test.c:28: warning: extra tokens at end of #endif directive This option corresponds to the clang flag -fshow-source-location.
CXDiagnostic_DisplayColumnIf displaying the source-location information of the diagnostic, also include the column number. This option corresponds to the clang flag -fshow-column.
CXDiagnostic_DisplaySourceRangesIf 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 -fdiagnostics-print-source-range-info.
CXDiagnostic_DisplayOptionDisplay 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 -fdiagnostics-show-option.
CXDiagnostic_DisplayCategoryIdDisplay 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 -fdiagnostics-show-category=id.
CXDiagnostic_DisplayCategoryNameDisplay 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 -fdiagnostics-show-category=name.
Clang.LibClang.CXDiagnosticSeverityType
CXDiagnosticSeverity

Describes the severity of a particular diagnostic.

EnumeratorNote
CXDiagnostic_IgnoredA diagnostic that has been suppressed, e.g., by a command-line option.
CXDiagnostic_NoteThis diagnostic is a note that should be attached to the previous (non-note) diagnostic.
CXDiagnostic_WarningThis diagnostic indicates suspicious code that may not be wrong.
CXDiagnostic_ErrorThis diagnostic indicates that the code is ill-formed.
CXDiagnostic_FatalThis diagnostic indicates that the code is ill-formed such that future parser recovery is unlikely to produce useful results.
Clang.LibClang.CXErrorCodeType
CXErrorCode

Error codes returned by libclang routines.

Zero (CXError_Success) is the only error code indicating success. Other error codes, including not yet assigned non-zero values, indicate errors.

EnumeratorNote
CXError_SuccessNo error.
CXError_FailureA generic error code, no further details are available. Errors of this kind can get their own specific error codes in future libclang versions.
CXError_Crashedlibclang crashed while performing the requested operation.
CXError_InvalidArgumentsThe function detected that the arguments violate the function contract.
CXError_ASTReadErrorAn AST deserialization error has occurred.
Clang.LibClang.CXGlobalOptFlagsType
CXGlobalOptFlags
EnumeratorNote
CXGlobalOpt_NoneUsed to indicate that no special CXIndex options are needed.
CXGlobalOpt_ThreadBackgroundPriorityForIndexingUsed to indicate that threads that libclang creates for indexing purposes should use background priority. Affects #clang_indexSourceFile, #clang_indexTranslationUnit, #clang_parseTranslationUnit, #clang_saveTranslationUnit.
CXGlobalOpt_ThreadBackgroundPriorityForEditingUsed to indicate that threads that libclang creates for editing purposes should use background priority. Affects #clang_reparseTranslationUnit, #clang_codeCompleteAt, #clang_annotateTokens
CXGlobalOpt_ThreadBackgroundPriorityForAllUsed to indicate that all threads that libclang creates should use background priority.
Clang.LibClang.CXIdxDeclInfoType
CXIdxDeclInfo
FieldNote
lexicalContainerGenerally same as #semanticContainer but can be different in cases like out-of-line C++ member functions.
isImplicitWhether the declaration exists in code or was created implicitly by the compiler, e.g. implicit Objective-C methods for properties.
Clang.LibClang.CXIdxEntityCXXTemplateKindType
CXIdxEntityCXXTemplateKind

Extra C++ template information for an entity. This can apply to: CXIdxEntity_Function CXIdxEntity_CXXClass CXIdxEntity_CXXStaticMethod CXIdxEntity_CXXInstanceMethod CXIdxEntity_CXXConstructor CXIdxEntity_CXXConversionFunction CXIdxEntity_CXXTypeAlias

Clang.LibClang.CXIdxEntityRefInfoType
CXIdxEntityRefInfo

Data for IndexerCallbacks#indexEntityReference.

FieldNote
cursorReference cursor.
referencedEntityThe entity that gets referenced.
parentEntityImmediate "parent" of the reference. For example: c++ Foo *var; The parent of reference of type 'Foo' is the variable 'var'. For references inside statement bodies of functions/methods, the parentEntity will be the function/method.
containerLexical container context of the reference.
roleSets of symbol roles of the reference.
Clang.LibClang.CXIdxEntityRefKindType
CXIdxEntityRefKind

Data for IndexerCallbacks#indexEntityReference.

This may be deprecated in a future version as this duplicates the CXSymbolRole_Implicit bit in CXSymbolRole.

EnumeratorNote
CXIdxEntityRef_DirectThe entity is referenced directly in user's code.
CXIdxEntityRef_ImplicitAn implicit reference, e.g. a reference of an Objective-C method via the dot syntax.
Clang.LibClang.CXIdxImportedASTFileInfoType
CXIdxImportedASTFileInfo

Data for IndexerCallbacks#importedASTFile.

FieldNote
fileTop level AST file containing the imported PCH, module or submodule.
moduleThe imported module or NULL if the AST file is a PCH.
locLocation where the file is imported. Applicable only for modules.
isImplicitNon-zero if an inclusion directive was automatically turned into a module import. Applicable only for modules.
Clang.LibClang.CXIdxIncludedFileInfoType
CXIdxIncludedFileInfo

Data for ppIncludedFile callback.

FieldNote
hashLocLocation of '#' in the #include/#import directive.
filenameFilename as written in the #include/#import directive.
fileThe actual file that the #include/#import directive resolved to.
isModuleImportNon-zero if the directive was automatically turned into a module import.
Clang.LibClang.CXInclusionVisitorType

Visitor invoked for each file in a translation unit (used with clang_getInclusions()).

This visitor function will be invoked by clang_getInclusions() for each file included (either at the top-level or by #include directives) within a translation unit. The first argument is the file being included, and the second and third arguments provide the inclusion stack. The array is sorted in order of immediate inclusion. For example, the first element refers to the location that included 'included_file'.

Clang.LibClang.CXIndexType

An "index" that consists of a set of translation units that would typically be linked together into an executable or library.

Clang.LibClang.CXIndexOptFlagsType
CXIndexOptFlags
EnumeratorNote
CXIndexOpt_NoneUsed to indicate that no special indexing options are needed.
CXIndexOpt_SuppressRedundantRefsUsed to indicate that IndexerCallbacks#indexEntityReference should be invoked for only one reference of an entity per source file that does not also include a declaration/definition of the entity.
CXIndexOpt_IndexFunctionLocalSymbolsFunction-local symbols should be indexed. If this is not set function-local symbols will be ignored.
CXIndexOpt_IndexImplicitTemplateInstantiationsImplicit function/class template instantiations should be indexed. If this is not set, implicit instantiations will be ignored.
CXIndexOpt_SuppressWarningsSuppress all compiler warnings when parsing for indexing.
CXIndexOpt_SkipParsedBodiesInSessionSkip a function/method body that was already parsed during an indexing session associated with a CXIndexAction object. Bodies in system headers are always skipped.
Clang.LibClang.CXLinkageKindType
CXLinkageKind

Describe the linkage of the entity referred to by a cursor.

EnumeratorNote
CXLinkage_InvalidThis value indicates that no linkage information is available for a provided CXCursor.
CXLinkage_NoLinkageThis is the linkage for variables, parameters, and so on that have automatic storage. This covers normal (non-extern) local variables.
CXLinkage_InternalThis is the linkage for static variables and static functions.
CXLinkage_UniqueExternalThis is the linkage for entities with external linkage that live in C++ anonymous namespaces.
CXLinkage_ExternalThis is the linkage for entities with true, external linkage.
Clang.LibClang.CXLoadDiag_ErrorType
CXLoadDiag_Error

Describes the kind of error that occurred (if any) in a call to clang_loadDiagnostics.

EnumeratorNote
CXLoadDiag_NoneIndicates that no error occurred.
CXLoadDiag_UnknownIndicates that an unknown error occurred while attempting to deserialize diagnostics.
CXLoadDiag_CannotLoadIndicates that the file containing the serialized diagnostics could not be opened.
CXLoadDiag_InvalidFileIndicates that the serialized diagnostics file is invalid or corrupt.
Clang.LibClang.CXModuleType

CINDEX_MODULE Module introspection

The functions in this group provide access to information about modules.

@{

Clang.LibClang.CXNameRefFlagsType
CXNameRefFlags
EnumeratorNote
CXNameRange_WantQualifierInclude the nested-name-specifier, e.g. Foo:: in x.Foo::y, in the range.
CXNameRange_WantTemplateArgsInclude the explicit template arguments, e.g. <int> in x.f<int>, in the range.
CXNameRange_WantSinglePieceIf the name is non-contiguous, return the full spanning range. Non-contiguous names occur in Objective-C when a selector with two or more parameters is used, or in C++ when using an operator: c++ [object doSomething:here withValue:there]; // Objective-C return some_vector[1]; // C++
Clang.LibClang.CXPlatformAvailabilityType
CXPlatformAvailability

Describes the availability of a given entity on a particular platform, e.g., a particular class might only be available on Mac OS 10.7 or newer.

FieldNote
PlatformA string that describes the platform for which this structure provides availability information. Possible values are "ios" or "macos".
IntroducedThe version number in which this entity was introduced.
DeprecatedThe version number in which this entity was deprecated (but is still available).
ObsoletedThe version number in which this entity was obsoleted, and therefore is no longer available.
UnavailableWhether the entity is unconditionally unavailable on this platform.
MessageAn optional message to provide to a user of this API, e.g., to suggest replacement APIs.
Clang.LibClang.CXRefQualifierKindType
CXRefQualifierKind
EnumeratorNote
CXRefQualifier_NoneNo ref-qualifier was provided.
CXRefQualifier_LValueAn lvalue ref-qualifier was provided (&).
CXRefQualifier_RValueAn rvalue ref-qualifier was provided (&&).
Clang.LibClang.CXReparse_FlagsType
CXReparse_Flags

Flags that control the reparsing of translation units.

The enumerators in this enumeration type are meant to be bitwise ORed together to specify which options should be used when reparsing the translation unit.

EnumeratorNote
CXReparse_NoneUsed to indicate that no special reparsing options are needed.
Clang.LibClang.CXResultType
CXResult
EnumeratorNote
CXResult_SuccessFunction returned successfully.
CXResult_InvalidOne of the parameters was invalid for the function.
CXResult_VisitBreakThe function was terminated by a callback (e.g. it returned CXVisit_Break)
Clang.LibClang.CXSaveErrorType
CXSaveError

Describes the kind of error that occurred (if any) in a call to clang_saveTranslationUnit().

EnumeratorNote
CXSaveError_NoneIndicates that no error occurred while saving a translation unit.
CXSaveError_UnknownIndicates that an unknown error occurred while attempting to save the file. This error typically indicates that file I/O failed when attempting to write the file.
CXSaveError_TranslationErrorsIndicates that errors during translation prevented this attempt to save the translation unit. Errors that prevent the translation unit from being saved can be extracted using clang_getNumDiagnostics() and clang_getDiagnostic().
CXSaveError_InvalidTUIndicates that the translation unit to be saved was somehow invalid (e.g., NULL).
Clang.LibClang.CXSaveTranslationUnit_FlagsType
CXSaveTranslationUnit_Flags

Flags that control how translation units are saved.

The enumerators in this enumeration type are meant to be bitwise ORed together to specify which options should be used when saving the translation unit.

EnumeratorNote
CXSaveTranslationUnit_NoneUsed to indicate that no special saving options are needed.
Clang.LibClang.CXSourceRangeListType
CXSourceRangeList

Identifies an array of ranges.

FieldNote
countThe number of ranges in the ranges array.
rangesAn array of CXSourceRanges.
Clang.LibClang.CXStringType
CXString

A character string.

The 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 clang_getCString() to retrieve the string data and, once finished with the string data, call clang_disposeString() to free the string.

Clang.LibClang.CXSymbolRoleType
CXSymbolRole

Roles that are attributed to symbol occurrences.

Internal: this currently mirrors low 9 bits of clang::index::SymbolRole with higher bits zeroed. These high bits may be exposed in the future.

Clang.LibClang.CXTLSKindType
CXTLSKind

Describe the "thread-local storage (TLS) kind" of the declaration referred to by a cursor.

Clang.LibClang.CXTemplateArgumentKindType
CXTemplateArgumentKind

Describes the kind of a template argument.

See the definition of llvm::clang::TemplateArgument::ArgKind for full element descriptions.

Clang.LibClang.CXTokenKindType
CXTokenKind

Describes a kind of token.

EnumeratorNote
CXToken_PunctuationA token that contains some kind of punctuation.
CXToken_KeywordA language keyword.
CXToken_IdentifierAn identifier (that is not a keyword).
CXToken_LiteralA numeric, string, or character literal.
CXToken_CommentA comment.
Clang.LibClang.CXTranslationUnit_FlagsType
CXTranslationUnit_Flags

Flags that control the creation of translation units.

The enumerators in this enumeration type are meant to be bitwise ORed together to specify which options should be used when constructing the translation unit.

EnumeratorNote
CXTranslationUnit_NoneUsed to indicate that no special translation-unit options are needed.
CXTranslationUnit_DetailedPreprocessingRecordUsed to indicate that the parser should construct a "detailed" preprocessing record, including all macro definitions and instantiations. Constructing a detailed preprocessing record requires more memory and time to parse, since the information contained in the record is usually not retained. However, it can be useful for applications that require more detailed information about the behavior of the preprocessor.
CXTranslationUnit_IncompleteUsed to indicate that the translation unit is incomplete. When a translation unit is considered "incomplete", semantic analysis that is typically performed at the end of the translation unit will be suppressed. For example, this suppresses the completion of tentative declarations in C and of instantiation of implicitly-instantiation function templates in C++. This option is typically used when parsing a header with the intent of producing a precompiled header.
CXTranslationUnit_PrecompiledPreambleUsed to indicate that the translation unit should be built with an implicit precompiled header for the preamble. An implicit precompiled header is used as an optimization when a particular translation unit is likely to be reparsed many times when the sources aren't changing that often. In this case, an implicit precompiled header will be built containing all of the initial includes at the top of the main file (what we refer to as the "preamble" of the file). In subsequent parses, if the preamble or the files in it have not changed, clang_reparseTranslationUnit() will re-use the implicit precompiled header to improve parsing performance.
CXTranslationUnit_CacheCompletionResultsUsed to indicate that the translation unit should cache some code-completion results with each reparse of the source file. Caching of code-completion results is a performance optimization that introduces some overhead to reparsing but improves the performance of code-completion operations.
CXTranslationUnit_ForSerializationUsed to indicate that the translation unit will be serialized with clang_saveTranslationUnit. This option is typically used when parsing a header with the intent of producing a precompiled header.
CXTranslationUnit_CXXChainedPCHDEPRECATED: Enabled chained precompiled preambles in C++. Note: this is a temporary option that is available only while we are testing C++ precompiled preamble support. It is deprecated.
CXTranslationUnit_SkipFunctionBodiesUsed to indicate that function/method bodies should be skipped while parsing. This option can be used to search for declarations/definitions while ignoring the usages.
CXTranslationUnit_IncludeBriefCommentsInCodeCompletionUsed to indicate that brief documentation comments should be included into the set of code completions returned from this translation unit.
CXTranslationUnit_CreatePreambleOnFirstParseUsed to indicate that the precompiled preamble should be created on the first parse. Otherwise it will be created on the first reparse. This trades runtime on the first parse (serializing the preamble takes time) for reduced runtime on the second parse (can now reuse the preamble).
CXTranslationUnit_KeepGoingDo not stop processing when fatal errors are encountered. When fatal errors are encountered while parsing a translation unit, semantic analysis is typically stopped early when compiling code. A common source for fatal errors are unresolvable include files. For the purposes of an IDE, this is undesirable behavior and as much information as possible should be reported. Use this flag to enable this behavior.
CXTranslationUnit_SingleFileParseSets the preprocessor in a mode for parsing a single file only.
CXTranslationUnit_LimitSkipFunctionBodiesToPreambleUsed in combination with CXTranslationUnit_SkipFunctionBodies to constrain the skipping of function bodies to the preamble. The function bodies of the main file are not skipped.
CXTranslationUnit_IncludeAttributedTypesUsed to indicate that attributed types should be included in CXType.
CXTranslationUnit_VisitImplicitAttributesUsed to indicate that implicit attributes should be visited.
CXTranslationUnit_IgnoreNonErrorsFromIncludedFilesUsed to indicate that non-errors from included files should be ignored. If set, clang_getDiagnosticSetFromTU() will not report e.g. warnings from included files anymore. This speeds up clang_getDiagnosticSetFromTU() for the case where these warnings are not of interest, as for an IDE for example, which typically shows only the diagnostics in the main file.
CXTranslationUnit_RetainExcludedConditionalBlocksTells the preprocessor not to skip excluded conditional blocks.
Clang.LibClang.CXTypeKindType
CXTypeKind

Describes the kind of type

EnumeratorNote
CXType_InvalidRepresents an invalid type (e.g., where no type is available).
CXType_UnexposedA type whose specific kind is not exposed via this interface.
CXType_Void
CXType_Bool
CXType_Char_U
CXType_UChar
CXType_Char16
CXType_Char32
CXType_UShort
CXType_UInt
CXType_ULong
CXType_ULongLong
CXType_UInt128
CXType_Char_S
CXType_SChar
CXType_WChar
CXType_Short
CXType_Int
CXType_Long
CXType_LongLong
CXType_Int128
CXType_Float
CXType_Double
CXType_LongDouble
CXType_NullPtr
CXType_Overload
CXType_Dependent
CXType_ObjCId
CXType_ObjCClass
CXType_ObjCSel
CXType_Float128
CXType_Half
CXType_Float16
CXType_ShortAccum
CXType_Accum
CXType_LongAccum
CXType_UShortAccum
CXType_UAccum
CXType_ULongAccum
CXType_BFloat16
CXType_Ibm128
CXType_FirstBuiltin
CXType_LastBuiltin
CXType_Complex
CXType_Pointer
CXType_BlockPointer
CXType_LValueReference
CXType_RValueReference
CXType_Record
CXType_Enum
CXType_Typedef
CXType_ObjCInterface
CXType_ObjCObjectPointer
CXType_FunctionNoProto
CXType_FunctionProto
CXType_ConstantArray
CXType_Vector
CXType_IncompleteArray
CXType_VariableArray
CXType_DependentSizedArray
CXType_MemberPointer
CXType_Auto
CXType_ElaboratedRepresents a type that was referred to using an elaborated type keyword. E.g., struct S, or via a qualified name, e.g., N::M::type, or both.
CXType_Pipe
CXType_OCLImage1dRO
CXType_OCLImage1dArrayRO
CXType_OCLImage1dBufferRO
CXType_OCLImage2dRO
CXType_OCLImage2dArrayRO
CXType_OCLImage2dDepthRO
CXType_OCLImage2dArrayDepthRO
CXType_OCLImage2dMSAARO
CXType_OCLImage2dArrayMSAARO
CXType_OCLImage2dMSAADepthRO
CXType_OCLImage2dArrayMSAADepthRO
CXType_OCLImage3dRO
CXType_OCLImage1dWO
CXType_OCLImage1dArrayWO
CXType_OCLImage1dBufferWO
CXType_OCLImage2dWO
CXType_OCLImage2dArrayWO
CXType_OCLImage2dDepthWO
CXType_OCLImage2dArrayDepthWO
CXType_OCLImage2dMSAAWO
CXType_OCLImage2dArrayMSAAWO
CXType_OCLImage2dMSAADepthWO
CXType_OCLImage2dArrayMSAADepthWO
CXType_OCLImage3dWO
CXType_OCLImage1dRW
CXType_OCLImage1dArrayRW
CXType_OCLImage1dBufferRW
CXType_OCLImage2dRW
CXType_OCLImage2dArrayRW
CXType_OCLImage2dDepthRW
CXType_OCLImage2dArrayDepthRW
CXType_OCLImage2dMSAARW
CXType_OCLImage2dArrayMSAARW
CXType_OCLImage2dMSAADepthRW
CXType_OCLImage2dArrayMSAADepthRW
CXType_OCLImage3dRW
CXType_OCLSampler
CXType_OCLEvent
CXType_OCLQueue
CXType_OCLReserveID
CXType_ObjCObject
CXType_ObjCTypeParam
CXType_Attributed
CXType_OCLIntelSubgroupAVCMcePayload
CXType_OCLIntelSubgroupAVCImePayload
CXType_OCLIntelSubgroupAVCRefPayload
CXType_OCLIntelSubgroupAVCSicPayload
CXType_OCLIntelSubgroupAVCMceResult
CXType_OCLIntelSubgroupAVCImeResult
CXType_OCLIntelSubgroupAVCRefResult
CXType_OCLIntelSubgroupAVCSicResult
CXType_OCLIntelSubgroupAVCImeResultSingleRefStreamout
CXType_OCLIntelSubgroupAVCImeResultDualRefStreamout
CXType_OCLIntelSubgroupAVCImeSingleRefStreamin
CXType_OCLIntelSubgroupAVCImeDualRefStreamin
CXType_ExtVector
CXType_Atomic
Clang.LibClang.CXTypeLayoutErrorType
CXTypeLayoutError

List the possible error codes for clang_Type_getSizeOf, clang_Type_getAlignOf, clang_Type_getOffsetOf and clang_Cursor_getOffsetOf.

A value of this enumeration type can be returned if the target type is not a valid argument to sizeof, alignof or offsetof.

EnumeratorNote
CXTypeLayoutError_InvalidType is of kind CXType_Invalid.
CXTypeLayoutError_IncompleteThe type is an incomplete Type.
CXTypeLayoutError_DependentThe type is a dependent Type.
CXTypeLayoutError_NotConstantSizeThe type is not a constant size type.
CXTypeLayoutError_InvalidFieldNameThe Field name is not valid for this record.
CXTypeLayoutError_UndeducedThe type is undeduced.
Clang.LibClang.CXTypeNullabilityKindType
CXTypeNullabilityKind
EnumeratorNote
CXTypeNullability_NonNullValues of this type can never be null.
CXTypeNullability_NullableValues of this type can be null.
CXTypeNullability_UnspecifiedWhether values of this type can be null is (explicitly) unspecified. This captures a (fairly rare) case where we can't conclude anything about the nullability of the type even though it has been considered.
CXTypeNullability_InvalidNullability is not applicable to this type.
CXTypeNullability_NullableResultGenerally behaves like Nullable, except when used in a block parameter that was imported into a swift async method. There, swift will assume that the parameter can get null even if no error occured. _Nullable parameters are assumed to only get null on error.
Clang.LibClang.CXUnsavedFileType
CXUnsavedFile

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.

FieldNote
FilenameThe file whose contents have not yet been saved. This file must already exist in the file system.
ContentsA buffer containing the unsaved contents of this file.
LengthThe length of the unsaved contents of this buffer.
Clang.LibClang.CXVersionType
CXVersion

Describes a version number of the form major.minor.subminor.

FieldNote
MajorThe major version number, e.g., the '10' in '10.7.3'. A negative value indicates that there is no version number at all.
MinorThe 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'.
SubminorThe 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'.
Clang.LibClang.CXVisibilityKindType
CXVisibilityKind
EnumeratorNote
CXVisibility_InvalidThis value indicates that no visibility information is available for a provided CXCursor.
CXVisibility_HiddenSymbol not seen by the linker.
CXVisibility_ProtectedSymbol seen by the linker but resolves to a symbol inside this object.
CXVisibility_DefaultSymbol seen by the linker and acts like a normal symbol.
Clang.LibClang.CX_StorageClassType
CX_StorageClass

Represents the storage classes as declared in the source. CX_SC_Invalid was added for the case that the passed cursor in not a declaration.

Clang.LibClang.IndexerCallbacksType
IndexerCallbacks

A group of callbacks used by #clang_indexSourceFile and #clang_indexTranslationUnit.

FieldNote
abortQueryCalled periodically to check whether indexing should be aborted. Should return 0 to continue, and non-zero to abort.
diagnosticCalled at the end of indexing; passes the complete diagnostic set.
ppIncludedFileCalled when a file gets #included/#imported.
importedASTFileCalled when a AST file (PCH or module) gets imported. AST files will not get indexed (there will not be callbacks to index all the entities in an AST file). The recommended action is that, if the AST file is not already indexed, to initiate a new indexing job specific to the AST file.
startedTranslationUnitCalled at the beginning of indexing a translation unit.
indexEntityReferenceCalled to index a reference of an entity.