Clang API Reference
Clang._cxstring_to_string — MethodFree and convert a CXString to String. Note this function will free the given CXString so ensure it is not called twice.
Clang.annotateTokens — MethodannotateTokens(tu::TranslationUnit, tokens, token_num, 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.
Clang.ast_file — Methodast_file(mod::CLModule) -> CLFileGiven a module, return the module file where the provided module object came from.
Clang.children — Methodchildren(cursor::CXCursor) -> Vector{CXCursor}
children(cursor::CLCursor) -> Vector{CLCursor}Return immediate cursors of the given cursor.
Clang.fields — Methodfields(ty::CXType) -> Vector{CXCursor}
fields(ty::CLType) -> Vector{CLCursor}Return a child cursor vector of the given cursor.
Clang.file — Methodfile(c::CLCursor) -> CLFileReturn the file referenced by the input cursor.
Clang.file_line_column — Methodfile_line_column(CLCursor) -> (CLFile, Int, Int)Return file, line and column number.
Clang.full_name — Methodfull_name(mod::CLModule)Given a module, return the full name of the module, e.g. "std.vector".
Clang.getAddressSpace — MethodgetAddressSpace(t::Union{CXType,CLType})Returns the address space of the given type. Wrapper for libclang's clang_getAddressSpace.
Clang.getAlignOf — MethodgetAlignOf(t::CXType) -> Int
getAlignOf(t::CLType) -> IntReturn the alignment of a type in bytes as per C++[expr.alignof] standard.
It returns a minus number for layout errors, please convert the result to a CXTypeLayoutError to see what the error is.
Clang.getArgType — MethodgetArgType(t::CXType, i::Unsigned) -> CXType
getArgType(t::Union{CLFunctionNoProto,CLFunctionProto}, i::Integer) -> CLTypeReturn the type of a parameter of a function type. Wrapper for libclang's clang_getArgType.
Clang.getArgument — MethodgetArgument(c::CXCursor, i::Integer) -> CXCursor
getArgument(c::Union{CLFunctionDecl,CLCXXMethod,CLConstructor,CLFunctionTemplate}, i::Integer) -> CLCursorReturn the argument cursor of a function or method.
Clang.getArguments — MethodgetArguments(c::Union{BlockCommand, InlineCommand}) -> Vector{String}Return the arguments of a command.
Clang.getAsHTML — MethodgetAsHTML(c::Union{CXComment, FullComment})Convert a comment into an HTML fragment. Check libclang's documentation for more details.
Clang.getAsString — MethodgetAsString(c::Union{CXComment, HTMLStartTag, HTMLEndTag})Convert an HTML tag to its string representation.
Clang.getAsXML — MethodgetAsXML(c::Union{CXComment, FullComment})Convert a comment into an XML document.
Clang.getAttributes — MethodgetAttributes(c::Union{CXComment, HTMLStartTag}) -> Vector{Pair{String, String}}Return the attributes of an HTML tag.
Clang.getCanonicalCursor — MethodgetCanonicalCursor(c::CXCursor) -> CXCursor
getCanonicalCursor(c::CLCursor) -> CLCursorReturn the getCanonicalCursor cursor corresponding to the given cursor.
Clang.getCanonicalType — MethodgetCanonicalType(t::CXType) -> CXType
getCanonicalType(t::CLType) -> CLTypeReturn 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'. Wrapper for libclang's clang_getCanonicalType.
Clang.getCommandName — MethodgetCommandName(c::InlineCommand) -> String
getCommandName(c::BlockCommand) -> StringReturn the command name of a command, e.g. "brief" for \brief blah.
Clang.getCompileCommands — MethodgetCompileCommands(db::CLCompilationDatabase, file::AbstractString)Get all compile commands for a file given its complete path.
Clang.getCompileCommands — MethodgetCompileCommands(db::CLCompilationDatabase)Get all compile commands from a compilation database.
Clang.getCursorDefinition — MethodgetCursorDefinition(c::CXCursor) -> CXCursor
getCursorDefinition(c::CLCursor) -> CLCursorFor a cursor that is either a reference to or a declaration of some entity, retrieve a cursor that describes the definition of that entity.
Clang.getCursorExtent — MethodgetCursorExtent(c::Union{CXCursor,CLCursor}) -> CXSourceRangeReturn 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.getCursorLanguage — MethodgetCursorLanguage(c::Union{CXCursor,CLCursor}) -> CXLanguageKindReturn the language of the entity referred to by a given cursor. Return CXLanguage_Invalid if the input cursor is not a decl. Note that, this function has limitations, for example, it cannot distinguish C++ structs from C structs, in both cases, it returns CXLanguage_C.
Clang.getCursorLexicalParent — MethodgetCursorLexicalParent(c::CXCursor) -> CXCursor
getCursorLexicalParent(c::CLCursor) -> CLCursorReturn the lexical parent of the given cursor. Please checkout libclang's doc to know more.
Clang.getCursorLinkage — MethodgetCursorLinkage(c::Union{CXCursor,CLCursor}) -> CXLinkageKindReturn the linkage of the entity referred to by a given cursor.
Clang.getCursorLocation — MethodgetCursorLocation(c::Union{CXCursor,CLCursor}) -> CXSourceLocationReturn the physical location of the source constructor referenced by the given cursor.
Clang.getCursorReferenced — MethodgetCursorReferenced(c::CXCursor) -> CXCursor
getCursorReferenced(c::CLCursor) -> CLCursorFor a cursor that is a reference, retrieve a cursor representing the entity that it references.
Clang.getCursorResultType — MethodgetCursorResultType(c::CXCursor) -> CXType
getCursorResultType(c::Union{CLFunctionDecl,CLCXXMethod}) -> CLTypeReturn the return type associated with a given cursor. This only returns a valid type if the cursor refers to a function or method.
Clang.getCursorResultType — MethodgetCursorResultType(t::CXType) -> CXType
getCursorResultType(t::Union{CLFunctionNoProto,CLFunctionProto}) -> CLTypeReturn the return type associated with a function type. Wrapper for libclang's clang_getResultType.
Clang.getCursorSemanticParent — MethodgetCursorSemanticParent(c::CXCursor) -> CXCursor
getCursorSemanticParent(c::CLCursor) -> CLCursorReturn the semantic parent of the given cursor. Please checkout libclang's doc to know more.
Clang.getCursorType — MethodgetCursorType(c::CXCursor) -> CXType
getCursorType(c::CLCursor) -> CLTypeReturn the type of a CXCursor (if any). To get the cursor from a type, see getTypeDeclaration.
Clang.getDeclObjCTypeEncoding — MethodgetDeclObjCTypeEncoding(C::CXCursor)::CXString
getDeclObjCTypeEncoding(C::CLCursor)::StringReturns the Objective-C type encoding for the specified declaration. Wrapper for libclang's clang_getDeclObjCTypeEncoding.
Clang.getDirection — MethodgetDirection(c::Union{CXComment, ParamCommand})Return the parameter passing direction ([in], [out], [in,out]) or missing if the direction is not specified.
Clang.getElementType — MethodgetElementType(t::CXType) -> CXType
getElementType(t::Union{CLVector,CLConstantArray,CLIncompleteArray,CLVariableArray,CLDependentSizedArray,CLComplex}) -> CLTypeReturn the element type of an array, complex, or vector type. Wrapper for libclang's clang_getElementType.
Clang.getEnumDeclIntegerType — MethodgetEnumDeclIntegerType(c::CLEnumDecl) -> CLTypeRetrieve the integer type of an enum declaration.
Clang.getFieldDeclBitWidth — MethodgetFieldDeclBitWidth(c::CLFieldDecl) -> IntReturn the bit width of a bit field declaration as an integer.
Clang.getFunctionTypeCallingConv — MethodgetFunctionTypeCallingConv(t::Union{CXType,CLFunctionNoProto,CLFunctionProto}) -> CXCallingConvReturn the calling convention associated with a function type. Wrapper for libclang's clang_getFunctionTypeCallingConv.
Clang.getIncludedFile — MethodgetIncludedFile(c::Union{CXCursor,CLCursor}) -> CXFileReturn the file that is included by the given inclusion directive cursor.
Clang.getIndex — MethodgetIndex(c::Union{CXComment, ParamCommand})Return zero-based parameter index in function prototype or missing if the parameter is invalid.
Clang.getNamedType — MethodgetNamedType(t::CXType) -> CXType
getNamedType(t::CLElaborated) -> CLTypeReturn the type named by the qualified-id. Wrapper for libclang's clang_Type_getNamedType.
Clang.getNullCursor — MethodgetNullCursor() -> CXCursorReturn the "NULL" CXCursor.
Clang.getNumArguments — MethodgetNumArguments(t::Union{CXType,CLFunctionNoProto,CLFunctionProto}) -> IntReturn the number of non-variadic parameters associated with a function type. Wrapper for libclang's clang_getNumArgTypes.
Clang.getNumArguments — MethodgetNumArguments(c::Union{CXCursor,CLCursor}) -> IntReturn the number of non-variadic arguments associated with a given cursor.
Clang.getNumElements — MethodgetNumElements(t::Union{CXType,CLVector,CLConstantArray,CLIncompleteArray,CLVariableArray,CLDependentSizedArray}) -> IntReturn the number of elements of an array or vector type. Wrapper for libclang's clang_getNumElements.
Clang.getNumObjCProtocolRefs — MethodgetNumObjCProtocolRefs(T::Union{CXType, CLType})::CuintRetrieve the number of protocol references associated with an ObjC object/id.
If the type is not an ObjC object, 0 is returned.
Clang.getNumObjCTypeArgs — MethodgetNumObjCTypeArgs(T::Union{CXType, CLType})::CuintRetrieve the number of type arguments associated with an ObjC object.
If the type is not an ObjC object, 0 is returned.
Clang.getObjCEncoding — MethodgetObjCEncoding(T::CXType) -> String
getObjCEncoding(T::CLType) -> StringReturns the Objective-C type encoding for the specified Type. Wrapper for libclang's clang_Type_getObjCEncoding.
Clang.getObjCObjectBaseType — MethodgetObjCObjectBaseType(T::CXType) -> CXType
getObjCObjectBaseType(T::CLType) -> CLTypeRetrieves the base type of the ObjCObjectType. If the type is not an ObjC object, an invalid type is returned. Wrapper for libclang's clang_Type_getObjCObjectBaseType.
Clang.getObjCPropertyAttributes — FunctiongetObjCPropertyAttributes(c, reserved)::CuintGiven a cursor that represents a property declaration, return the associated property attributes. The bits are formed from CXObjCPropertyAttrKind.
Arguments
reserved: Reserved for future use, pass 0.
Clang.getObjCPropertyGetterName — MethodgetObjCPropertyGetterName(C)::StringGiven a cursor that represents a property declaration, return the name of the method that implements the getter.
Clang.getObjCPropertySetterName — MethodgetObjCPropertySetterName(c)::StringGiven a cursor that represents a property declaration, return the name of the method that implements the setter, if any.
Clang.getObjCProtocolDecl — MethodgetObjCProtocolDecl(T::CXType, i) -> CLCursor
getObjCProtocolDecl(T::CLType, i) -> CXCursorRetrieve 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.getObjCTypeArg — MethodgetObjCTypeArg(T::CXType, i) -> CXType
getObjCTypeArg(T::CLType, i) -> CLTypeRetrieve 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.getOffsetOf — MethodgetOffsetOf(t::CXType, s) -> Int
getOffsetOf(t::CLType, s::AbstractString) -> IntReturn 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].
It returns a minus number for layout errors, please convert the result to a CXTypeLayoutError to see what the error is.
Clang.getOffsetOfField — MethodgetOffsetOfField(c::Union{CXCursor,CLCursor}) -> IntReturn the offset of the field represented by the cursor in bits as it would be returned by offsetof as per C++11[18.2p4]. It returns a minus number for layout errors, please convert the result to a CXTypeLayoutError to see what the error is.
Clang.getParagraph — MethodgetParagraph(c::CXComment)
getParagraph(c::BlockCommand)Return the paragraph argument of a given command.
Clang.getParamName — MethodgetParamName(c::ParamCommand) -> StringReturn the name of a parameter.
Clang.getParsedComment — MethodgetParsedComment(c::CXCursor) -> CXComment
getParsedComment(c::CLCursor) -> CLCommentReturn the parsed AST of doxygen comment associated with the given node.
Clang.getPointeeType — MethodgetPointeeType(t::CXType) -> CXType
getPointeeType(t::CLType) -> CLTypeReturn the type of the pointee for pointer types. Wrapper for libclang's clang_getPointeeType.
Clang.getRenderKind — MethodgetRenderKind(c::Union{CXComment, InlineCommand}) -> CXCommentInlineCommandRenderKindReturn the most appropriate rendering mode, chosen on command semantics in Doxygen.
Clang.getSizeOf — MethodgetSizeOf(t::CXType) -> Int
getSizeOf(t::CLType) -> IntReturn the size of a type in bytes as per C++[expr.sizeof] standard,
It returns a minus number for layout errors, please convert the result to a CXTypeLayoutError to see what the error is.
Clang.getSourceCode — MethodgetSourceCode(cursor::Union{CXCursor, CLCursor}) -> StringGet source code for the cursor.
Clang.getTagName — MethodgetTagName(c::Union{CXComment, HTMLStartTag, HTMLEndTag})Return the tag name of a HTML tag.
Clang.getText — MethodgetText(c::Text) -> String
getText(c::VerbatimBlockLine) -> String
getText(c::VerbatimLine) -> StringGet the text content assiciated with the node.
Clang.getTokenExtent — MethodgetTokenExtent(tu::Union{CXTranslationUnit,TranslationUnit}, t::Union{CXToken,CLToken}) -> CXSourceRangeReturn a source range that covers the given token.
Clang.getTokenLocation — MethodgetTokenLocation(tu::Union{CXTranslationUnit,TranslationUnit}, t::Union{CXToken,CLToken}) -> CXSourceLocationReturn the source location of the given token.
Clang.getTranslationUnit — MethodgetTranslationUnit(c::Union{CXCursor,CLCursor}) -> CXTranslationUnitReturns the translation unit that a cursor originated from.
Clang.getTranslationUnitCursor — MethodgetTranslationUnitCursor(tu::TranslationUnit) -> CLCursor
getTranslationUnitCursor(tu::CXTranslationUnit) -> CXCursorReturn the cursor that represents the given translation unit.
Clang.getTypeDeclaration — MethodgetTypeDeclaration(t::CXType) -> CXCursor
getTypeDeclaration(t::CLType) -> CLCursorReturn the cursor for the declaration of the given type. To get the type of the cursor, see getCursorType. Wrapper for libclang's clang_getTypeDeclaration.
Clang.getTypedefDeclUnderlyingType — MethodgetTypedefDeclUnderlyingType(c::CLTypedefDecl) -> CLTypeReturn the underlying type of a typedef declaration.
Clang.getTypedefName — MethodgetTypedefName(t::Union{CXType,CLType}) -> StringReturn the typedef name of the given type. Wrapper for libclang's clang_getTypedefName.
Clang.get_elaborated_cursor — Methodget_elaborated_cursor(ty::CLType) -> CLCursor
get_elaborated_cursor(ty::CXType) -> CXCursorReturn the cursor of the elaborated type that is referenced by the input type. The input type can be a pointer/array. This function returns clang_getNullCursor if the input type is not refer to an elaborated type.
Clang.get_file_line_column — Methodget_file_line_column(c::Union{CXCursor,CLCursor}) -> (String, Int, Int)Return file name, line and column number.
Clang.get_filename — Methodget_filename(file::CXFile) -> StringReturn the complete file and path name of the given file.
Clang.get_filename — Methodget_filename(c::Union{CXCursor,CLCursor}) -> StringReturn the complete file and path name of the given file referenced by the input cursor.
Clang.get_function_args — Methodget_function_args(cursor::CLCursor) -> Vector{CLCursor}Return function arguments for a given cursor.
Clang.get_module — Methodget_module(tu::TranslationUnit, file::CLFile) -> CLModuleGiven a CLFile header file, return the module that contains it, if one exists.
Clang.hasAttrs — MethodhasAttrs(c::Union{CXCursor,CLCursor}) -> BoolDetermine whether the given cursor has any attributes.
Clang.has_elaborated_reference — Methodhas_elaborated_reference(ty::CLType) -> Bool
has_elaborated_reference(ty::CXType) -> BoolReturn true if the type is an elaborated type or the type indirectly refers to an elaborated type.
Clang.has_elaborated_tag_reference — Methodhas_elaborated_tag_reference(ty::CLType) -> Bool
has_elaborated_tag_reference(ty::CXType) -> BoolReturn true if the type is an elaborated tag type or the type indirectly refers to an elaborated tag type.
Clang.has_function_reference — Methodhas_function_reference(ty::CLType) -> Bool
has_function_reference(ty::CXType) -> BoolReturn true if the type is a function or the type indirectly refers to a function.
Clang.isAnonymous — MethodisAnonymous(c::Union{CXCursor,CLCursor}) -> BoolReturn true if the given cursor represents an anonymous record declaration(C++).
Clang.isAttribute — MethodisAttribute(k::CXcursorKind) -> Bool
isAttribute(c::CLCursor) -> BoolReturn true if the given cursor kind represents an attribute.
Clang.isBitField — MethodisBitField(c::Union{CXCursor,CLCursor}) -> BoolReturn true if the cursor specifies a Record member that is a bitfield.
Clang.isConstQualifiedType — MethodisConstQualifiedType(t::Union{CXType,CLType}) -> BoolDetermine whether a CXType has the "const" qualifier set, without looking through typedefs that may have added "const" at a different level. Wrapper for libclang's clang_isConstQualifiedType.
Clang.isCursorDefinition — MethodisCursorDefinition(c::Union{CXCursor,CLCursor}) -> BoolReturn true if the declaration pointed to by this cursor is also a definition of that entity.
Clang.isDeclaration — MethodisDeclaration(k::CXcursorKind) -> Bool
isDeclaration(c::CLCursor) -> BoolReturn true if the given cursor kind represents a declaration.
Clang.isExpression — MethodisExpression(k::CXcursorKind) -> Bool
isExpression(c::CLCursor) -> BoolReturn true if the given cursor kind represents an expression.
Clang.isFunctionInlined — MethodisFunctionInlined(c::Union{CXCursor,CLCursor}) -> BoolDetermine whether a CXCursor that is a function declaration, is an inline declaration.
Clang.isInvalid — MethodisInvalid(k::CXcursorKind) -> Bool
isInvalid(c::CLCursor) -> BoolReturn true if the given cursor kind represents an valid cursor.
Clang.isInvalid — MethodisInvalid(t::CXType) -> Bool
isInvalid(t::CLType) -> BoolReturn true if the type is a valid type.
Clang.isInvalidDeclaration — MethodisInvalidDeclaration(x::CXcursorKind) -> BoolReturn true if the given declaration is invalid. A declaration is invalid if it could not be parsed successfully.
Clang.isMacroBuiltin — MethodisMacroBuiltin(c::Union{CXCursor,CLCursor}) -> BoolDetermine whether a CXCursor that is a macro, is a builtin one.
Clang.isMacroFunctionLike — MethodisMacroFunctionLike(c::Union{CXCursor,CLCursor}) -> BoolDetermine whether a CXCursor that is a macro, is function like.
Clang.isNull — MethodisNull(c::Union{CXCursor,CLCursor}) -> BoolReturn true if cursor is null.
Clang.isPODType — MethodisPODType(t::Union{CXType,CLType}) -> BoolReturn true if the CXType is a plain old data type. Wrapper for libclang's clang_isPODType.
Clang.isPreprocessing — MethodisPreprocessing(k::CXcursorKind) -> Bool
isPreprocessing(c::CLCursor) -> BoolReturn true if the given cursor kind represents a preprocessing element, such as a preprocessor directive or macro instantiation.
Clang.isReference — MethodisReference(k::CXcursorKind) -> Bool
isReference(c::CLCursor) -> BoolReturn true if the given cursor kind represents a simple reference. Note that other kinds of cursors (such as expressions) can also refer to other cursors. Use getCursorReferenced to determine whether a particular cursor refers to another entity.
Clang.isRestrictQualifiedType — MethodisRestrictQualifiedType(t::Union{CXType,CLType}) -> BoolDetermine whether a CXType has the "restrict" qualifier set, without looking through typedefs that may have added "restrict" at a different level. Wrapper for libclang's clang_isRestrictQualifiedType.
Clang.isSelfClosing — MethodisSelfClosing(c::Union{CXComment, HTMLStartTag})Return whether a tag is self-closing (for example, <br />).
Clang.isStatement — MethodisStatement(k::CXcursorKind) -> Bool
isStatement(c::CLCursor) -> BoolReturn true if the given cursor kind represents a statement.
Clang.isTranslationUnit — MethodisTranslationUnit(k::CXcursorKind) -> Bool
isTranslationUnit(c::CLCursor) -> BoolReturn true if the given cursor kind represents a translation unit.
Clang.isUnexposed — MethodisUnexposed(k::CXcursorKind) -> BoolReturn true if the given cursor kind represents a currently unexposed piece of the AST (e.g., CXCursor_UnexposedStmt).
Clang.isVariadic — MethodisVariadic(c::Union{CXCursor,CLCursor}) -> BoolReturn true if the given cursor is a variadic function or method.
Clang.isVariadic — MethodisVariadic(t::Union{CXType,CLType}) -> BoolReturn true if the CXType is a variadic function type. Wrapper for libclang's clang_isFunctionTypeVariadic.
Clang.isVirtualBase — MethodisVirtualBase(c::Union{CXCursor,CLCursor}) -> BoolReturn true if the base class specified by the cursor with kind CX_CXXBaseSpecifier is virtual.
Clang.isVolatileQualifiedType — MethodisVolatileQualifiedType(t::Union{CXType,CLType}) -> BoolDetermine whether a CXType has the "volatile" qualifier set, without looking through typedefs that may have added "volatile" at a different level. Wrapper for libclang's clang_isVolatileQualifiedType.
Clang.isWhiteSpace — MethodisWhiteSpace(c::Union{CXComment, CLComment}) -> BoolReturn whether a CXParagraph or CXText is contains only white space. Return false for other kinds of comment.
Clang.is_forward_declaration — Methodis_forward_declaration(x::CLCursor) -> BoolReturn true if the cursor is a forward declaration. Reference: https://joshpeterson.github.io/identifying-a-forward-declaration-with-libclang
Clang.is_inclusion_directive — Methodis_inclusion_directive(x::CLCursor) -> BoolReturn true if the cursor is an inclusion directive.
Clang.is_system — Methodis_system(mod::CLModule)Given a module, return whether it is a system one.
Clang.is_typedef_anon — Methodis_typedef_anon(current::CLCursor, next::CLCursor) -> BoolReturn true if the current cursor is a typedef anonymous struct/enum.
Clang.kind — Methodkind(c::CLCursor) -> CXCursorKindReturn the kind of the given cursor. Note this method directly reads CXCursor's kind field, which won't invoke additional clang_getCursorKind function calls.
Clang.kind — Methodkind(c::Union{CXComment, CXComment}) -> CXCommentKindReturn the kind of a comment.
Clang.kind — Methodkind(c::CXCursor) -> CXCursorKindReturn the kind of the given cursor.
Clang.kind — Methodkind(t::CXToken) -> CXTokenKind
kind(t::CLToken) -> CXTokenKindReturn the kind of the given token.
Clang.kind — Methodkind(t::CXType) -> CXTypeKind
kind(t::CLType) -> CXTypeKindReturn the kind of the given type.
Clang.name — Methodname(file::CLFile) -> StringReturn the complete file and path name of the given file.
Clang.name — Methodname(mod::CLModule)Given a module, return the name of the module, e.g. for the 'std.vector' sub-module it will return "vector".
Clang.name — Methodname(c::Union{CXCursor,CLCursor}) -> StringReturn the display name for the entity referenced by this cursor.
Clang.parent_module — Methodparent_module(mod::CLModule) -> CLModuleGiven a module, return 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.parse_header — Functionparse_header(
index::Index,
header::AbstractString,
args::Vector{String}=[],
flags=CXTranslationUnit_None,
) -> TranslationUnitReturn the TranslationUnit for a given header. This is the main entry point for parsing.
Arguments
header::AbstractString: the header file to parse.index::Index: CXIndex pointer (pass to avoid re-allocation).args::Vector{String}: compiler switches as string array, eg: ["-x", "c++", "-fno-elide-type"].flags: bitwise OR of CXTranslationUnit_Flags.
Consider using parse_header(::Function) to ensure that the TranslationUnit is kept alive while in use.
See also parse_headers.
Clang.parse_header — Methodparse_header(f::Function, ...)Do-method wrapper around parse_header(::Index) that will ensure that the TranslationUnit object stays alive while f() is running, e.g.:
index = Index()
parse_header(index, "foo.h") do tu
@show length(children(tu))
endClang.parse_headers — Functionparse_headers(
index::Index,
headers::Vector{String},
args::Vector{String}=[],
flags=CXTranslationUnit_None,
) -> Vector{TranslationUnit}Return a TranslationUnit vector for the given headers.
Consider using parse_headers(::Function) to ensure that the TranslationUnit's are kept alive while in use.
See also parse_header.
Clang.parse_headers — Methodparse_headers(f::Function, ...)Do-method wrapper around parse_headers(::Index) that will ensure that all the TranslationUnit objects stays alive while f() is running, e.g.:
index = Index()
parse_headers(index, ["foo.h", "bar.h"]) do tus
@show length(tus)
endClang.remove_ranges — MethodRemove FirstXX and LastXX from enumerations.
Clang.search — Methodsearch(cursors::Vector{CLCursor}, ismatch::Function) -> Vector{CLCursor}Return vector of CLCursors that match predicate. ismatch is a function that accepts a CLCursor argument.
Clang.spelling — Methodspelling(kind::CXTypeKind) -> StringReturn the spelling of a given CXTypeKind.
Clang.spelling — Methodspelling(tu::TranslationUnit, t::CLToken) -> String
spelling(tu::TranslationUnit, t::CXToken) -> String
spelling(tu::CXTranslationUnit, t::CXToken) -> StringReturn 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.spelling — Methodspelling(tu::TranslationUnit) -> StringReturn the original translation unit source file name.
Clang.spelling — Methodspelling(c::Union{CXCursor,CLCursor}) -> StringReturn a name for the entity referenced by this cursor.
Clang.spelling — Methodspelling(t::Union{CXType,CLType}) -> StringPretty-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. Wrapper for libclang's clang_getTypeSpelling.
Clang.tokenize — Methodtokenize(c::Union{CXCursor,CLCursor}) -> TokenListReturn a TokenList from the given cursor.
Clang.toplevel_headers — Methodtoplevel_headers(tu::TranslationUnit, mod::CLModule)Given a module, return all top level headers associated with the module.
Clang.unique_id — Methodunique_id(file::CLFile) -> CXFileUniqueIDReturn the unique id of the given file.
Clang.value — Methodvalue(c::CLCursor) -> IntegerReturn the integer value of an enum constant declaration.
Clang.CLCompilationDatabase — MethodCLCompilationDatabase(path::AbstractString)Creates a compilation database from the database found in directory path.
Clang.CLCompileCommand — TypeCLCompileCommandRepresents a command to compile the specific file. Call getDirection, getArguments and getArguments to get its attributes.
Clang.Index — TypeIndex(exclude_decls_from_PCH, display_diagnostics)Provide a shared context for creating translation units.
Arguments
exclude_decls_from_PCH: whether we only want to see "local" declarations (that did not come from a previous precompiled header). If false, we want to see all declarations.display_diagnostics: whether to display diagnostics.
Clang.TokenList — TypeTokenListTokenizer accessor.
Clang.TranslationUnit — TypeTranslationUnit(idx, source, args)
TranslationUnit(idx, source, args, unsavedFiles, options)
TranslationUnit(f::Function, ...)Parse the given source file and the translation unit corresponding to that file. The function argument f for the do-constructor will be passed a single TranslationUnit object that will not be GC'd while f() runs.