package mopsa

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
include module type of struct include Clang_AST end

We support C and a subset of C++.

Not necessarily supported:

  • attributes
  • C++ coroutines
  • C++ structured exception handling
  • Visual C++ specific (#pragma comment, etc.)
  • Objective-C
  • openMP
  • openCL
  • features added in Clang 5 and later

A function, enum, struct, etc. can be declared several times and defined at most once in a translation unit. Clang distinguishes every declaration and definition in the AST. We don't. Either the element is effectively defined, and we always expose the definition, or it is not, and we return the declarations. This may change in the future in case this turns out to be a bad idea. (we could do as Clang and always expose each and every declaration, and include an indirect pointer to the definition, if any).

Locations

type loc = Clang_AST.loc = {
  1. loc_line : int;
  2. loc_column : int;
  3. loc_file : string;
    (*

    empty for invalid locations

    *)
}

Location in a source file

type range = Clang_AST.range = {
  1. range_begin : loc;
  2. range_end : loc;
}

Location range in a source file

Comments

type comment_kind = Clang_AST.comment_kind =
  1. | RCK_Invalid
    (*

    Invalid comment.

    *)
  2. | RCK_OrdinaryBCPL
    (*

    Any normal BCPL comments.

    *)
  3. | RCK_OrdinaryC
    (*

    Any normal C comment.

    *)
  4. | RCK_BCPLSlash
    (*

    /// stuff

    *)
  5. | RCK_BCPLExcl
    (*

    //! stuff

    *)
  6. | RCK_JavaDoc
    (*

    /** stuff */

    *)
  7. | RCK_Qt
    (*

    /*! stuff */, also used by HeaderDoc

    *)
  8. | RCK_Merged
    (*

    Two or more documentation comments merged together.

    *)
type comment = Clang_AST.comment = {
  1. com_text : string;
    (*

    Raw comment text with comment markers.

    *)
  2. com_kind : comment_kind;
  3. com_range : range;
}

Raw comment found in the source file.

Macros

type macro = Clang_AST.macro = {
  1. macro_name : string;
    (*

    Macro name

    *)
  2. macro_params : string list;
    (*

    List of parameter names

    *)
  3. macro_contents : string list;
    (*

    List of source tokens (as string)

    *)
  4. macro_loc : loc;
    (*

    Macro location

    *)
}

AST

type uid = int

Nodes that can be referenced from several points of the AST (such as declaration) are tagged with an identifier which is unique across a translation unit.

type lang = Clang_AST.lang =
  1. | Lang_C
  2. | Lang_CXX
    (*

    Language in extern declaration.

    *)
type name = Clang_AST.name = {
  1. name_print : string;
    (*

    human-readable name for the declaration, even if it is one of the special kinds of names (C++ constructor, etc.

    *)
  2. name_qualified : string;
    (*

    fully-qualified human-readable name (with namespace)

    *)
  3. name_declaration : declaration_name;
    (*

    actual (internal) name of the declaration, which may be a special name

    *)
}
and enum_decl = Clang_AST.enum_decl = {
  1. enum_uid : uid;
    (*

    Unique declaration identifier

    *)
  2. enum_name : name;
  3. enum_num_positive_bits : int;
    (*

    Width in bits required to store all the non-negative enumerators of this enum.

    *)
  4. enum_num_negative_bits : int;
    (*

    Width in bits required to store all the negative enumerators of this enum.

    *)
  5. enum_is_complete : bool;
    (*

    true if this can be considered a complete type.

    *)
  6. enum_integer_type : type_qual option;
    (*

    Integer type this enum decl corresponds to.

    *)
  7. enum_promotion_type : type_qual option;
    (*

    Return the integer type that enumerators should promote to.

    *)
  8. enum_cst : enum_cst_decl list;
  9. enum_typedef : typedef_decl option;
    (*

    for anonymous enum, gets the typedef it is declared in, if any

    *)
  10. enum_range : range;
  11. enum_com : comment list;
}

enum declaration.

and enum_cst_decl = Clang_AST.enum_cst_decl = {
  1. enum_cst_uid : uid;
  2. enum_cst_name : name;
  3. enum_cst_val : Z.t;
  4. enum_cst_range : range;
  5. enum_cst_com : comment list;
}

enum constant declaration in an enum.

and field_decl = Clang_AST.field_decl = {
  1. field_uid : uid;
  2. field_name : name;
  3. field_index : int;
  4. field_type : type_qual;
  5. field_bitwidth : int option;
    (*

    bit-field width, in bits, or none if not a bit-field

    *)
  6. field_is_unnamed_bitfield : bool;
    (*

    whether this is an unnamed bitfield.

    *)
  7. field_is_in_valid_record : bool;
    (*

    whether the field is in a record with no semantic error and thus has a valid layout information; otherwise, offset information are set to 0

    *)
  8. field_offset : Int64.t;
    (*

    offset of the given field, in bits.

    *)
  9. field_variable_length_array : expr option;
    (*

    whether this field captures the variable length array type, and the corresponding size expression

    *)
  10. field_range : range;
  11. field_com : comment list;
}

field declaration in a struct or union.

and record_decl = Clang_AST.record_decl = {
  1. record_uid : uid;
  2. record_name : name;
  3. record_kind : record_kind;
    (*

    distinguish between struct and union

    *)
  4. record_has_flexible_array_member : bool;
  5. record_has_volatile_member : bool;
  6. record_is_anonymous : bool;
    (*

    Whether this is an anonymous struct or union. To be an anonymous struct or union, it must have been declared without a name and there must be no objects of this type declared

    *)
  7. record_is_complete : bool;
    (*

    true if this can be considered a complete type.

    *)
  8. record_is_valid : bool;
    (*

    true if it has no semantic error and thus has a valid layout information; otherwise, size and offset information are set to 0

    *)
  9. record_size : Int64.t;
    (*

    record size in characters, including padding

    *)
  10. record_data_size : Int64.t;
    (*

    record size in characters, without padding

    *)
  11. record_alignment : Int64.t;
    (*

    record alignment in characters.

    *)
  12. record_fields : field_decl list;
  13. record_typedef : typedef_decl option;
    (*

    for anonymous records, gets the typedef it is declared in, if any

    *)
  14. record_range : range;
  15. record_com : comment list;
  16. record_template : class_template_specialization option;
    (*

    (C++) template origin

    *)
  17. record_base_class : cxx_base_specifier list;
    (*

    (C++) direct (virtual and non virtual) base classes

    *)
  18. record_methods : function_decl list;
    (*

    (C++) all methods, including ctor, dtor, operators

    *)
  19. record_friends : friend_decl list;
    (*

    (C++) friends

    *)
}

struct or union declaration.

and cxx_base_specifier = Clang_AST.cxx_base_specifier = {
  1. cxx_base_is_virtual : bool;
    (*

    whether the base class is a virtual base class

    *)
  2. cxx_base_is_base_of_class : bool;
    (*

    whether this base class is a base of a class declared with the 'class' keyword (vs. one declared with the 'struct' keyword)

    *)
  3. cxx_base_is_pack_expansion : bool;
    (*

    whether this base specifier is a pack expansion

    *)
  4. cxx_base_get_inherit_constructors : bool;
    (*

    whether this base class's constructors get inherited

    *)
  5. cxx_base_access : access_specifier;
    (*

    the access specifier for this base specifier; this is the actual base specifier as used for semantic analysis, so the result can never be AS_none

    *)
  6. cxx_base_type : type_qual;
    (*

    the type of the base class; this type will always be an unqualified class type.

    *)
}
and record_kind = Clang_AST.record_kind =
  1. | Record_Struct
  2. | Record_Union
  3. | Record_Class
  4. | Record_Interface
    (*

    struct or union kind (class and interface are not used now but here for future support of C++ / ObjC)

    *)
and typedef_decl = Clang_AST.typedef_decl = {
  1. typedef_uid : uid;
  2. typedef_name : name;
  3. typedef_underlying_type : type_qual;
  4. typedef_range : range;
  5. typedef_com : comment list;
}

typedef declaration

and function_decl = Clang_AST.function_decl = {
  1. function_uid : uid;
  2. function_name : name;
  3. function_body : stmt option;
    (*

    Retrieve the body (definition) of the function; None if declared but not defined in the translation unit

    *)
  4. function_is_variadic : bool;
    (*

    Whether this function is variadic.

    *)
  5. function_is_main : bool;
    (*

    Whether this function is "main", which is the entry point into an executable program.

    *)
  6. function_is_global : bool;
    (*

    Whether this is a global function.

    *)
  7. function_storage_class : storage_class;
    (*

    Storage class as written in the source.

    *)
  8. function_return_type : type_qual;
  9. function_params : param_var_decl array;
  10. function_range : range;
    (*

    Range of the declaration.

    *)
  11. function_name_range : range;
    (*

    Range of the name in the declaration.

    *)
  12. function_com : comment list;
  13. function_template : function_template_specialization option;
    (*

    (C++) template origin

    *)
  14. function_overloaded_operator : overloaded_operator option;
    (*

    (C++) whether this is an overloaded operator

    *)
  15. function_method : cxx_method_decl option;
    (*

    (C++) additional information for methods; None if not a method

    *)
}

Represents a function declaration or definition.

and cxx_method_decl = Clang_AST.cxx_method_decl = {
  1. method_parent_class : record_decl;
    (*

    parent class containing the method declaration

    *)
  2. method_is_instance : bool;
    (*

    instance method is true, static method if false

    *)
  3. method_is_virtual : bool;
    (*

    virtual method

    *)
  4. method_overridden : decl list;
    (*

    overridden declarations

    *)
  5. method_ref_qualifier : ref_qualifier;
    (*

    ref-qualifier associated with this method

    *)
  6. method_kind : cxx_method_kind;
}

(C++) Additional function information for a method.

and cxx_method_kind = Clang_AST.cxx_method_kind =
  1. | Method_Regular
    (*

    regular method

    *)
  2. | Method_Constructor of cxx_constructor_decl
    (*

    constructor

    *)
  3. | Method_Destructor
    (*

    destructor

    *)
  4. | Method_Conversion of bool
    (*

    conversion method; true if explicit

    *)
and cxx_constructor_decl = Clang_AST.cxx_constructor_decl = {
  1. constructor_initializers : cxx_constructor_initializer list;
  2. constructor_explicit : bool;
    (*

    whether this function is explicit

    *)
  3. constructor_delegating : bool;
    (*

    whether the constructor creates a delegating construtor

    *)
  4. constructor_inheriting : bool;
    (*

    whether this is an implicit constructor synthesized to model a call to a constructor inherited from a base class

    *)
  5. constructor_target : function_decl option;
    (*

    when this constructor delegates to another, retrieve the target

    *)
  6. constructor_inherited : function_decl option;
    (*

    whether this base class's constructors get inherited.

    *)
}

(C++) Additional information for constructors.

and cxx_constructor_initializer = Clang_AST.cxx_constructor_initializer =
  1. | Constructor_init_Base of type_qual * bool * expr
    (*

    initializer

    *)
  2. | Constructor_init_Field of field_decl * expr
  3. | Constructor_init_Indirect_field of indirect_field_decl * expr
  4. | Constructor_init_Delegating of type_qual * expr
    (*

    (C++) Represents a C++ base or member initializer. This is part of a constructor initializer that initializes one non-static member variable or one base class.

    *)
and var_decl = Clang_AST.var_decl = {
  1. var_uid : uid;
  2. var_name : name;
  3. var_type : type_qual;
  4. var_storage_class : storage_class;
    (*

    Storage class as written in the source.

    *)
  5. var_init : expr option;
    (*

    Optional initializer

    *)
  6. var_is_file_scoped : bool;
    (*

    File scoped variable declaration

    *)
  7. var_is_local : bool;
    (*

    Whether the variable is local (incl. parameter)

    *)
  8. var_range : range;
  9. var_com : comment list;
  10. var_template : var_template_specialization option;
    (*

    (C++) template origin

    *)
}

Represents a variable declaration or definition.

and param_var_decl = var_decl

We identify parameter declarations with variable declarations.

and storage_class = Clang_AST.storage_class =
  1. | SC_None
  2. | SC_Extern
  3. | SC_Static
  4. | SC_PrivateExtern
  5. | SC_Auto
  6. | SC_Register
    (*

    Storage classes.

    *)
and qual = Clang_AST.qual = {
  1. qual_is_const : bool;
  2. qual_is_restrict : bool;
  3. qual_is_volatile : bool;
}

Type qualifiers.

and typ = Clang_AST.typ =
  1. | DecayedType of type_qual * type_qual
    (*

    A pointer type decayed from an array or function type.

    *)
  2. | ArrayType of array_type
    (*

    Array Declarators.

    *)
  3. | AtomicType of type_qual
  4. | AttributedType of type_qual
    (*

    An attributed type is a type to which a type attribute has been applied. TODO: attribute information.

    *)
  5. | BuiltinType of builtin_type
  6. | ComplexType of type_qual
    (*

    Complex values.

    *)
  7. | FunctionProtoType of fun_proto_type
    (*

    Represents a prototype with parameter type info, e.g. int foo(int)' or 'int foo(void)'.

    *)
  8. | FunctionNoProtoType of fun_no_proto_type
    (*

    Represents a K&R-style 'int foo()' function, which has no information available about its arguments.

    *)
  9. | ParenType of type_qual
    (*

    Sugar for parentheses used when specifying types.

    *)
  10. | PointerType of type_qual
    (*

    Pointer declarators.

    *)
  11. | EnumType of enum_decl
    (*

    Enumeration type.

    *)
  12. | RecordType of record_decl
    (*

    Struct or union type.

    *)
  13. | TypedefType of typedef_decl
    (*

    Type defined as a typedef

    *)
  14. | ElaboratedType of type_qual
    (*

    Represents a type that was referred to using an elaborated type keyword.

    *)
  15. | UnaryTransformType of unary_transform_type
    (*

    A unary type transform, which is a type constructed from another.

    *)
  16. | TypeOfExprType of expr
    (*

    Represents a typeof expression (a GCC extension).

    *)
  17. | TypeOfType of type_qual
    (*

    Represents a typeof(type), a gcc extension.

    *)
  18. | DecltypeType of expr * type_qual option
    (*

    (C++) Represents the type decltype(expr) (C++11).

    *)
  19. | AutoType of bool
    (*

    true for decltype(auto), false for auto

    *)
  20. | DeducedTemplateSpecializationType of template_name
    (*

    (C++) Represents a C++17 deduced template specialization type.

    *)
  21. | DependentSizedExtVectorType of expr * type_qual
    (*

    (C++) Represents an extended vector type where either the type or size is dependent.

    *)
  22. | InjectedClassNameType of type_qual * template_name option * record_decl * template_argument array
    (*

    (C++) The injected class name of a C++ class template or class template partial specialization.

    *)
  23. | MemberPointerType of type_qual * typ
    (*

    class

    *)
  24. | PackExpansionType of type_qual * int option
    (*

    number of expansions, if known

    *)
  25. | LValueReferenceType of type_qual
    (*

    (C++) An lvalue reference type, per C++11 dcl.ref.

    *)
  26. | RValueReferenceType of type_qual
    (*

    (C++) An rvalue reference type, per C++11 dcl.ref.

    *)
  27. | SubstTemplateTypeParmPackType of string * template_type_param_decl * template_argument
    (*

    (C++) Represents the result of substituting a set of types for a template type parameter pack.

    *)
  28. | SubstTemplateTypeParmType of template_type_param_decl * type_qual
    (*

    (C++) Represents the result of substituting a type for a template type parameter.

    *)
  29. | TemplateSpecializationType of type_qual option * template_name * template_argument array
    (*

    (C++) Represents a type template specialization; the template must be a class template, a type alias template, or a template template parameter.

    *)
  30. | TemplateTypeParmType of template_type_param_type
    (*

    (C++)

    *)
  31. | DependentNameType of name_specifier list * string
  32. | DependentTemplateSpecializationType of name_specifier list * string * template_argument array
    (*

    (C++) Represents a template specialization type whose template cannot be resolved, e.g. A<T>::template B<T>

    *)
  33. | UnresolvedUsingType of unresolved_using_typename_decl
    (*

    (C++) Represents the dependent type named by a dependently-scoped typename using declaration, e.g. using typename Base<T>::foo; Template instantiation turns these into the underlying type.

    *)
  34. | VectorType of type_qual * int * int
    (*

    kind

    *)
  35. | UnknownType of int * string
    (*

    Types

    *)
and builtin_type = Clang_AST.builtin_type =
  1. | Type_Void
    (*

    void

    *)
  2. | Type_Bool
    (*

    _Bool in C99

    *)
  3. | Type_Char_U
    (*

    char for targets where it's unsigned

    *)
  4. | Type_UChar
    (*

    unsigned char, explicitly qualified

    *)
  5. | Type_WChar_U
    (*

    wchar_t for targets where it's unsigned

    *)
  6. | Type_Char16
    (*

    (C++) char16_t

    *)
  7. | Type_Char32
    (*

    (C++) char32_t

    *)
  8. | Type_UShort
    (*

    unsigned short

    *)
  9. | Type_UInt
    (*

    unsigned int

    *)
  10. | Type_ULong
    (*

    unsigned long

    *)
  11. | Type_ULongLong
    (*

    unsigned long long

    *)
  12. | Type_UInt128
    (*

    _uint128_t

    *)
  13. | Type_Char_S
    (*

    char for targets where it's signed

    *)
  14. | Type_SChar
    (*

    signed char, explicitly qualified

    *)
  15. | Type_WChar_S
    (*

    wchar_t for targets where it's signed

    *)
  16. | Type_Short
    (*

    short or signed short

    *)
  17. | Type_Int
    (*

    int or signed int

    *)
  18. | Type_Long
    (*

    long or signed long

    *)
  19. | Type_LongLong
    (*

    long long or signed long long

    *)
  20. | Type_Int128
    (*

    __int128_t

    *)
  21. | Type_Half
    (*

    __fp16

    *)
  22. | Type_Float
    (*

    float

    *)
  23. | Type_Double
    (*

    double

    *)
  24. | Type_LongDouble
    (*

    long double

    *)
  25. | Type_Float128
    (*

    __float128

    *)
  26. | Type_NullPtr
    (*

    (C++0x) nullptr

    *)
  27. | Type_ObjCId
    (*

    primitive ObjC id

    *)
  28. | Type_ObjCClass
    (*

    pimitive ObjC Class

    *)
  29. | Type_ObjCSel
    (*

    primitive ObjC SEL

    *)
  30. | Type_OCLSampler
    (*

    sampler_t

    *)
  31. | Type_OCLEvent
    (*

    event_t

    *)
  32. | Type_OCLClkEvent
    (*

    clk_event_t

    *)
  33. | Type_OCLQueue
    (*

    queue_t

    *)
  34. | Type_OCLReserveID
    (*

    reserved_id_t

    *)
  35. | Type_Dependent
    (*

    expression whose type is totally unknown

    *)
  36. | Type_Overload
    (*

    unresolved overload set

    *)
  37. | Type_BoundMember
    (*

    (C++) bound non-static member function

    *)
  38. | Type_PseudoObject
    (*

    pseudo-object such ObjC @property

    *)
  39. | Type_UnknownAny
    (*

    __builtin_any_type

    *)
  40. | Type_BuiltinFn
  41. | Type_ARCUnbridgedCast
    (*

    case which in ARC would normally requier a __bridge

    *)
  42. | Type_OMPArraySection
    (*

    placeholder type for OpenMP array sections

    *)

Builtin types

and unary_transform_type = Clang_AST.unary_transform_type = {
  1. unary_underlying_type : type_qual;
  2. unary_base_type : type_qual;
  3. unary_kind : unary_transform_kind;
}

A unary type transform, which is a type constructed from another.

and unary_transform_kind = Clang_AST.unary_transform_kind =
  1. | EnumUnderlyingType
and array_type = Clang_AST.array_type = {
  1. array_element_type : type_qual;
  2. array_size : array_size;
  3. array_size_modifier : array_size_modifier;
}

Array Declarators.

and fun_proto_type = Clang_AST.fun_proto_type = {
  1. proto_result_type : type_qual;
    (*

    type of an expression that calls a function of this type.

    *)
  2. proto_return_type : type_qual;
    (*

    return type

    *)
  3. proto_qual : qual;
    (*

    qualifiers

    *)
  4. proto_params : type_qual array;
    (*

    parameter types

    *)
  5. proto_variadic : bool;
    (*

    is the function variadic?

    *)
  6. proto_exception_spec : exception_specification_type;
    (*

    (C++) exception specification

    *)
  7. proto_noexcept_result : noexcept_result;
    (*

    (C++) interpretation of noexpect spec (Clang < 7)

    *)
  8. proto_exceptions : type_qual array;
    (*

    (C++) exception list in specification

    *)
  9. proto_has_trailing_return : bool;
    (*

    (C++)

    *)
  10. proto_ref_qualifier : ref_qualifier;
    (*

    (C++) ref-qualifier associated with this function type

    *)
}

Represents a prototype with parameter type info, e.g. 'int foo(int)' or 'int foo(void)'. 'void' is represented as having no parameters, not as having a single void parameter.

and exception_specification_type = Clang_AST.exception_specification_type =
  1. | EST_None
    (*

    no exception specification

    *)
  2. | EST_DynamicNone
    (*

    throw()

    *)
  3. | EST_Dynamic
    (*

    throw(T1, T2)

    *)
  4. | EST_MSAny
    (*

    Microsoft throw(...) extension

    *)
  5. | EST_BasicNoexcept
    (*

    noexcept

    *)
  6. | EST_ComputedNoexcept
    (*

    noexcept(expression) (Clang < 7)

    *)
  7. | EST_Unevaluated
    (*

    not evaluated yet, for special member function

    *)
  8. | EST_Uninstantiated
    (*

    not instantiated yet

    *)
  9. | EST_Unparsed
    (*

    not parsed yet

    *)
  10. | EST_DependentNoexcept
    (*

    noexcept(expression) (Clang >= 7)

    *)
  11. | EST_NoexceptFalse
    (*

    noexcept(false) (clang >= 7)

    *)
  12. | EST_NoexceptTrue
    (*

    noexcept(true) (clang >= 7)

    *)
and noexcept_result = Clang_AST.noexcept_result =
  1. | NR_NoNoexcept
    (*

    There is no noexcept specifier.

    *)
  2. | NR_BadNoexcept
    (*

    The noexcept specifier has a bad expression.

    *)
  3. | NR_Dependent
    (*

    The noexcept specifier is dependent.

    *)
  4. | NR_Throw
    (*

    The noexcept specifier evaluates to false.

    *)
  5. | NR_Nothrow
    (*

    The noexcept specifier evaluates to true.

    *)
and fun_no_proto_type = Clang_AST.fun_no_proto_type = {
  1. noproto_result_type : type_qual;
    (*

    type of an expression that calls a function of this type.

    *)
}

Represents a K&R-style 'int foo()' function, which has no information available about its arguments.

and array_size = Clang_AST.array_size =
  1. | Size_Constant of Z.t
    (*

    C arrays with a specified constant size.

    *)
  2. | Size_Variable of expr option
    (*

    C array with a specified size that is not an integer-constant-expression

    *)
  3. | Size_Incomplete
    (*

    C array with an unspecified size

    *)
  4. | Size_Dependent
    (*

    (C++) array with dependent size

    *)

Array size

and array_size_modifier = Clang_AST.array_size_modifier =
  1. | Size_Normal
    (*

    no modifier

    *)
  2. | Size_Static
    (*

    static keyword, as in int arraystatic 2

    *)
  3. | Size_Star
    (*

    star modifier, as in int array*

    *)

Array size modifier

and ref_qualifier = Clang_AST.ref_qualifier =
  1. | RQ_None
    (*

    No ref-qualifier was provided

    *)
  2. | RQ_LValue
    (*

    An lvalue ref-qualifier was provided (&)

    *)
  3. | RQ_RValue
    (*

    An rvalue ref-qualifier was provided (&&)

    *)

(C++) The kind of C++11 ref-qualifier associated with a function type. This determines whether a member function's "this" object can be an lvalue, rvalue, or neither.

and template_type_param_type = Clang_AST.template_type_param_type = {
  1. template_type_param_depth : int;
  2. template_type_param_index : int;
  3. template_type_param_is_parameter_pack : bool;
  4. template_type_param_decl : template_type_param_decl option;
  5. template_type_param_identifier : string option;
}
and type_qual = typ * qual

Qualified type

and decl_kind = Clang_AST.decl_kind =
  1. | TranslationUnitDecl of decl list
    (*

    The top declaration context.

    *)
  2. | EmptyDecl
    (*

    Represents an empty-declaration.

    *)
  3. | FieldDecl of field_decl
    (*

    Represents a field in a union or struct.

    *)
  4. | EnumConstantDecl of enum_cst_decl
    (*

    Represents an enumeration constant in an enum.

    *)
  5. | FileScopeAsmDecl of string
  6. | LinkageSpecDecl of lang * decl list
    (*

    This represents a linkage specification. For example: extern "C" void foo();

    *)
  7. | LabelDecl of name
    (*

    Represents the declaration of a label.

    *)
  8. | EnumDecl of enum_decl
    (*

    Represents an enum. In C++11, enums can be forward-declared with a fixed underlying type, and in C we allow them to be forward-declared with no underlying type as an extension.

    *)
  9. | RecordDecl of record_decl
    (*

    Represents a struct, union, class.

    *)
  10. | TypedefDecl of typedef_decl
    (*

    Represents the declaration of a typedef-name via the 'typedef' type specifier.

    *)
  11. | FunctionDecl of function_decl
    (*

    Represents a function declaration or definition.

    *)
  12. | VarDecl of var_decl
    (*

    Represents a variable declaration or definition.

    *)
  13. | AccessSpecDecl
    (*

    (C++) Represents an access specifier followed by colon ':'

    *)
  14. | BlockDecl of block_decl
    (*

    (C++) This represents a block literal declaration, which is like an unnamed FunctionDecl.

    *)
  15. | FriendDecl of friend_decl
    (*

    (C++) Represents the declaration of a friend entity, which can be a function, a type, or a templated function or type.

    *)
  16. | StaticAssertDecl of static_assert
    (*

    (C++) Represents a C++11 static_assert declaration.

    *)
  17. | NamespaceAliasDecl of namespace_alias_decl
    (*

    (C++) Represents a C++namespace alias.

    *)
  18. | NamespaceDecl of namespace_decl
    (*

    (C++) Represent a C++ namespace.

    *)
  19. | BuiltinTemplateDecl of builtin_template_decl
    (*

    (C++) Represents the builtin template declaration which is used to implement __make_integer_seq and other builtin templates

    *)
  20. | ClassTemplateDecl of class_template_decl
    (*

    (C++) Declaration of a class template.

    *)
  21. | FunctionTemplateDecl of function_template_decl
    (*

    (C++) Declaration of a template function.

    *)
  22. | TypeAliasTemplateDecl of type_alias_template_decl
    (*

    (C++) Declaration of an alias template.

    *)
  23. | VarTemplateDecl of var_template_decl
    (*

    (C++) Declaration of a variable template.

    *)
  24. | TemplateTemplateParmDecl of template_template_param_decl
    (*

    (C++) Declares a template template parameter.

    *)
  25. | TemplateTypeParmDecl of template_type_param_decl
    (*

    (C++) Declaration of a template type parameter.

    *)
  26. | TypeAliasDecl of typedef_decl
    (*

    (C++) Represents the declaration of a typedef-name via a C++0x alias-declaration.

    *)
  27. | UnresolvedUsingTypenameDecl of unresolved_using_typename_decl
    (*

    (C++) Represents a dependent using declaration which was marked with typename.

    *)
  28. | UsingDecl of using_decl
    (*

    (C++) Represents a C++ using-declaration.

    *)
  29. | UsingDirectiveDecl of using_directive_decl
    (*

    (C++) Represents C++ using-directive.

    *)
  30. | UsingPackDecl of using_pack_decl
    (*

    (C++) Represents a pack of using declarations that a single using-declarator pack-expanded into.

    *)
  31. | UsingShadowDecl of using_shadow_decl
    (*

    (C++) Represents a shadow declaration introduced into a scope by a (resolved) using declaration.

    *)
  32. | BindingDecl of binding_decl
    (*

    (C++) A bining in a decomposition declaration.

    *)
  33. | IndirectFieldDecl of indirect_field_decl
    (*

    (C++) An instance of this class is created to represent a field injected from an anonymous union/struct into the parent scope.

    *)
  34. | UnresolvedUsingValueDecl of unresolved_using_value_decl
    (*

    (C++) Represents a dependent using declaration which was not marked with typename.

    *)
  35. | NonTypeTemplateParmDecl of non_type_template_param_decl
    (*

    (C++) Declares a non-type template parameter.

    *)
  36. | UnknownDecl of int * string
    (*

    Unhandled AST node

    *)

Possible kinds of declarations and definitions.

and decl = Clang_AST.decl = {
  1. decl_kind : decl_kind;
  2. decl_access : access_specifier;
    (*

    (C++) access specifier

    *)
  3. decl_range : range;
  4. decl_comment : comment list;
    (*

    comment associated to the declaration

    *)
}

Represents one declaration (or definition), e.g. a variable, typedef, function, struct, etc.

and access_specifier = Clang_AST.access_specifier =
  1. | AS_public
  2. | AS_protected
  3. | AS_private
  4. | AS_none
    (*

    special value "none" which means different things in different contexts

    *)

(C++) access specifier

and expr_kind = Clang_AST.expr_kind =
  1. | ConditionalOperator of conditional_operator
    (*

    The ?: ternary operator

    *)
  2. | BinaryConditionalOperator of binary_conditional_operator
    (*

    Binary version of the ?: operator

    *)
  3. | AddrLabelExpr of name
    (*

    The GNU address of label extension, representing &&label

    *)
  4. | ArrayInitIndexExpr
    (*

    Represents the index of the current element of an array being initialized by an ArrayInitLoopExpr.

    *)
  5. | ArrayInitLoopExpr of array_init_loop_expr
    (*

    Represents a loop initializing the elements of an array

    *)
  6. | ArraySubscriptExpr of array_subscript_expr
    (*

    Array subscripting.

    *)
  7. | AtomicExpr of atomic_expr
    (*

    Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, __atomic_load, __atomic_store, and __atomic_compare_exchange_*, for the similarly-named C++11 instructions, and __c11 variants for <stdatomic.h>.

    *)
  8. | CompoundAssignOperator of compound_assign_expr
    (*

    For compound assignments (e.g. +=).

    *)
  9. | BinaryOperator of expr * binary_operator * expr
    (*

    A builtin binary operation expression such as "x + y" or "x <= y". The operands will already have been converted to appropriate types (e.g., by performing promotions or conversions). Note that assignment is a binary operator, not a coumpound assignment operator.

    *)
  10. | UnaryOperator of unary_operator * expr
    (*

    This represents the unary-expression's (except sizeof and alignof) and the postinc/postdec operators from postfix-expression.

    *)
  11. | CallExpr of call_expr
    (*

    Represents a function call

    *)
  12. | CastExpr of expr * cast_kind
    (*

    (Implicit or explicit) type conversion

    *)
  13. | CharacterLiteral of Int32.t * character_kind
  14. | ChooseExpr of choose_expr
    (*

    GNU builtin-in function __builtin_choose_expr

    *)
  15. | CompoundLiteralExpr of expr * bool
    (*

    Compound literal

    *)
  16. | DeclRefExpr of decl
    (*

    A reference to a declared variable, function, enum, etc.

    *)
  17. | DesignatedInitExpr of designator array * expr
    (*

    Represents a C99 designated initializer expression. A designated initializer expression (C99 6.7.8) contains one or more designators (which can be field designators, array designators, or GNU array-range designators) followed by an expression that initializes the field or element(s) that the designators refer to.

    NOTE: Designators may not be useful for us. If I understand correctly, Clang's semantic analysis removes them by generating explicit nested list of initializers and putting designated initializers at the correct place. Similarly, default value for missing initializers are put explicitly...

    *)
  18. | FloatingLiteral of string
    (*

    Floating point literal

    *)
  19. | GenericSelectionExpr of generic_selection_expr
    (*

    A generic selection (C11 6.5.1.1) contains an unevaluated controlling expression, followed by one or more generic associations. Each generic association specifies a type name and an expression, or "default" and an expression (in which case it is known as a default generic association). The type and value of the generic selection are identical to those of its result expression, which is defined as the expression in the generic association with a type name that is compatible with the type of the controlling expression, or the expression in the default generic association if no types are compatible.

    *)
  20. | GNUNullExpr
    (*

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

    *)
  21. | ImaginaryLiteral of expr
    (*

    We support imaginary integer and floating point literals, like "1.0i". We represent these as a wrapper around FloatingLiteral and IntegerLiteral, and have a Complex type whose element type matches the subexpression.

    *)
  22. | ImplicitValueInitExpr
    (*

    Represents an implicitly-generated value initialization of an object of a given type. Implicit value initializations occur within semantic initializer list expressions (InitListExpr) as placeholders for subobject initializations not explicitly specified by the user.

    *)
  23. | InitListExpr of init_list_expr
    (*

    Describes an initializer list, which can be used to initialize objects of different types, including struct/class/union types, arrays, and vectors.

    *)
  24. | IntegerLiteral of Z.t
  25. | MemberExpr of member_expr
    (*

    Structure and union members. X->F and X.F. In C++, also method or overloaded operator.

    *)
  26. | NoInitExpr
    (*

    Represents a place-holder for an object not to be initialized by anything. This only makes sense when it appears as part of an updater of a DesignatedInitUpdateExpr.

    *)
  27. | OffsetOfExpr of offsetof_node array * Z.t option
    (*

    This represents an expression of the form offsetof(record-type, member-designator)

    *)
  28. | OpaqueValueExpr of opaque_expr
    (*

    An expression referring to an opaque object of a fixed type and value class

    *)
  29. | ParenExpr of expr
    (*

    This represents a parethesized expression

    *)
  30. | ParenListExpr of expr array
    (*

    This represents a parethesized expression

    *)
  31. | PredefinedExpr of ident_type * string
    (*

    A predefined identifier such as func.

    *)
  32. | PseudoObjectExpr of pseudo_object_expr
    (*

    An expression which accesses a pseudo-object l-value. A pseudo-object is an abstract object, accesses to which are translated to calls. The pseudo-object expression has a syntactic form, which shows how the expression was actually written in the source code, and a semantic form, which is a series of expressions to be executed in order which detail how the operation is actually evaluated. Optionally, one of the semantic forms may also provide a result value for the expression.

    *)
  33. | StmtExpr of stmt list
    (*

    This is the GNU Statement Expression extension: (nt X=4; X;). The StmtExpr contains a single CompoundStmt node, which it evaluates and takes the value of the last subexpression. A StmtExpr is always an r-value; values "returned" out of a StmtExpr will be copied.

    *)
  34. | StringLiteral of string * character_kind
    (*

    This represents a string literal expression, e.g. "foo" or L"bar" (wide strings)

    *)
  35. | UnaryExprOrTypeTraitExpr of unary_expr_or_type * type_qual
    (*

    Expression with either a type or (unevaluated) expression operand. For expression operands, we only keep its type as it is all that matters for these operators.

    *)
  36. | VAArgExpr of expr
    (*

    Represents a call to the builtin function __builtin_va_arg.

    *)
  37. | FullExpr of expr
    (*

    Represents a "full-expression" node (clang >= 8)

    *)
  38. | ConstantExpr of expr
    (*

    An expression that occurs in a constant context. (clang >= 8)

    *)
  39. | ArrayTypeTraitExpr of array_type_trait_expr
    (*

    (C++) An embarcadero array type trait, as used in the implementation of __array_rank and __array_extent.

    *)
  40. | CXXBindTemporaryExpr of expr
    (*

    (C++) Represents binding an expression to a temporary. This ensures the destructor is called for the temporary. It should only be needed for non-POD, non-trivially destructable class types.

    *)
  41. | CXXBoolLiteralExpr of bool
    (*

    (C++) A boolean literal, per (C++ lex.bool Boolean literals).

    *)
  42. | CXXConstructExpr of cxx_construct_expr
    (*

    (C++) Represents a call to a C++ constructor

    *)
  43. | CXXDefaultArgExpr of param_var_decl * expr
    (*

    (C++) A default argument (C++ dcl.fct.default). This wraps up a function call argument that was created from the corresponding parameter's default argument, when the call did not explicitly supply arguments for all of the parameters.

    *)
  44. | CXXDefaultInitExpr of field_decl * expr
    (*

    (C++) A use of a default initializer in a constructor or in aggregate initialization. This wraps a use of a C++ default initializer (technically, a brace-or-equal-initializer for a non-static data member) when it is implicitly used in a mem-initializer-list in a constructor (C++11 class.base.initp8) or in aggregate initialization (C++1y dcl.init.aggrp7).

    *)
  45. | CXXDeleteExpr of cxx_delete_expr
    (*

    (C++) Represents a delete expression for memory deallocation and destructor calls, e.g. "delete pArray".

    *)
  46. | CXXDependentScopeMemberExpr of cxx_dependent_scope_member_expr
    (*

    (C++) Represents a C++ member access expression where the actual member referenced could not be resolved because the base expression or the member name was dependent.

    *)
  47. | CXXFoldExpr of cxx_fold_expr
    (*

    (C++) Represents a folding of a pack over an operator. This expression is always dependent and represents a pack expansion of the forms: ( expr op ... ) ( ... op expr ) ( expr op ... op expr )

    *)
  48. | CXXInheritedCtorInitExpr of cxx_inherited_ctor
    (*

    (C++) Represents a call to an inherited base class constructor from an inheriting constructor. This call implicitly forwards the arguments from the enclosing context (an inheriting constructor) to the specified inherited base class constructor.

    *)
  49. | CXXNewExpr of cxx_new_expr
    (*

    (C++) Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)".

    *)
  50. | CXXNoexceptExpr of expr * bool
    (*

    (C++) Represents a C++11 noexcept expression (C++ expr.unary.noexcept). The noexcept expression tests whether a given expression might throw. Its result is a boolean constant.

    *)
  51. | CXXNullPtrLiteralExpr
    (*

    (C++) The null pointer literal (C++11 lex.nullptr). Introduced in C++11, the only literal of type nullptr_t is nullptr.

    *)
  52. | CXXPseudoDestructorExpr of cxx_pseudo_destructor_expr
    (*

    (C++) Represents a C++ pseudo-destructor (C++ expr.pseudo). A pseudo-destructor is an expression that looks like a member access to a destructor of a scalar type, except that scalar types don't have destructors.

    *)
  53. | CXXScalarValueInitExpr
    (*

    (C++) An expression "T()" which creates a value-initialized rvalue of type T, which is a non-class type. See (C++98 5.2.3p2).

    *)
  54. | CXXStdInitializerListExpr of expr
    (*

    (C++) Implicit construction of a std::initializer_list<T> object from an array temporary within list-initialization (C++11 dcl.init.listp5).

    *)
  55. | CXXThisExpr of bool
    (*

    (C++) Represents the this expression in C++.

    *)
  56. | CXXThrowExpr of cxx_throw_expr
    (*

    (C++) A C++ throw-expression (C++ except.throw).

    *)
  57. | CXXTypeidExpr of cxx_typeid_expr
    (*

    (C++) A C++ typeid expression (C++ expr.typeid), which gets the type_info that corresponds to the supplied type, or the (possibly dynamic) type of the supplied expression.

    *)
  58. | CXXUnresolvedConstructExpr of cxx_unresolved_construct_expr
    (*

    (C++) Describes an explicit type conversion that uses functional notion but could not be resolved because one or more arguments are type-dependent.

    *)
  59. | DependentScopeDeclRefExpr of dependent_scope_decl_ref_expr
    (*

    (C++) A qualified reference to a name whose declaration cannot yet be resolved.

    *)
  60. | ExpressionTraitExpr of expression_trait_expr
    (*

    (C++) An expression trait intrinsic.

    *)
  61. | ExprWithCleanups of expr_with_cleanups
    (*

    (C++) Represents an expression – generally a full-expression – that introduces cleanups to be run at the end of the sub-expression's evaluation.

    *)
  62. | FunctionParmPackExpr of var_decl * var_decl array
    (*

    (C++) Represents a reference to a function parameter pack that has been substituted but not yet expanded. When a pack expansion contains multiple parameter packs at different levels, this node is used to represent a function parameter pack at an outer level which we have already substituted to refer to expanded parameters, but where the containing pack expansion cannot yet be expanded.

    *)
  63. | MaterializeTemporaryExpr of materialize_tmp_expr
    (*

    (C++) Represents a prvalue temporary that is written into memory so that a reference can bind to it.

    *)
  64. | PackExpansionExpr of pack_expansion_expr
    (*

    (C++) Represents a C++11 pack expansion that produces a sequence of expressions.

    *)
  65. | SizeOfPackExpr of size_of_pack_expr
    (*

    (C++) Represents an expression that computes the length of a parameter pack.

    *)
  66. | SubstNonTypeTemplateParmExpr of subst_non_type_template_param_expr
    (*

    (C++) Represents a reference to a non-type template parameter that has been substituted with a template argument.

    *)
  67. | SubstNonTypeTemplateParmPackExpr of subst_non_type_template_param_pack_expr
    (*

    (C++) Represents a reference to a non-type template parameter pack that has been substituted with a non-template argument pack.

    *)
  68. | TypeTraitExpr of type_trait_expr
    (*

    (C++) A type trait used in the implementation of various C++11 and Library TR1 trait templates.

    *)
  69. | UnresolvedLookupExpr of unresolved_lookup_expr
    (*

    (C++) A reference to a name which we were able to look up during parsing but could not resolve to a specific declaration.

    *)
  70. | UnresolvedMemberExpr of unresolved_member_expr
    (*

    (C++) Represents a C++ member access expression for which lookup produced a set of overloaded functions.

    *)
  71. | LambdaExpr of lambda_expr
    (*

    (C++) A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked later.

    *)
  72. | ConvertVectorExpr of expr
    (*

    Clang builtin function __builtin_convertvector This AST node provides support for converting a vector type to another vector type of the same arity

    *)
  73. | ExtVectorElementExpr of expr * string
    (*

    accessor

    *)
  74. | ShuffleVectorExpr of expr array
    (*

    Clang-specific builtin-in function __builtin_shufflevector.

    *)
  75. | UnknownExpr of int * string
    (*

    Unhandled Expr node

    *)

All the different kinds of expressions.

and conditional_operator = Clang_AST.conditional_operator = {
  1. cond_cond : expr;
    (*

    condition

    *)
  2. cond_true : expr;
    (*

    true expression

    *)
  3. cond_false : expr;
    (*

    false expression

    *)
}

The ?: ternary operator

and binary_conditional_operator = Clang_AST.binary_conditional_operator = {
  1. bcond_cond : expr;
    (*

    condition and true expression

    *)
  2. bcond_false : expr;
    (*

    false expression

    *)
}

Binary version of the ?: operator (GNU extension)

and array_init_loop_expr = Clang_AST.array_init_loop_expr = {
  1. array_init_source : opaque_expr;
    (*

    source array

    *)
  2. array_init_init : expr;
    (*

    initializer

    *)
  3. array_init_size : Z.t;
    (*

    array size

    *)
}

Represents a loop initializing the elements of an array

and array_subscript_expr = Clang_AST.array_subscript_expr = {
  1. subscript_base : expr;
    (*

    base (array)

    *)
  2. subscript_index : expr;
    (*

    index expression

    *)
}

Array subscripting (normalized: we always put the array expression first and the index expression last, although the source may state '4A' and not 'A4')

and atomic_expr = Clang_AST.atomic_expr = {
  1. atomic_op : int;
    (*

    Kind of atomic builtin operator. TODO: use a variant.

    *)
  2. atomic_ptr : expr;
    (*

    primary pointer

    *)
  3. atomic_order : expr;
    (*

    memory order

    *)
}

Variadic atomic builtins. TODO: handle operators that have more that 2 arguments

and binary_operator = Clang_AST.binary_operator =
  1. | BO_Mul
    (*

    *

    *)
  2. | BO_Div
    (*

    /

    *)
  3. | BO_Rem
    (*

    %

    *)
  4. | BO_Add
    (*
    *)
  5. | BO_Sub
    (*
    *)
  6. | BO_Shl
    (*

    <<

    *)
  7. | BO_Shr
    (*

    >>

    *)
  8. | BO_LT
    (*

    <

    *)
  9. | BO_GT
    (*

    >

    *)
  10. | BO_LE
    (*

    <=

    *)
  11. | BO_GE
    (*

    >=

    *)
  12. | BO_EQ
    (*

    ==

    *)
  13. | BO_NE
    (*

    !=

    *)
  14. | BO_And
    (*

    bitwise &

    *)
  15. | BO_Xor
    (*

    bitwise ^

    *)
  16. | BO_Or
    (*

    bitwise |

    *)
  17. | BO_LAnd
    (*

    logical and

    *)
  18. | BO_LOr
    (*

    || logical or

    *)
  19. | BO_Comma
    (*

    ,

    *)
  20. | BO_Assign
    (*

    =

    *)
  21. | BO_PtrMemD
    (*

    (C++) .*

    *)
  22. | BO_PtrMemI
    (*

    (C++) ->*

    *)

Binary operators (including regular assignment)

and compound_assign_operator = Clang_AST.compound_assign_operator =
  1. | BO_MulAssign
    (*

    *=

    *)
  2. | BO_DivAssign
    (*

    /=

    *)
  3. | BO_RemAssign
    (*

    %=

    *)
  4. | BO_AddAssign
    (*

    +=

    *)
  5. | BO_SubAssign
    (*

    -=

    *)
  6. | BO_ShlAssign
    (*

    <<=

    *)
  7. | BO_ShrAssign
    (*

    >>=

    *)
  8. | BO_AndAssign
    (*

    &=

    *)
  9. | BO_XorAssign
    (*

    ^=

    *)
  10. | BO_OrAssign
    (*

    |=

    *)

Compound assignment operators (excluding regular assignment)

and compound_assign_expr = Clang_AST.compound_assign_expr = {
  1. compound_lval : expr;
    (*

    left argument

    *)
  2. compound_comp_lval_type : type_qual;
    (*

    the type the left argument is converted to before the operation

    *)
  3. compound_op : compound_assign_operator;
    (*

    operator

    *)
  4. compound_rval : expr;
    (*

    right argument

    *)
  5. compound_comp_result_type : type_qual;
    (*

    type of the computed result, before converted back to lvalue type

    *)
}

For compound assignments (e.g. +=), we keep track of the type the operation is performed in. Due to the semantics of these operators, the operands are promoted, the arithmetic performed, an implicit conversion back to the result type done, then the assignment takes place. This captures the intermediate type which the computation is done in.

and call_expr = Clang_AST.call_expr = {
  1. call_callee : expr;
    (*

    callee expression

    *)
  2. call_call_decl : function_decl option;
    (*

    callee declaration, if found

    *)
  3. call_args : expr array;
    (*

    arguments

    *)
  4. call_operator : overloaded_operator option;
    (*

    (C++) if this is a call to an overloaded operator, give its name

    *)
}

Represents a function call. In C++, this also represents a method call or an overloaded operator call, in which case the callee is a MemberExpr contaning both the objet argument (possibly an implicit this made explicit) and the member function. We don't expose Clang's CXXMemberCallExpr and CXXOperatorCallExpr, which are redundant.

and unary_operator = Clang_AST.unary_operator =
  1. | UO_PostInc
    (*

    ++

    *)
  2. | UO_PostDec
    (*

    --

    *)
  3. | UO_PreInc
    (*

    ++

    *)
  4. | UO_PreDec
    (*

    --

    *)
  5. | UO_AddrOf
    (*

    &

    *)
  6. | UO_Deref
    (*

    *

    *)
  7. | UO_Plus
    (*
    *)
  8. | UO_Minus
    (*
    *)
  9. | UO_Not
    (*

    ~

    *)
  10. | UO_LNot
    (*

    !

    *)
  11. | UO_Real
    (*

    __real extension

    *)
  12. | UO_Imag
    (*

    __imag extension

    *)
  13. | UO_Extension
    (*

    __extension__ marker

    *)
  14. | UO_Coawait
    (*

    (C++) coroutines co_await operator

    *)
and cast_kind = Clang_AST.cast_kind =
  1. | CStyleCast
    (*

    An explicit cast in C (C99 6.5.4) or a C-style cast in C++ (C++ expr.cast), which uses the syntax (Type)expr

    *)
  2. | CXXFunctionalCast
    (*

    (C++) An explicit C++ type conversion that uses "functional" notation (C++ expr.type.conv). More

    *)
  3. | CXXConstCast
    (*

    A(C++) C++ const_cast

    *)
  4. | CXXDynamicCast
    (*

    (C++) A C++ dynamic_cast

    *)
  5. | CXXReinterpretCast
    (*

    (C++) A C++ reinterpret_cast

    *)
  6. | CXXStaticCast
    (*

    (C++) A C++ static_cast

    *)
  7. | ImplicitCast
    (*

    Implicit type conversions, which have no direct representation in the original source code

    *)

Different categories of type conversion

and character_kind = Clang_AST.character_kind =
  1. | Char_Ascii
    (*

    aka Ordinary in Clang >= 15

    *)
  2. | Char_Wide
  3. | Char_UTF8
  4. | Char_UTF16
  5. | Char_UTF32
  6. | Char_Unevaluated
    (*

    Kinds of character and string literals

    *)
and choose_expr = Clang_AST.choose_expr = {
  1. choose_cond : expr;
    (*

    condition

    *)
  2. choose_true : expr;
    (*

    left expression, for true

    *)
  3. choose_false : expr;
    (*

    right expression, for false

    *)
  4. choose_cond_true : bool;
    (*

    whether the condition is true

    *)
}

GNU builtin-in function __builtin_choose_expr

and designator = Clang_AST.designator =
  1. | Designator_Field of field_decl
  2. | Designator_Array of expr
  3. | Designator_ArrayRange of expr * expr
    (*

    Represents a single C99 designator

    *)
and generic_selection_expr = Clang_AST.generic_selection_expr = {
  1. select_controling : expr;
    (*

    unevaluated controlling expression

    *)
  2. select_assoc : expr array;
    (*

    generic associations

    *)
  3. select_result : int;
    (*

    index of the resulting expression

    *)
}

Generic selection

and init_list_expr = Clang_AST.init_list_expr = {
  1. init_list_init : expr array;
    (*

    initializers

    *)
  2. init_list_field_in_union : field_decl option;
    (*

    if this initializes an union field, specify which field

    *)
  3. init_list_filler : expr option;
    (*

    if this initializer list initializes an array with more elements than there are initializers in the list, specifies an expression to be used for value initialization of the rest of the elements

    *)
}

Describes an initializer list, which can be used to initialize objects of different types, including struct/class/union types, arrays, and vectors.

and member_expr = Clang_AST.member_expr = {
  1. member_base : expr;
    (*

    base

    *)
  2. member_decl : decl;
    (*

    member declaration to which this expession refers

    *)
  3. member_arrow : bool;
    (*

    true for arrow ->, false for dot . access

    *)
  4. member_qualifier : name_specifier_loc list option;
    (*

    (C++) if the member name was qualified, retrieves the nested-name-specifier that precedes the member name, with source-location information

    *)
  5. member_template_args : template_argument_loc array;
    (*

    (C++) template arguments provided as part of this template-id

    *)
  6. member_name : declaration_name;
    (*

    member declaration name

    *)
}

Structure and union members. X->F and X.F. In C++, also method or overloaded operator.

and pseudo_object_expr = Clang_AST.pseudo_object_expr = {
  1. pseudo_object_syntactic_form : expr;
    (*

    syntactic form

    *)
  2. pseudo_object_semantic : expr array;
    (*

    semantic forms

    *)
  3. pseudo_object_result : int option;
    (*

    index in the semantic form list of the expression that returns a value, if any

    *)
}

An expression which accesses a pseudo-object l-value.

and offsetof_node = Clang_AST.offsetof_node =
  1. | Offsetof_Array of expr
  2. | Offsetof_Field of field_decl
  3. | Offsetof_Identifier of string
    (*

    A component in OffsetOfExpr

    *)
and ident_type = Clang_AST.ident_type =
  1. | Ident_Func
  2. | Ident_Function
  3. | Ident_LFunction
  4. | Ident_FuncDName
  5. | Ident_FuncSig
  6. | Ident_PrettyFunction
  7. | Ident_PrettyFunctionNoVirtual
    (*

    Type of predefined expression

    *)
and opaque_expr = Clang_AST.opaque_expr = {
  1. opaque_source : expr option;
  2. opaque_type : type_qual;
  3. opaque_range : range;
}

An opaque value, pointing to its source expression.

and unary_expr_or_type = Clang_AST.unary_expr_or_type =
  1. | UETT_SizeOf
  2. | UETT_AlignOf
  3. | UETT_PreferredAlignOf
and array_type_trait = Clang_AST.array_type_trait =
  1. | ATT_ArrayRank
  2. | ATT_ArrayExtent
    (*

    (C++) Names for the array type traits.

    *)
and array_type_trait_expr = Clang_AST.array_type_trait_expr = {
  1. trait_trait : array_type_trait;
  2. trait_type : type_qual;
    (*

    queried type

    *)
  3. trait_value : Int64.t;
  4. trait_dimension : expr;
}

(C++) An embarcadero array type trait, as used in the implementation of __array_rank and __array_extent.

and unresolved_lookup_expr = Clang_AST.unresolved_lookup_expr = {
  1. unresolved_lookup_requires_ADL : bool;
    (*

    true if this declaration should be extended by argument-dependent lookup

    *)
  2. unresolved_lookup_is_implicit : bool;
    (*

    true if this lookup is overloaded

    *)
  3. unresolved_lookup_naming_class : record_decl option;
    (*

    the naming class of this lookup.

    *)
  4. unresolved_lookup_name : declaration_name;
    (*

    name looked up

    *)
  5. unresolved_lookup_decls : decl list;
  6. unresolved_lookup_template : template_argument_loc array;
}

(C++) A reference to a name which we were able to look up during parsing but could not resolve to a specific declaration. This arises in several ways: we might be waiting for argument-dependent lookup; the name might resolve to an overloaded function; and eventually: the lookup might have included a function template. These never include UnresolvedUsingValueDecls, which are always class members and therefore appear only in UnresolvedMemberLookupExprs.

and unresolved_member_expr = Clang_AST.unresolved_member_expr = {
  1. unresolved_member_base : expr option;
    (*

    the base object of this member expressions, e.g., the x in x.m; None if implicit

    *)
  2. unresolved_member_base_type : type_qual;
  3. unresolved_member_is_implicit_access : bool;
    (*

    true if this is an implicit access, i.e., one in which the member being accessed was not written in the source

    *)
  4. unresolved_member_is_arrow : bool;
    (*

    true if this member expression used the '->' operator; otherwise, it used the '.' operator

    *)
  5. unresolved_member_naming_class : record_decl option;
    (*

    the naming class of this lookup.

    *)
  6. unresolved_member_member_name : declaration_name;
    (*

    the name of the member that this expression refers to

    *)
  7. unresolved_member_name : declaration_name;
    (*

    name looked up

    *)
  8. unresolved_member_decls : decl list;
  9. unresolved_member_template : template_argument_loc array;
}

(C++) Represents a C++ member access expression for which lookup produced a set of overloaded functions. The member access may be explicit or implicit. In the final AST, an explicit access always becomes a MemberExpr. An implicit access may become either a MemberExpr or a DeclRefExpr, depending on whether the member is static.

and lambda_expr = Clang_AST.lambda_expr = {
  1. lambda_capture_default : lambda_capture_default;
    (*

    the default capture kind for this lambda.

    *)
  2. lambda_captures : lambda_capture list;
    (*

    this lambda's (implicit and explicit) captures

    *)
  3. lambda_capture_inits : expr list;
    (*

    the initialization expressions for this lambda's captures

    *)
  4. lambda_class : record_decl;
    (*

    the class that corresponds to the lambda

    *)
  5. lambda_call_operator : function_decl;
    (*

    the function call operator associated with this lambda expression

    *)
  6. lambda_template_parameter : template_parameter_list option;
    (*

    tf this is a generic lambda expression, retrieve the template parameter list associated with it; else None

    *)
  7. lambda_is_generic : bool;
    (*

    whether this is a generic lambda

    *)
  8. lambda_body : stmt;
    (*

    the body of the lambda

    *)
  9. lambda_is_mutable : bool;
    (*

    whether the lambda is mutable, meaning that any captures values can be modified

    *)
  10. lambda_has_explicit_parameters : bool;
    (*

    whether this lambda has an explicit parameter list vs. an implicit (empty) parameter list.

    *)
  11. lambda_has_explicit_result_type : bool;
    (*

    whether this lambda had its result type explicitly specified

    *)
}

(C++) A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked later. C++11 lambda expressions can capture local variables, either by copying the values of those local variables at the time the function object is constructed (not when it is called!) or by holding a reference to the local variable. These captures can occur either implicitly or can be written explicitly between the square brackets (...) that start the lambda expression. C++1y introduces a new form of "capture" called an init-capture that includes an initializing expression (rather than capturing a variable), and which can never occur implicitly.

and lambda_capture = Clang_AST.lambda_capture = {
  1. lambda_capture_kind : lambda_capture_kind;
  2. lambda_capture_this : bool;
    (*

    whether this capture handles the C++ this pointer

    *)
  3. lambda_capture_VLA_type : bool;
    (*

    whether this captures a variable length array bound expressio

    *)
  4. lambda_capture_captured_var : decl option;
    (*

    declaration of the local variable being captured, if any

    *)
  5. lambda_capture_is_implicit : bool;
    (*

    whether this was an implicit capture (not written between the square brackets introducing the lambda)

    *)
  6. lambda_capture_is_pack_expansion : bool;
    (*

    whether this capture is a pack expansion, which captures a function parameter pack

    *)
}

Describes the capture of a variable or of this, or of a C++1y init-capture.

and lambda_capture_default = Clang_AST.lambda_capture_default =
  1. | LCD_None
  2. | LCD_ByCopy
  3. | LCD_ByRef
    (*

    (C++) The default, if any, capture method for a lambda expression.

    *)
and lambda_capture_kind = Clang_AST.lambda_capture_kind =
  1. | LCK_This
    (*

    Capturing the *this object by reference.

    *)
  2. | LCK_StarThis
    (*

    Capturing the *this object by copy

    *)
  3. | LCK_ByCopy
    (*

    Capturing by copy (a.k.a., by value)

    *)
  4. | LCK_ByRef
    (*

    Capturing by reference.

    *)
  5. | LCK_VLAType
    (*

    Capturing variable-length array type.

    *)

The different capture forms in a lambda introducer. C++11 allows capture of this, or of local variables by copy or by reference. C++1y also allows "init-capture", where the initializer is an expression.

and cxx_construct_expr = Clang_AST.cxx_construct_expr = {
  1. construct_decl : function_decl;
    (*

    constructor called

    *)
  2. construct_kind : construction_kind;
  3. construct_args : expr array;
    (*

    arguments

    *)
  4. construct_requires_zero_init : bool;
    (*

    whether the construction first requires zero-initialization before the initializer is called

    *)
  5. construct_temporary : bool;
    (*

    true epresents a C++ functional cast expression that builds a temporary object.

    *)
}

(C++) Represents a call to a C++ constructor

and cxx_delete_expr = Clang_AST.cxx_delete_expr = {
  1. delete_arg : expr;
    (*

    argument

    *)
  2. delete_op_delete : function_decl option;
    (*

    delete operator executed, if known

    *)
  3. delete_destroyed_type : type_qual option;
    (*

    type being destroyed; None for a dependent type

    *)
  4. delete_is_global : bool;
    (*

    global delete (::delete) used?

    *)
  5. delete_is_array : bool;
    (*

    is array form

    *)
  6. delete_array_want_size : bool;
    (*

    whether the array deallocation function expects the size of the allocation as a parameter

    *)
}

(C++) Represents a delete expression for memory deallocation and destructor calls.

and cxx_dependent_scope_member_expr = Clang_AST.cxx_dependent_scope_member_expr = {
  1. dependent_base : expr option;
    (*

    base pointer expressionm or None for an implicit acccess

    *)
  2. dependent_base_type : type_qual;
    (*

    base type

    *)
  3. dependent_arrow : bool;
    (*

    true for arrow ->, false for dot . access

    *)
  4. dependent_qualifier : name_specifier_loc list;
    (*

    nested-name-specifier that qualifies the member name, with source location information.

    *)
  5. dependent_first_qualifier : decl option;
    (*

    first part of the nested-name-specifier that was found in the scope of the member access expression when the member access was initially parsed

    *)
  6. dependent_member : declaration_name;
    (*

    member that this expression refers to

    *)
  7. dependent_template_args : template_argument_loc array;
    (*

    template arguments provided as part of this template-id

    *)
}

(C++) Represents a C++ member access expression where the actual member referenced could not be resolved because the base expression or the member name was dependent.

and cxx_fold_expr = Clang_AST.cxx_fold_expr = {
  1. fold_pattern : expr;
    (*

    pattern (operand that contains an unexpanded pack

    *)
  2. fold_init : expr option;
    (*

    operand that doesn't contain a pack for a binary fold, for a binary fold; None otherwise

    *)
  3. fold_right_fold : bool;
    (*

    true for right-associated sequence of operators, false for left associated

    *)
  4. fold_operator : binary_operator;
    (*

    operator

    *)
}
and cxx_inherited_ctor = Clang_AST.cxx_inherited_ctor = {
  1. inherited_ctor : function_decl;
    (*

    constructor called

    *)
  2. inherited_ctor_kind : construction_kind;
  3. inherited_ctor_constructs_vbase : bool;
    (*

    whether this constructor is actually constructing a base class (rather than a complete object)

    *)
  4. inherited_ctor_inherited_from_vbase : bool;
    (*

    whether the inherited constructor is inherited from a virtual base of the object we construct

    *)
}

(C++) Represents a call to an inherited base class constructor from an inheriting constructor.

and cxx_new_expr = Clang_AST.cxx_new_expr = {
  1. new_alloctype : type_qual;
    (*

    allocated type

    *)
  2. new_op_new : function_decl option;
    (*

    new operator executed, if known

    *)
  3. new_op_delete : function_decl option;
    (*

    delete operator executed, if known

    *)
  4. new_array_size : expr option;
    (*

    array size expression, None if not array allocation

    *)
  5. new_is_global : bool;
    (*

    global new (::new) used?

    *)
  6. new_style : initialization_style;
  7. new_initialier : expr option;
    (*

    (optional) initialisation expression

    *)
  8. new_args : expr array;
    (*

    placement arguments

    *)
  9. new_construct : cxx_construct_expr option;
    (*

    construct expression, if any

    *)
  10. new_pass_alignment : bool;
    (*

    indicates whether the required alignment should be implicitly passed to the allocation function

    *)
  11. new_array_want_size : bool;
    (*

    whether the array deallocation function expects the size of the allocation as a parameter

    *)
}

(C++) Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)".

and cxx_pseudo_destructor_expr = Clang_AST.cxx_pseudo_destructor_expr = {
  1. destructor_base : expr;
  2. destructor_qualifier : name_specifier_loc list option;
    (*

    if the member name was qualified, retrieves the nested-name-specifier that precedes the member name

    *)
  3. destructor_is_arrow : bool;
    (*

    whether this pseudo-destructor expression was written using an '->' (true) or '.' (false)

    *)
  4. destructor_destroyed_type : type_qual;
    (*

    retrieve the type being destroyed.

    *)
}

(C++) Represents a C++ pseudo-destructor (C++ expr.pseudo).

and cxx_throw_expr = Clang_AST.cxx_throw_expr = {
  1. throw_expr : expr option;
    (*

    thrown expression, or None for rethrow

    *)
  2. throw_is_thrown_variable_in_scope : bool;
    (*

    whether the variable thrown by this expression (if any!) is within the innermost try block

    *)
}

(C++) A C++ throw-expression (C++ except.throw). This handles 'throw' (for re-throwing the current exception) and 'throw' assignment-expression

and cxx_typeid_expr = Clang_AST.cxx_typeid_expr = {
  1. typeid_type_operand : type_qual option;
    (*

    typeid(type) form: get the type operandafter various required adjustments (removing reference types, cv-qualifiers); None for typeid(expr)

    *)
  2. typeid_expr_operand : expr option;
    (*

    typeid(expr) form: expression argument; None for typeid(type)

    *)
  3. typeid_is_potentially_evaluated : bool;
    (*

    determine whether this typeid has a type operand which is potentially evaluated, per C++11 expr.typeidp3

    *)
}

(C++) A C++ typeid expression (C++ expr.typeid), which gets the type_info that corresponds to the supplied type, or the (possibly dynamic) type of the supplied expression. This represents code like typeid(int) or typeid( *objPtr ).

and cxx_unresolved_construct_expr = Clang_AST.cxx_unresolved_construct_expr = {
  1. unresolved_construct_type_as_written : type_qual;
    (*

    the type that is being constructed, as specified in the source code

    *)
  2. unresolved_construct_args : expr array;
    (*

    arguments

    *)
}

(C++) Describes an explicit type conversion that uses functional notion but could not be resolved because one or more arguments are type-dependent.

and construction_kind = Clang_AST.construction_kind =
  1. | CK_Complete
  2. | CK_NonVirtualBase
  3. | CK_VirtualBase
  4. | CK_Delegating
    (*

    (C++) Kind of C++ constructor call.

    *)
and dependent_scope_decl_ref_expr = Clang_AST.dependent_scope_decl_ref_expr = {
  1. dependent_decl_name : declaration_name;
    (*

    the name that this expression refers to

    *)
  2. dependent_decl_qualifier_loc : name_specifier_loc list;
    (*

    nested-name-specifier that qualifies the name, with source location information

    *)
  3. dependent_decl_template_args : template_argument_loc array;
}

(C++) A qualified reference to a name whose declaration cannot yet be resolved. DependentScopeDeclRefExpr is similar to DeclRefExpr in that it expresses a reference to a declaration such as X<T>::value. The difference, however, is that an DependentScopeDeclRefExpr node is used only within C++ templates when the qualification (e.g., X<T>::) refers to a dependent type. In this case, X<T>::value cannot resolve to a declaration because the declaration will differ from one instantiation of X<T> to the next. Therefore, DependentScopeDeclRefExpr keeps track of the qualifier (X<T>::) and the name of the entity being referenced ("value"). Such expressions will instantiate to a DeclRefExpr once the declaration can be found.

and expression_trait_expr = Clang_AST.expression_trait_expr = {
  1. expr_trait_trait : expression_trait;
  2. expr_trait_queried_expr : expr;
  3. expr_trait_value : bool;
}

(C++) An expression trait intrinsic.

and expression_trait = Clang_AST.expression_trait =
  1. | ET_IsLValueExpr
  2. | ET_IsRValueExpr
and expr_with_cleanups = Clang_AST.expr_with_cleanups = {
  1. cleanup_expr : expr;
  2. cleanup_cleanups : block_decl array;
}

(C++) Represents an expression – generally a full-expression – that introduces cleanups to be run at the end of the sub-expression's evaluation.The most common source of expression-introduced cleanups is temporary objects in C++, but several other kinds of expressions can create cleanups, including basically every call in ARC that returns an Objective-C pointer. This expression also tracks whether the sub-expression contains a potentially-evaluated block literal. The lifetime of a block literal is the extent of the enclosing scope.

and block_decl = Clang_AST.block_decl = {
  1. block_body : stmt option;
    (*

    if this represents a declaration for a body of code, such as a function or method definition, this is the top-level stmt of the body; otherwise None

    *)
  2. block_params : param_var_decl array;
    (*

    arguments

    *)
  3. block_captures : capture array;
    (*

    captured variables

    *)
  4. block_captures_cxx_this : bool;
  5. block_is_variadic : bool;
  6. block_missing_return_type : bool;
  7. block_is_conversion_from_lambda : bool;
}

(C++) This represents a block literal declaration, which is like an unnamed FunctionDecl. For example: ^{ statement-body } or ^(int arg1, float arg2){ statement-body }

and capture = Clang_AST.capture = {
  1. capture_var : var_decl;
    (*

    the variable being captured

    *)
  2. capture_is_by_ref : bool;
    (*

    whether this is a "by ref" capture, i.e. a capture of a __block variable

    *)
  3. capture_is_nested : bool;
    (*

    whether this is a nested capture, i.e. the variable captured is not from outside the immediately enclosing function/block

    *)
  4. capture_copy_expr : expr option;
}

(C++) Contains all the information about a particular captured value.

and friend_decl = Clang_AST.friend_decl = {
  1. friend_type : type_qual option;
    (*

    if this friend declaration names an (untemplated but possibly dependent) type, return the type

    *)
  2. friend_decl : decl option;
    (*

    if this friend declaration doesn't name a type, return the inner declaration

    *)
  3. friend_is_unsupported : bool;
    (*

    wheter this friend kind is unsupported

    *)
  4. friend_template : template_parameter_list array;
  5. friend_range : range;
  6. friend_com : comment list;
}

(C++) Represents the declaration of a friend entity, which can be a function, a type, or a templated function or type.

and template_parameter_list = Clang_AST.template_parameter_list = {
  1. template_parameter_list_params : decl array;
  2. template_parameter_list_requires_clause : expr option;
}

(C++) Stores a list of template parameters for a TemplateDecl and its derived classes.

and static_assert = Clang_AST.static_assert = {
  1. assert_expr : expr;
  2. assert_msg : expr option;
  3. assert_is_failed : bool;
}

(C++) Represents a C++11 static_assert declaration.

and namespace_decl = Clang_AST.namespace_decl = {
  1. namespace_name : name;
  2. namespace_is_anonymous : bool;
    (*

    true if this is an anonymous namespace declaration

    *)
  3. namespace_is_inline : bool;
    (*

    true if this is an inline namespace declaration

    *)
}

(C++) Represent a C++ namespace.

and namespace_alias_decl = Clang_AST.namespace_alias_decl = {
  1. namespace_alias_name : name;
  2. namespace_alias_namespace : namespace_decl;
    (*

    the namespace declaration aliased by this directive

    *)
  3. namespace_alias_aliased_namespace : decl;
    (*

    namespace that this alias refers to, which may either be a NamespaceDecl or a NamespaceAliasDecl

    *)
  4. namespace_alias_qualifier : name_specifier_loc list;
    (*

    the nested-name-specifier that qualifies the name of the namespace, with source-location information

    *)
}

(C++) Represents a C++ namespace alias.

and builtin_template_decl = Clang_AST.builtin_template_decl = {
  1. builtin_template_name : name;
  2. builtin_template_param : template_parameter_list;
    (*

    the list of template parameters

    *)
  3. builtin_template_decl : decl option;
    (*

    underlying, templated declaration

    *)
  4. builtin_template_requires_clause : expr option;
    (*

    the constraint-expression from the associated requires-clause (if any)

    *)
  5. builtin_template_kind : builtin_template_kind;
}

(C++) Represents the builtin template declaration which is used to implement __make_integer_seq and other builtin templates

and builtin_template_kind = Clang_AST.builtin_template_kind =
  1. | BTK__make_integer_seq
    (*

    this names the __make_integer_seq BuiltinTemplateDecl

    *)
  2. | BTK__type_pack_element
    (*

    this names the __type_pack_element BuiltinTemplateDecl

    *)

Kinds of BuiltinTemplateDecl

and class_template_decl = Clang_AST.class_template_decl = {
  1. class_template_name : name;
  2. class_template_param : template_parameter_list;
    (*

    the list of template parameters

    *)
  3. class_template_decl : record_decl;
    (*

    underlying, templated declaration

    *)
  4. class_template_requires_clause : expr option;
    (*

    the constraint-expression from the associated requires-clause (if any)

    *)
  5. class_template_specializations : record_decl list;
    (*

    specializations (NOTE: left empty for now)

    *)
  6. class_template_injected_type : type_qual;
    (*

    template specialization type of the injected-class-name for this class template

    *)
}

(C++) Declaration of a class template.

and class_template_specialization = Clang_AST.class_template_specialization = {
  1. class_template_specialization_decl : class_template_decl;
    (*

    original template

    *)
  2. class_template_specialization_args : template_argument array;
    (*

    template arguments

    *)
}

(C++) Additional record information when it comes from a template.

and function_template_decl = Clang_AST.function_template_decl = {
  1. function_template_name : name;
  2. function_template_param : template_parameter_list;
    (*

    the list of template parameters

    *)
  3. function_template_decl : function_decl;
    (*

    underlying function declaration of the template

    *)
  4. function_template_requires_clause : expr option;
    (*

    the constraint-expression from the associated requires-clause (if any)

    *)
  5. function_template_specializations : function_decl list;
    (*

    specializations (NOTE: left empty for now)

    *)
}

(C++) Declaration of a template function.

and function_template_specialization = Clang_AST.function_template_specialization = {
  1. function_template_specialization_decl : function_template_decl;
    (*

    original template

    *)
  2. function_template_specialization_args : template_argument array;
    (*

    template arguments

    *)
}

(C++) Additional function information when it comes from a template.

and type_alias_template_decl = Clang_AST.type_alias_template_decl = {
  1. alias_template_name : name;
  2. alias_template_param : template_parameter_list;
    (*

    the list of template parameters

    *)
  3. alias_template_decl : typedef_decl;
    (*

    underlying, templated declaration

    *)
  4. alias_template_requires_clause : expr option;
    (*

    the constraint-expression from the associated requires-clause (if any)

    *)
}

(C++) Declaration of an alias template.

and var_template_decl = Clang_AST.var_template_decl = {
  1. var_template_name : name;
  2. var_template_param : template_parameter_list;
    (*

    the list of template parameters

    *)
  3. var_template_decl : var_decl;
    (*

    underlying, templated declaration

    *)
  4. var_template_requires_clause : expr option;
    (*

    the constraint-expression from the associated requires-clause (if any)

    *)
  5. var_template_specializations : var_decl list;
    (*

    specializations (NOTE: left empty for now)

    *)
}

(C++) Declaration of a variable template.

and var_template_specialization = Clang_AST.var_template_specialization = {
  1. var_template_specialization_decl : var_template_decl;
    (*

    original template

    *)
  2. var_template_specialization_args : template_argument array;
    (*

    template arguments

    *)
}

(C++) Additional variable information when it comes from a template.

and template_template_param_decl = Clang_AST.template_template_param_decl = {
  1. template_param_name : name;
  2. template_param_param : template_parameter_list;
    (*

    the list of template parameters

    *)
  3. template_param_decl : decl option;
    (*

    underlying, templated declaration

    *)
  4. template_param_requires_clause : expr option;
    (*

    the constraint-expression from the associated requires-clause (if any)

    *)
  5. template_param_is_parameter_pack : bool;
    (*

    whether this template template parameter is a template parameter pack

    *)
  6. template_param_is_pack_expansion : bool;
    (*

    whether this parameter pack is a pack expansion

    *)
  7. template_param_expansion_template_param : template_parameter_list array;
    (*

    expansion template parameters in an expanded parameter pack

    *)
  8. template_param_default : template_argument_loc option;
    (*

    the default argument, if any

    *)
}

(C++) Declares a template template parameter, e.g., "T" in. template <template <typename> class T> class container { };

and template_type_param_decl = Clang_AST.template_type_param_decl = {
  1. template_type_param_name : name;
  2. template_type_param_default : type_qual option;
    (*

    the default argument, if any

    *)
}

(C++) Declaration of a template type parameter.

and unresolved_using_typename_decl = Clang_AST.unresolved_using_typename_decl = {
  1. unresolved_using_typename_name : name;
  2. unresolved_using_typename_qualifier : name_specifier_loc list;
  3. unresolved_using_typename_is_pack_expansion : bool;
}

(C++) Represents a dependent using declaration which was marked with typename.

and using_decl = Clang_AST.using_decl = {
  1. using_name : name;
  2. using_qualifier : name_specifier_loc list;
  3. using_has_typename : bool;
}

(C++) Represents a C++ using-declaration.

and using_directive_decl = Clang_AST.using_directive_decl = {
  1. using_directive_name : name;
  2. using_directive_qualifier : name_specifier list;
  3. using_directive_namespace : namespace_decl;
    (*

    nominated namespace

    *)
}

(C++) Represents C++ using-directive.

and using_pack_decl = Clang_AST.using_pack_decl = {
  1. using_pack_name : name;
  2. using_pack_decl : decl;
    (*

    using declaration from which this was instantiated

    *)
  3. using_pack_expansion : decl array;
    (*

    set of using declarations that this pack expanded into; note that some of these may still be unresolved

    *)
}

(C++) Represents a pack of using declarations that a single using-declarator pack-expanded into.

and using_shadow_decl = Clang_AST.using_shadow_decl = {
  1. using_shadow_name : name;
  2. using_shadow_target : decl;
    (*

    underlying declaration which has been brought into the local scope

    *)
  3. using_shwdow_using : using_decl;
    (*

    using declaration to which this declaration is tied

    *)
}

(C++) Represents a shadow declaration introduced into a scope by a (resolved) using declaration.

and binding_decl = Clang_AST.binding_decl = {
  1. binding_name : name;
  2. binding_type : type_qual;
  3. binding_binding : expr;
    (*

    the expression to which this declaration is bound.

    *)
  4. binding_holding_var : var_decl option;
    (*

    the variable (if any) that holds the value of evaluating the binding

    *)
}

(C++) A bining in a decomposition declaration.

and indirect_field_decl = Clang_AST.indirect_field_decl = {
  1. indirect_field_name : name;
  2. indirect_field_type : type_qual;
  3. indirect_field_anon_field : field_decl;
  4. indirect_field_var : var_decl option;
  5. indirect_field_chain : decl array;
}

An instance of this class is created to represent a field injected from an anonymous union/struct into the parent scope.

and unresolved_using_value_decl = Clang_AST.unresolved_using_value_decl = {
  1. unresolved_using_value_name : name;
  2. unresolved_using_value_type : type_qual;
  3. unresovled_using_value_qualifier : name_specifier_loc list;
    (*

    nested-name-specifier that qualifies the name, with source-location information

    *)
  4. unresovled_using_value_is_access_declaration : bool;
    (*

    true if it is a C++03 access declaration (no 'using')

    *)
  5. unresovled_using_value_is_pack_expansion : bool;
    (*

    whether this is a pack expansion

    *)
}

Represents a dependent using declaration which was not marked with typename.

and non_type_template_param_decl = Clang_AST.non_type_template_param_decl = {
  1. non_type_template_name : name;
  2. non_type_template_type : type_qual;
  3. non_type_template_default : expr option;
    (*

    the default argument, if any

    *)
  4. non_type_template_param_is_parameter_pack : bool;
    (*

    whether this template template parameter is a template parameter pack

    *)
  5. non_type_template_param_is_pack_expansion : bool;
    (*

    whether this parameter pack is a pack expansion

    *)
  6. non_type_template_param_expansion : type_qual array;
}

Declares a non-type template parameter.

and materialize_tmp_expr = Clang_AST.materialize_tmp_expr = {
  1. materialize_tmp_expr : expr;
    (*

    temporary-generating subexpression whose value will be materialized into a glvalue

    *)
  2. materialize_storage : storage_duration;
    (*

    storage duration for the materialized temporary

    *)
  3. materialize_extending_decl : decl option;
    (*

    declaration which triggered the lifetime-extension of this temporary, if any.

    *)
  4. materialize_is_bound_to_lvalue_reference : bool;
    (*

    whether this materialized temporary is bound to an lvalue reference; otherwise, it's bound to an rvalue reference

    *)
}

(C++) Represents a prvalue temporary that is written into memory so that a reference can bind to it. Prvalue expressions are materialized when they need to have an address in memory for a reference to bind to. This happens when binding a reference to the result of a conversion, e.g., const int &r = 1.0; Here, 1.0 is implicitly converted to an int. That resulting int is then materialized via a MaterializeTemporaryExpr, and the reference binds to the temporary. MaterializeTemporaryExprs are always glvalues (either an lvalue or an xvalue, depending on the kind of reference binding to it), maintaining the invariant that references always bind to glvalues. Reference binding and copy-elision can both extend the lifetime of a temporary. When either happens, the expression will also track the declaration which is responsible for the lifetime extension.

and pack_expansion_expr = Clang_AST.pack_expansion_expr = {
  1. pack_pattern : expr;
    (*

    pattern of the pack expansion

    *)
  2. pack_num_expansions : int option;
    (*

    umber of expansions that will be produced when this pack expansion is instantiated, if already known

    *)
}

(C++) Represents a C++11 pack expansion that produces a sequence of expressions. A pack expansion expression contains a pattern (which itself is an expression) followed by an ellipsis.

and size_of_pack_expr = Clang_AST.size_of_pack_expr = {
  1. pack_param : decl;
    (*

    corresponding parameter pack declaration

    *)
  2. pack_length : int option;
    (*

    length of parameter pack, or None if the pack is value-dependent

    *)
  3. pack_is_partially_substituted : bool;
    (*

    whether this represents a partially-substituted sizeof expression

    *)
  4. pack_partial_arguments : template_argument array;
}

(C++) Represents an expression that computes the length of a parameter pack: sizeof...(template-parameter)

and subst_non_type_template_param_expr = Clang_AST.subst_non_type_template_param_expr = {
  1. subst_replacement : expr;
  2. subst_parameter : non_type_template_param_decl;
}

(C++) Represents a reference to a non-type template parameter that has been substituted with a template argument.

and subst_non_type_template_param_pack_expr = Clang_AST.subst_non_type_template_param_pack_expr = {
  1. subst_parameter_pack : non_type_template_param_decl;
  2. subst_argument_pack : template_argument;
}

(C++) Represents a reference to a non-type template parameter pack that has been substituted with a non-template argument pack.

and type_trait_expr = Clang_AST.type_trait_expr = {
  1. type_trait_trait : type_trait;
    (*

    which type trait this expression uses

    *)
  2. type_trait_value : bool option;
    (*

    None if value-dependent

    *)
  3. type_trait_args : type_qual array;
    (*

    argument types

    *)
}

(C++) A type trait used in the implementation of various C++11 and Library TR1 trait templates.

and type_trait = Clang_AST.type_trait =
  1. | UTT_HasNothrowAssign
  2. | UTT_HasNothrowMoveAssign
  3. | UTT_HasNothrowCopy
  4. | UTT_HasNothrowConstructor
  5. | UTT_HasTrivialAssign
  6. | UTT_HasTrivialMoveAssign
  7. | UTT_HasTrivialCopy
  8. | UTT_HasTrivialDefaultConstructor
  9. | UTT_HasTrivialMoveConstructor
  10. | UTT_HasTrivialDestructor
  11. | UTT_HasVirtualDestructor
  12. | UTT_IsAbstract
  13. | UTT_IsArithmetic
  14. | UTT_IsArray
  15. | UTT_IsClass
  16. | UTT_IsCompleteType
  17. | UTT_IsCompound
  18. | UTT_IsConst
  19. | UTT_IsDestructible
  20. | UTT_IsEmpty
  21. | UTT_IsEnum
  22. | UTT_IsFinal
  23. | UTT_IsFloatingPoint
  24. | UTT_IsFunction
  25. | UTT_IsFundamental
  26. | UTT_IsIntegral
  27. | UTT_IsInterfaceClass
  28. | UTT_IsLiteral
  29. | UTT_IsLvalueReference
  30. | UTT_IsMemberFunctionPointer
  31. | UTT_IsMemberObjectPointer
  32. | UTT_IsMemberPointer
  33. | UTT_IsNothrowDestructible
  34. | UTT_IsObject
  35. | UTT_IsPOD
  36. | UTT_IsPointer
  37. | UTT_IsPolymorphic
  38. | UTT_IsReference
  39. | UTT_IsRvalueReference
  40. | UTT_IsScalar
  41. | UTT_IsSealed
  42. | UTT_IsSigned
  43. | UTT_IsStandardLayout
  44. | UTT_IsTrivial
  45. | UTT_IsTriviallyCopyable
  46. | UTT_IsUnion
  47. | UTT_IsUnsigned
  48. | UTT_IsVoid
  49. | UTT_IsVolatile
  50. | BTT_IsBaseOf
  51. | BTT_IsConvertible
  52. | BTT_IsConvertibleTo
  53. | BTT_IsSame
  54. | BTT_TypeCompatible
  55. | BTT_IsAssignable
  56. | BTT_IsNothrowAssignable
  57. | BTT_IsTriviallyAssignable
  58. | TT_IsConstructible
  59. | TT_IsNothrowConstructible
  60. | TT_IsTriviallyConstructible
    (*

    (C++) Names for traits that operate specifically on types.

    *)
and name_specifier = Clang_AST.name_specifier =
  1. | Name_specifier_Identifier of string
    (*

    an identifier

    *)
  2. | Name_specifier_Namespace of namespace_decl
    (*

    a namespace

    *)
  3. | Name_specifier_NamespaceAlias of namespace_alias_decl
    (*

    a namespace alias

    *)
  4. | Name_specifier_TypeSpec of typ
    (*

    a type

    *)
  5. | Name_specifier_TypeSpecWithTemplate of typ
    (*

    a type that was preceded by the 'template' keyword

    *)
  6. | Name_specifier_Global
    (*

    the global specifier '::'

    *)

(C++) Nested name specifiers are the prefixes to qualified namespaces. For example, "foo::" in "foo::x" is a nested name specifier. Nested name specifiers are made up of a sequence of specifiers, each of which can be a namespace, type, identifier (for dependent names), decltype specifier, or the global specifier ('::'). The last two specifiers can only appear at the start of a nested-namespace-specifier.

and name_specifier_loc = Clang_AST.name_specifier_loc = {
  1. name_specifier_kind : name_specifier;
  2. name_specifier_range : range;
}
and storage_duration = Clang_AST.storage_duration =
  1. | SD_FullExpression
    (*

    full-expression storage duration (for temporaries)

    *)
  2. | SD_Automatic
    (*

    automatic storage duration (most local variables)

    *)
  3. | SD_Thread
    (*

    thread storage duration

    *)
  4. | SD_Static
    (*

    static storage duration

    *)
  5. | SD_Dynamic
    (*

    dynamic storage duration

    *)

(C++) Storage duration for an object (per C++ basic.stc)

and declaration_name = Clang_AST.declaration_name =
  1. | Name_Identifier of string
    (*

    regular identifier

    *)
  2. | Name_CXXConstrucorName of type_qual
    (*

    C++ constructor

    *)
  3. | Name_CXXDestructorName of type_qual
    (*

    C++ destructor

    *)
  4. | Name_CXXConversionFunctionName of type_qual
    (*

    C++ conversion function

    *)
  5. | Name_CXXDeductionGuideName of decl
    (*

    C++ deduction guide, associated to a template

    *)
  6. | Name_CXXOperatorName of overloaded_operator
  7. | Name_CXXLiteralOperatorName of string
    (*

    Literal operator

    *)
  8. | Name_CXXUsingDirective of string
    (*

    (C++) The name of a declaration, inclusing special case for C++ names (constructors, overloaded operators, etc.

    *)
and overloaded_operator = Clang_AST.overloaded_operator =
  1. | OO_New
    (*

    new

    *)
  2. | OO_Delete
    (*

    delete

    *)
  3. | OO_Array_New
    (*

    new

    *)
  4. | OO_Array_Delete
    (*

    delete

    *)
  5. | OO_Plus
    (*
    *)
  6. | OO_Minus
    (*
    *)
  7. | OO_Star
    (*

    *

    *)
  8. | OO_Slash
    (*

    /

    *)
  9. | OO_Percent
    (*

    %

    *)
  10. | OO_Caret
    (*

    ^

    *)
  11. | OO_Amp
    (*

    &

    *)
  12. | OO_Pipe
    (*

    |

    *)
  13. | OO_Tilde
    (*

    ~

    *)
  14. | OO_Exclaim
    (*

    !

    *)
  15. | OO_Equal
    (*

    =

    *)
  16. | OO_Less
    (*

    <

    *)
  17. | OO_Greater
    (*

    >

    *)
  18. | OO_PlusEqual
    (*

    +=

    *)
  19. | OO_MinusEqual
    (*

    -=

    *)
  20. | OO_StarEqual
    (*

    *=

    *)
  21. | OO_SlashEqual
    (*

    /=

    *)
  22. | OO_PercentEqual
    (*

    %=

    *)
  23. | OO_CaretEqual
    (*

    ^=

    *)
  24. | OO_AmpEqual
    (*

    &=

    *)
  25. | OO_PipeEqual
    (*

    |=

    *)
  26. | OO_LessLess
    (*

    <<

    *)
  27. | OO_GreaterGreater
    (*

    >>

    *)
  28. | OO_LessLessEqual
    (*

    <<=

    *)
  29. | OO_GreaterGreaterEqual
    (*

    >>=

    *)
  30. | OO_EqualEqual
    (*

    ==

    *)
  31. | OO_ExclaimEqual
    (*

    !=

    *)
  32. | OO_LessEqual
    (*

    <=

    *)
  33. | OO_GreaterEqual
    (*

    >=

    *)
  34. | OO_AmpAmp
    (*

    &&

    *)
  35. | OO_PipePipe
    (*

    ||

    *)
  36. | OO_PlusPlus
    (*

    ++

    *)
  37. | OO_MinusMinus
    (*

    --

    *)
  38. | OO_Comma
    (*

    ,

    *)
  39. | OO_ArrowStar
    (*

    ->*

    *)
  40. | OO_Arrow
    (*

    ->

    *)
  41. | OO_Call
    (*

    ()

    *)
  42. | OO_Subscript
    (*

    *)
  43. | OO_Conditional
    (*

    ? (cannot be overloaded, but used in the overload resolution machinery)

    *)
  44. | OO_Coawait
    (*

    co_await

    *)

(C++) Overloadable C++ operators

and template_argument_loc = template_argument * loc

(C++) Location wrapper for a template_argument

and template_argument = Clang_AST.template_argument =
  1. | Template_argument_Null
  2. | Template_argument_Type of type_qual
  3. | Template_argument_Declaration of decl
  4. | Template_argument_NullPtr of type_qual
  5. | Template_argument_Integral of type_qual * Z.t
  6. | Template_argument_Template of template_name
  7. | Template_argument_Expression of expr
  8. | Template_argument_Pack of template_argument * template_argument array
    (*

    argument pack

    *)

(C++) Represents a template argument.

and template_name = Clang_AST.template_name =
  1. | Template_name_Template of decl
    (*

    a single template declaration

    *)
  2. | Template_name_OverloadedTemplate of decl list
    (*

    a set of overloaded template declarations

    *)
  3. | Template_name_QualifiedTemplate of name_specifier list * template_name
    (*

    a qualified template, where the qualification is kept to describe the source code as wrtten

    *)
  4. | Template_name_DependentTemplate of name_specifier list * string option * overloaded_operator option
    (*

    a dependent template name that has not been resolved to a template (or set of templates)

    *)
  5. | Template_name_SubstTemplateTemplateParm of decl * template_name
    (*

    a template template parameter that has been substituted for some other template name

    *)
  6. | Template_name_SubstTemplateTemplateParmPack of decl * template_argument
    (*

    a template template parameter pack that has been substituted for a template template argument pack, but has not yet been expanded into individual arguments

    *)
and initialization_style = Clang_AST.initialization_style =
  1. | New_NoInit
    (*

    New-expression has no initializer as written

    *)
  2. | New_CallInit
    (*

    New-expression has a C++98 paren-delimited initializer

    *)
  3. | New_ListInit
    (*

    New-expression has a C++11 list-initializer

    *)

(C++) Initialization style for new expression (C++).

and expr = Clang_AST.expr = {
  1. expr_kind : expr_kind;
  2. expr_type : type_qual option;
  3. expr_range : range;
}

This represents one expression. In C, expressions are a special kind of statements that can return a value, and so, have a type

and stmt_kind = Clang_AST.stmt_kind =
  1. | AsmStmt of asm_stmt
    (*

    Assembly statement

    *)
  2. | AttributedStmt of stmt
    (*

    Represents an attribute applied to a statement. TODO: attributes

    *)
  3. | BreakStmt of loc
    (*

    destination

    *)
  4. | CompoundStmt of stmt list
    (*

    This represents a group of statements like { stmt stmt }.

    *)
  5. | ContinueStmt of loc
    (*

    This represents a continue.

    *)
  6. | DeclStmt of decl list
    (*

    Adaptor for mixing declarations with statements and expressions. CompoundStmt mixes statements, expressions and declarations (variables, types). Another example is ForStmt, where the first statement can be an expression or a declaration.

    *)
  7. | DoStmt of do_stmt
    (*

    This represents a 'do/while' stmt.

    *)
  8. | ExprStmt of expr
    (*

    An expression

    *)
  9. | ForStmt of for_stmt
    (*

    This represents a 'for (init;cond;inc)' stmt

    *)
  10. | GotoStmt of name * loc
    (*

    This represents a direct goto.

    *)
  11. | IfStmt of if_stmt
    (*

    This represents an if/then/else.

    *)
  12. | IndirectGotoStmt of expr * name option
    (*

    This represents an indirect goto, with a computed label.

    *)
  13. | LabelStmt of name * stmt
    (*

    Represents a label, which has a substatement

    *)
  14. | NullStmt
    (*

    This is the null statement ";".

    *)
  15. | ReturnStmt of expr option
    (*

    This represents a return, optionally of an expression.

    *)
  16. | CaseStmt of case_stmt
    (*

    Case in a switch

    *)
  17. | DefaultStmt of stmt
    (*

    Default statement in a switch

    *)
  18. | SwitchStmt of switch_stmt
    (*

    This represents a 'switch' stmt.

    *)
  19. | WhileStmt of while_stmt
    (*

    This represents a 'while' stmt.

    *)
  20. | CXXForRangeStmt of cxx_for_range_stmt
    (*

    (C++) This represents C++0x stmt.ranged's ranged for statement, represented as 'for (range-declarator : range-expression)'

    *)
  21. | CXXTryStmt of cxx_try_stmt
    (*

    (C++) Try block followed by catch blocks

    *)
  22. | UnknownStmt of int * string
    (*

    Unhandled Stmt node

    *)

Kinds of statments.

and do_stmt = Clang_AST.do_stmt = {
  1. do_body : stmt;
    (*

    body

    *)
  2. do_cond : expr;
    (*

    condition

    *)
}

This represents a 'do/while' stmt.

and for_stmt = Clang_AST.for_stmt = {
  1. for_init : stmt option;
  2. for_cond : expr option;
    (*

    condition

    *)
  3. for_inc : expr option;
    (*

    increment

    *)
  4. for_body : stmt;
}

This represents a 'for (init;cond;inc)' stmt

and if_stmt = Clang_AST.if_stmt = {
  1. if_cond : expr option;
    (*

    condition

    *)
  2. if_then : stmt option;
    (*

    then

    *)
  3. if_else : stmt option;
    (*

    else

    *)
  4. if_init : stmt option;
    (*

    (C++) optional init statment in 'if constexpr'

    *)
}

This represents an if/then/else.

and case_stmt = Clang_AST.case_stmt = {
  1. case_value : expr;
  2. case_end : expr option;
    (*

    GNU extension: end of range in 'case 1..4'

    *)
  3. case_stmt : stmt;
    (*

    statement following case

    *)
}

Case in a switch

and switch_stmt = Clang_AST.switch_stmt = {
  1. switch_init : stmt option;
  2. switch_cond : expr;
    (*

    condition

    *)
  3. switch_body : stmt;
}

This represents a 'switch' stmt.

and while_stmt = Clang_AST.while_stmt = {
  1. while_cond : expr;
    (*

    condition

    *)
  2. while_body : stmt;
}

This represents a 'while' stmt.

and asm_stmt = Clang_AST.asm_stmt = {
  1. asm_style : asm_style;
  2. asm_is_simple : bool;
  3. asm_is_volatile : bool;
  4. asm_body : string;
  5. asm_outputs : asm_output array;
  6. asm_inputs : asm_input array;
  7. asm_clobbers : string array;
  8. asm_labels : string array;
}

This reprents an 'asm' stmt.

and asm_output = Clang_AST.asm_output = {
  1. asm_output_string : string;
  2. asm_output_expr : expr;
  3. asm_output_constraint : asm_output_constraint;
}
and asm_input = Clang_AST.asm_input = {
  1. asm_input_string : string;
  2. asm_input_expr : expr;
}
and asm_style = Clang_AST.asm_style =
  1. | ASM_STYLE_GCC
  2. | ASM_STYLE_MS
and asm_output_constraint = Clang_AST.asm_output_constraint =
  1. | ASM_OUTPUT_INOUT
  2. | ASM_OUTPUT_OUT
and cxx_for_range_stmt = Clang_AST.cxx_for_range_stmt = {
  1. for_range_var : var_decl;
    (*

    loop variable

    *)
  2. for_range_init : expr;
    (*

    range init

    *)
  3. for_range_body : stmt;
}

(C++) This represents C++0x stmt.ranged's ranged for statement, represented as 'for (range-declarator : range-expression)'. TODO: expose also the desugared form begin/end/cond/inc/loopvar?

and cxx_try_stmt = Clang_AST.cxx_try_stmt = {
  1. try_block : stmt;
    (*

    try block

    *)
  2. try_handlers : cxx_catch_stmt array;
    (*

    catch blocks

    *)
}

(C++) Try block followed by catch blocks

and cxx_catch_stmt = Clang_AST.cxx_catch_stmt = {
  1. catch_exception : var_decl option;
    (*

    identifier getting the exception, if any

    *)
  2. catch_type : type_qual option;
    (*

    caught type, or None for all types

    *)
  3. catch_handler : stmt;
    (*

    handler

    *)
}

(C++) This represents a C++ catch block.

and stmt = Clang_AST.stmt = {
  1. stmt_kind : stmt_kind;
  2. stmt_range : range;
}

Represents a statement.

Diagnostics

type diag_level = Clang_AST.diag_level =
  1. | Level_Ignored
  2. | Level_Note
  3. | Level_Remark
  4. | Level_Warning
  5. | Level_Error
  6. | Level_Fatal
    (*

    The level of a diagnostic.

    *)
type diagnostic = Clang_AST.diagnostic = {
  1. diag_level : diag_level;
  2. diag_loc : loc;
  3. diag_message : string;
}

Messages generated by Clang during parsing.

Target information

type target_EABI = Clang_AST.target_EABI =
  1. | Target_EABI_Unknown
  2. | Target_EABI_Default
  3. | Target_EABI_EABI4
  4. | Target_EABI_EABI5
  5. | Target_EABI_GNU
    (*

    EABI version

    *)
type target_options = Clang_AST.target_options = {
  1. target_triple : string;
    (*

    if given, the name of the target triple to compile for.

    *)
  2. target_host_triple : string;
    (*

    when compiling for the device side, contains the triple used to compile for the host

    *)
  3. target_CPU : string;
    (*

    if given, the name of the target CPU to generate code for

    *)
  4. target_FP_math : string;
    (*

    if gven, the unit to use for floating point math

    *)
  5. target_ABI : string;
    (*

    if given, the name of the target ABI to use

    *)
  6. target_EABI_version : target_EABI;
    (*

    the EABI version to use

    *)
  7. target_linker_version : string;
    (*

    if given, the version string of the linker in use

    *)
  8. target_features_as_written : string list;
    (*

    the list of target specific features to enable or disable, as written on the command line

    *)
  9. target_features : string list;
    (*

    the list of target specific features to enable or disable; this should be a list of strings starting with by '+' or '-'

    *)
}

Options for controlling the target.

val empty_target_options : target_options
type target_int_type = Clang_AST.target_int_type =
  1. | Target_NoInt
  2. | Target_SignedChar
  3. | Target_UnsignedChar
  4. | Target_SignedShort
  5. | Target_UnsignedShort
  6. | Target_SignedInt
  7. | Target_UnsignedInt
  8. | Target_SignedLong
  9. | Target_UnsignedLong
  10. | Target_SignedLongLong
  11. | Target_UnsignedLongLong
    (*

    Integer types used in the target definition.

    *)
type target_real_type = Clang_AST.target_real_type =
  1. | Target_NoFloat
  2. | Target_Float
  3. | Target_Double
  4. | Target_LongDouble
  5. | Target_Float128
    (*

    Real types used in the target definition

    *)
type target_info = Clang_AST.target_info = {
  1. target_options : target_options;
  2. target_size_type : target_int_type;
    (*

    integer types

    *)
  3. target_intmax_type : target_int_type;
  4. target_ptrdiff_type : target_int_type;
  5. target_intptr_type : target_int_type;
  6. target_wchar_type : target_int_type;
  7. target_wint_type : target_int_type;
  8. target_char16_type : target_int_type;
  9. target_char32_type : target_int_type;
  10. target_int64_type : target_int_type;
  11. target_sigatomic_type : target_int_type;
  12. target_processid_type : target_int_type;
  13. target_pointer_width : int;
    (*

    scalar type width and alignment

    *)
  14. target_pointer_align : int;
  15. target_bool_width : int;
  16. target_bool_align : int;
  17. target_char_width : int;
  18. target_char_align : int;
  19. target_short_width : int;
  20. target_short_align : int;
  21. target_int_width : int;
  22. target_int_align : int;
  23. target_long_width : int;
  24. target_long_align : int;
  25. target_long_long_width : int;
  26. target_long_long_align : int;
  27. target_half_width : int;
  28. target_half_align : int;
  29. target_float_width : int;
  30. target_float_align : int;
  31. target_double_width : int;
  32. target_double_align : int;
  33. target_long_double_width : int;
  34. target_long_double_align : int;
  35. target_float128_width : int;
  36. target_float128_align : int;
  37. target_large_array_min_width : int;
    (*

    alignment of other objects

    *)
  38. target_large_array_align : int;
  39. target_suitable_align : int;
    (*

    alignment that is suitable for storing any object with a fundamental alignment requirement

    *)
  40. target_big_endian : bool;
  41. target_TLS_supported : bool;
  42. target_has_int128 : bool;
  43. target_has_float128_type : bool;
  44. target_null_pointer_value : Int64.t;
    (*

    get integer value for null pointer

    *)
}

Exposes information about the current target.

include module type of struct include Clang_dump end

Names for constant variants

val lang_name : Clang_AST.lang -> string
val builtin_type_name : Clang_AST.builtin_type -> string
val binary_operator_name : Clang_AST.binary_operator -> string
val compound_assign_operator_name : Clang_AST.compound_assign_operator -> string
val unary_operator_name : Clang_AST.unary_operator -> string
val storage_class_name : Clang_AST.storage_class -> string
val record_kind_name : Clang_AST.record_kind -> string
val cast_kind_name : Clang_AST.cast_kind -> string
val character_kind_name : Clang_AST.character_kind -> string
val ident_type_name : Clang_AST.ident_type -> string
val unary_expr_or_type_name : Clang_AST.unary_expr_or_type -> string
val array_type_trait_name : Clang_AST.array_type_trait -> string
val access_specifier_name : Clang_AST.access_specifier -> string
val construction_kind_name : Clang_AST.construction_kind -> string
val overloaded_operator_name : Clang_AST.overloaded_operator -> string
val initialization_style_name : Clang_AST.initialization_style -> string
val expression_trait_name : Clang_AST.expression_trait -> string
val storage_duration_name : Clang_AST.storage_duration -> string
val type_trait_name : Clang_AST.type_trait -> string
val diag_level_name : Clang_AST.diag_level -> string
val target_int_type_name : Clang_AST.target_int_type -> string
val target_real_type_name : Clang_AST.target_real_type -> string
val builtin_template_kind_name : Clang_AST.builtin_template_kind -> string
val ref_qualifier_name : Clang_AST.ref_qualifier -> string
val lambda_capture_default_name : Clang_AST.lambda_capture_default -> string
val lambda_capture_kind_name : Clang_AST.lambda_capture_kind -> string
val decl_kind_name : Clang_AST.decl_kind -> string
val type_kind_name : Clang_AST.typ -> string
val expr_kind_name : Clang_AST.expr_kind -> string
val stmt_kind_name : Clang_AST.stmt_kind -> string

Basic AST and parsing structures

val string_of_loc : Clang_AST.loc -> string
val string_of_range : Clang_AST.range -> string
val string_of_diagnostic : Clang_AST.diagnostic -> string
val string_of_target_EABI : Clang_AST.target_EABI -> string
val string_of_target_options : Clang_AST.target_options -> string
val string_of_target_info : Clang_AST.target_info -> string

Names from declarations

val name : Clang_AST.name -> string
val enum_name : Clang_AST.enum_decl -> string
val record_name : Clang_AST.record_decl -> string

High-level AST constructions

val string_of_decl : Clang_AST.decl -> string
val string_of_type : Clang_AST.typ -> string
val string_of_type_qual : Clang_AST.type_qual -> string
val string_of_expr : Clang_AST.expr -> string
val string_of_stmt : Clang_AST.stmt -> string
OCaml

Innovation. Community. Security.