Index API

parse_header(header::String; [index, diagnostics, cplusplus, clang_args, clang_includes, clang_flags])

Main entry-point to Clang.jl. The required header argument specifies a header to parse. Returns the top CLCursor in the resulting TranslationUnit. Optional (keyword) arguments are as follows:

  • index (Ptr{CXIndex}) – Pass to re-use a CXIndex over multiple runs.
  • diagnostics (Bool) – Print Clang diagnostics to STDERR.
  • cplusplus (Bool) – Parse as C++ file.
  • args (Vector{String}) – Vector of arguments (strings) to pass to Clang.
  • includes (Vector{String}) – Vector of include paths for Clang to search (note: path only, “-I” will be prepended automatically)
  • flags – Bitwise OR of TranslationUnit_FLags enum. Not required in typical use; see libclang manual for more information.
Return type:

TranslationUnit (<: CLCursor)


Retrieve child nodes for given CLCursor. Julia’s iterator protocol is supported, allowing constructs such as:

for node in children(cursor)

Get associated CLType for a given CLCursor.

return_type(c::{FunctionDecl, CXXMethod})

Get the CLType returned by the function or method.


Return the display name of a given CLCursor. This is the “long name”, and for a FunctionDecl will be the full function call signature (function name and argument types).


Return the spelling of a given CLCursor or CLType. Spelling is the “short name” of a given element. For a FunctionDecl the spelling will be the function name only (similarly the identifier name for a RecordDecl or TypedefDecl cursor).


Returns the value of a given EnumConstantDecl, automatically using correct call for signed vs. unsigned types.


Returns the type of the element pointed to by a Pointer cursor.