API Reference
Clang.CLANG_JULIA_TYPEMAP — ConstantMapping from libclang types to Julia types
Clang.RESERVED_ARG_TYPES — ConstantUnsupported argument types
Clang.RESERVED_WORDS — ConstantReserved Julia identifiers will be prepended with "_"
Base.isconst — Methodisconst(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.
Base.isvalid — Methodisvalid(k::CXcursorKind) -> Bool
isvalid(c::CLCursor) -> BoolReturn true if the given cursor kind represents an valid cursor. Wrapper for libclang's clang_isInvalid.
Clang.address_space — Methodaddress_space(t::Union{CXType,CLType})Returns the address space of the given type. Wrapper for libclang's clang_getAddressSpace.
Clang.annotate — Methodannotate(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.argnum — Methodargnum(c::Union{CXCursor,CLFunctionDecl,CLCXXMethod}) -> IntReturn the number of non-variadic arguments associated with a given cursor. Wrapper for libclang's clang_Cursor_getNumArguments.
Clang.argnum — Methodargnum(t::Union{CXType,CLFunctionNoProto,CLFunctionProto}) -> IntReturn the number of non-variadic parameters associated with a function type. Wrapper for libclang's clang_getNumArgTypes.
Clang.argtype — Methodargtype(t::CXType, i::Unsigned) -> CXType
argtype(t::Union{CLFunctionNoProto,CLFunctionProto}, i::Integer) -> CLTypeReturn the type of a parameter of a function type. Wrapper for libclang's clang_getArgType.
Clang.argument — Methodargument(c::CXCursor, i::Integer) -> CXCursor
argument(c::Union{CLFunctionDecl,CLCXXMethod}, i::Integer) -> CLCursorReturn the argument cursor of a function or method. Wrapper for libclang's clang_Cursor_getArgument.
Clang.bitwidth — Methodbitwidth(c::CLFieldDecl) -> IntReturn the bit width of a bit field declaration as an integer. Wrapper for libclang's clang_getFieldDeclBitWidth.
Clang.calling_conv — Methodcalling_conv(t::Union{CXType,CLFunctionNoProto,CLFunctionProto}) -> CXCallingConvReturn the calling convention associated with a function type. Wrapper for libclang's clang_getFunctionTypeCallingConv.
Clang.canonical — Methodcanonical(c::CXCursor) -> CXCursor
canonical(c::CLCursor) -> CLCursorReturn the canonical cursor corresponding to the given cursor. Wrapper for libclang's clang_getCanonicalCursor.
Clang.canonical — Methodcanonical(t::CXType) -> CXType
canonical(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.children — Methodchildren(cursor::CXCursor) -> Vector{CXCursor}
children(cursor::CLCursor) -> Vector{CLCursor}Return a child cursor vector of the given cursor.
Clang.clang2julia — Methodclang2julia(t::CLConstantArray)ConstantArrays are translated to NTuples.
Clang.clang2julia — Methodclang2julia(c::CLCursor) -> Symbol/ExprConvert libclang cursor/type to Julia.
Clang.clang2julia — Methodclang2julia(t::CLIncompleteArray)IncompleteArrays are translated to pointers, so one need to deal with the byte offsets directly.
Clang.clang2julia — Methodclang2julia(t::CLPointer)Pointers are translated to Ptrs.
Clang.clang2julia — Methodclang2julia(t::CLType) -> Symbol/ExprConvert libclang cursor/type to Julia.
Clang.clang2julia — Methodclang2julia(t::CLUnexposed)Unexposed Clang types are translated to the symbol of its cursor name(if exist).
Clang.copydeps — Methodcopydeps(dst)Copy dependencies to dst.
Clang.element_num — Methodelement_num(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.element_type — Methodelement_type(t::CXType) -> CXType
element_type(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.extent — Methodextent(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). Wrapper for libclang's clang_getCursorExtent.
Clang.extent — Methodextent(tu::Union{CXTranslationUnit,TranslationUnit}, t::Union{CXToken,CLToken}) -> CXSourceRangeReturn a source range that covers the given token.
Clang.filename — Methodfilename(c::Union{CXCursor,CLCursor}) -> StringReturn the complete file and path name of the given file referenced by the input cursor.
Clang.function_args — Methodfunction_args(cursor::CLCursor) -> Vector{CLCursor}Return function arguments for a given cursor.
Clang.get_included_file — Methodget_included_file(c::Union{CXCursor,CLCursor}) -> CXFileReturn the file that is included by the given inclusion directive cursor. Wrapper for libclang's clang_getIncludedFile.
Clang.get_lexical_parent — Methodget_lexical_parent(c::CXCursor) -> CXCursor
get_lexical_parent(c::CLCursor) -> CLCursorReturn the lexical parent of the given cursor. Please checkout libclang's doc to know more. Wrapper for libclang's clang_getCursorLexicalParent.
Clang.get_named_type — Methodget_named_type(t::CXType) -> CXType
get_named_type(t::CLElaborated) -> CLTypeReturn the type named by the qualified-id. Wrapper for libclang's clang_Type_getNamedType.
Clang.get_semantic_parent — Methodget_semantic_parent(c::CXCursor) -> CXCursor
get_semantic_parent(c::CLCursor) -> CLCursorReturn the semantic parent of the given cursor. Please checkout libclang's doc to know more. Wrapper for libclang's clang_getCursorSemanticParent.
Clang.get_translation_unit — Methodget_translation_unit(c::Union{CXCursor,CLCursor}) -> CXTranslationUnitReturns the translation unit that a cursor originated from. Wrapper for libclang's clang_Cursor_getTranslationUnit.
Clang.getcursor — Methodgetcursor(tu::TranslationUnit) -> CLCursor
getcursor(tu::CXTranslationUnit) -> CXCursorReturn the cursor that represents the given translation unit.
Clang.getcursor — Methodgetcursor() -> (NULL)CXCursorReturn the NULL CXCursor. Wrapper for libclang's clang_getNullCursor.
Clang.getdef — Methodgetdef(c::CXCursor) -> CXCursor
getdef(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. Wrapper for libclang's clang_getCursorDefinition.
Clang.getref — Methodgetref(c::CXCursor) -> CXCursor
getref(c::CLCursor) -> CLCursorFor a cursor that is a reference, retrieve a cursor representing the entity that it references. Wrapper for libclang's clang_getCursorReferenced.
Clang.handle_macro_exprn — Methodhandle_macro_exprn(tokens::TokenList, pos::Int)For handling of #define'd constants, allows basic expressions but bails out quickly.
Clang.hasattr — Methodhasattr(c::Union{CXCursor,CLCursor}) -> BoolDetermine whether the given cursor has any attributes. Wrapper for libclang's clang_Cursor_hasAttrs.
Clang.integer_type — Methodinteger_type(c::CLEnumDecl) -> CLTypeRetrieve the integer type of an enum declaration. Wrapper for libclang's clang_getEnumDeclIntegerType.
Clang.is_plain_old_data — Methodis_plain_old_data(t::Union{CXType,CLType}) -> BoolReturn true if the CXType is a plain old data type. Wrapper for libclang's clang_isPODType.
Clang.is_translation_unit — Methodis_translation_unit(k::CXcursorKind) -> Bool
is_translation_unit(c::CLCursor) -> BoolReturn true if the given cursor kind represents a translation unit. Wrapper for libclang's clang_isTranslationUnit.
Clang.is_typedef_anon — Methodis_typedef_anon(current::CLCursor, next::CLCursor) -> BoolReturn true if the current cursor is an typedef anonymous struct/enum.
Clang.isanonymous — Methodisanonymous(c::Union{CXCursor,CLCursor}) -> BoolReturn true if the given cursor represents an anonymous record declaration(C++). Wrapper for libclang's clang_Cursor_isAnonymous.
Clang.isattr — Methodisattr(k::CXcursorKind) -> Bool
isattr(c::CLCursor) -> BoolReturn true if the given cursor kind represents an attribute. Wrapper for libclang's clang_isAttribute.
Clang.isbit — Methodisbit(c::Union{CXCursor,CLCursor}) -> BoolReturn true if the cursor specifies a Record member that is a bitfield. Wrapper for libclang's clang_Cursor_isBitField.
Clang.isbuiltin — Methodisbuiltin(c::Union{CXCursor,CLCursor}) -> BoolDetermine whether a CXCursor that is a macro, is a builtin one. Wrapper for libclang's clang_Cursor_isMacroBuiltin.
Clang.isdecl — Methodisdecl(k::CXcursorKind) -> Bool
isdecl(c::CLCursor) -> BoolReturn true if the given cursor kind represents a declaration. Wrapper for libclang's clang_isDeclaration.
Clang.isdef — Methodisdef(c::Union{CXCursor,CLCursor}) -> BoolReturn true if the declaration pointed to by this cursor is also a definition of that entity. Wrapper for libclang's clang_isCursorDefinition.
Clang.isexpr — Methodisexpr(k::CXcursorKind) -> Bool
isexpr(c::CLCursor) -> BoolReturn true if the given cursor kind represents an expression. Wrapper for libclang's clang_isExpression.
Clang.isfunctionlike — Methodisfunctionlike(c::Union{CXCursor,CLCursor}) -> BoolDetermine whether a CXCursor that is a macro, is function like. Wrapper for libclang's clang_Cursor_isMacroFunctionLike.
Clang.isinlined — Methodisinlined(c::Union{CXCursor,CLCursor}) -> BoolDetermine whether a CXCursor that is a function declaration, is an inline declaration. Wrapper for libclang's clang_Cursor_isFunctionInlined.
Clang.isnull — Methodisnull(c::Union{CXCursor,CLCursor}) -> BoolReturn true if cursor is null. Wrapper for libclang's clang_Cursor_isNull.
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. Wrapper for libclang's clang_isPreprocessing.
Clang.isref — Methodisref(k::CXcursorKind) -> Bool
isref(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 getref to determine whether a particular cursor refers to another entity. Wrapper for libclang's clang_isReference.
Clang.isrestrict — Methodisrestrict(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.isstmt — Methodisstmt(k::CXcursorKind) -> Bool
isstmt(c::CLCursor) -> BoolReturn true if the given cursor kind represents a statement. Wrapper for libclang's clang_isStatement.
Clang.isunexposed — Methodisunexposed(k::CXcursorKind) -> BoolReturn true if the given cursor kind represents a currently unexposed piece of the AST (e.g., CXCursorUnexposedStmt). Wrapper for libclang's `clangisUnexposed`.
Clang.isvalid — Methodisvalid(t::CXType) -> Bool
isvalid(t::CLType) -> BoolReturn true if the type is a valid type.
Clang.isvariadic — Methodisvariadic(c::Union{CXCursor,CLCursor}) -> BoolReturn true if the given cursor is a variadic function or method. Wrapper for libclang's clang_Cursor_isVariadic.
Clang.isvariadic — Methodisvariadic(t::Union{CXType,CLType}) -> BoolReturn true if the CXType is a variadic function type. Wrapper for libclang's clang_isFunctionTypeVariadic.
Clang.isvirtual — Methodisvirtual(c::Union{CXCursor,CLCursor}) -> BoolReturn true if the base class specified by the cursor with kind CXCXXBaseSpecifier is virtual. Wrapper for libclang's `clangisVirtualBase`.
Clang.isvolatile — Methodisvolatile(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.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::CXCursor) -> CXCursorKindReturn the kind of the given cursor. Wrapper for libclang's clang_getCursorKind.
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.linkage — Methodlinkage(c::Union{CXCursor,CLCursor}) -> CXLinkageKindReturn the linkage of the entity referred to by a given cursor. Wrapper for libclang's clang_getCursorLinkage.
Clang.location — Methodlocation(c::Union{CXCursor,CLCursor}) -> CXSourceLocationReturn the physical location of the source constructor referenced by the given cursor. Wrapper for libclang's clang_getCursorLocation.
Clang.location — Methodlocation(tu::Union{CXTranslationUnit,TranslationUnit}, t::Union{CXToken,CLToken}) -> CXSourceLocationReturn the source location of the given token.
Clang.name — Methodname(c::Union{CXCursor,CLCursor}) -> StringReturn the display name for the entity referenced by this cursor.
Clang.name_safe — Methodname_safe(name::AbstractString)Return a valid Julia variable name, prefixed with "_" if the name is conflict with Julia's reserved words.
Clang.parse_header — Methodparse_header(header::AbstractString; index::Index=Index(), args::Vector{String}=String[],
includes::Vector{String}=String[], flags=CXTranslationUnit_None) -> TranslationUnitReturn the TranslationUnit for a given header. This is the main entry point for parsing. See also parse_headers.
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"].includes::Vector{String}: vector of extra include directories to search.flags: bitwise OR of CXTranslationUnit_Flags.
Clang.parse_headers — Methodparse_headers(headers::Vector{String}; index::Index=Index(), args::Vector{String}=String[], includes::Vector{String}=String[],
flags = CXTranslationUnit_DetailedPreprocessingRecord | CXTranslationUnit_SkipFunctionBodies) -> Vector{TranslationUnit}Return a TranslationUnit vector for the given headers. See also parse_header.
Clang.pointee_type — Methodpointee_type(t::CXType) -> CXType
pointee_type(t::CLType) -> CLTypeReturn the type of the pointee for pointer types. Wrapper for libclang's clang_getPointeeType.
Clang.print_buffer — MethodPretty-print a buffer of expressions (and comments) to an output stream Adds blank lines at appropriate places for readability
Clang.resolve_type — Methodresolve_type(t::CLType) -> CLTypeThis function attempts to work around some limitations of the current libclang API.
Clang.result_type — Methodresult_type(c::CXCursor) -> CXType
result_type(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. Wrapper for libclang's clang_getCursorResultType.
Clang.result_type — Methodresult_type(t::CXType) -> CXType
result_type(t::Union{CLFunctionNoProto,CLFunctionProto}) -> CLTypeReturn the return type associated with a function type. Wrapper for libclang's clang_getResultType.
Clang.return_type — Functionreturn_type(c::CLCursor, resolve::Bool=true) -> CXtypeReturn the return type associated with a function/method cursor.
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.symbol_safe — Methodsymbol_safe(name::AbstractString)Same as name_safe, but return a Symbol.
Clang.tokenize — Methodtokenize(c::Union{CXCursor,CLCursor}) -> TokenListReturn a TokenList from the given cursor.
Clang.type — Methodtype(c::CXCursor) -> CXType
type(c::CLCursor) -> CLTypeReturn the type of a CXCursor (if any). To get the cursor from a type, see typedecl. Wrapper for libclang's clang_getCursorType.
Clang.typedecl — Methodtypedecl(t::CXType) -> CXCursor
typedecl(t::CLType) -> CLCursorReturn the cursor for the declaration of the given type. To get the type of the cursor, see type. Wrapper for libclang's clang_getTypeDeclaration.
Clang.typedef_name — Methodtypedef_name(t::Union{CXType,CLType}) -> StringReturn the typedef name of the given type. Wrapper for libclang's clang_getTypedefName.
Clang.typedef_type — Methodtypedef_type(c::CLCursor) -> CXTypeReturn the underlying type of a typedef declaration.
Clang.typesize — Methodtypesize(t::CLType) -> Int
typesize(c::CLCursor) -> IntReturn field declaration size.
Clang.underlying_type — Methodunderlying_type(c::CLTypedefDecl) -> CLTypeReturn the underlying type of a typedef declaration. Wrapper for libclang's clang_getTypedefDeclUnderlyingType.
Clang.value — Methodvalue(c::CLCursor) -> IntReturn the integer value of an enum constant declaration.
Clang.wrap! — Methodwrap!(ctx::AbstractContext, cursor::CLEnumDecl)Subroutine for handling enum declarations.
Clang.wrap! — Methodwrap!(ctx::AbstractContext, cursor::CLFunctionDecl)Subroutine for handling function declarations. Note that VarArg functions are not supported.
Clang.wrap! — Methodwrap!(ctx::AbstractContext, cursor::CLMacroDefinition)Subroutine for handling macro declarations.
Clang.wrap! — Methodwrap!(ctx::AbstractContext, cursor::CLStructDecl)Subroutine for handling struct declarations.
Clang.wrap! — Methodwrap!(ctx::AbstractContext, cursor::CLTypeRef)For now, we just skip CXCursor_TypeRef cursors.
Clang.wrap! — Methodwrap!(ctx::AbstractContext, cursor::CLTypedefDecl)Subroutine for handling typedef declarations.
Clang.wrap! — Methodwrap!(ctx::AbstractContext, cursor::CLUnionDecl)Subroutine for handling union declarations.
Clang.Index — TypeIndex(exclude_decls_from_PCH, display_diagnostics)Provide a shared context for creating translation units.
Arguments
exclude_decls_from_PCH: whether to allow enumeration of "local" declarations.display_diagnostics: whether to display diagnostics.
Clang.TokenList — TypeTokenizer access
Clang.TranslationUnit — TypeTranslationUnit(idx, source, args)
TranslationUnit(idx, source, args, unsavedFiles, options)Parse the given source file and the translation unit corresponding to that file.
Clang.WrapContext — TypeWrapContextStore shared information about the wrapping session.