Module Clang.Type
AST types as ordered types.
type t
= Ast.qual_type
val of_node : ?options:Ast.Options.t -> 'a Ast.node -> t
of_node ?options node
returns the type associated tonode
. Ifnode
comes from libclang's AST, the function callsget_cursor_type
to the associated cursor. Ifnode
has been constructed and decorated with a typety
,ty
is returned. Ifnode
has been constructed without type decoration,Invalid_arg _
is raised. It is equivalent toClang.Type.of_decoration ?options (Clang.Ast.decoration_of_node node)
.
val make : ?const:bool -> ?volatile:bool -> ?restrict:bool -> Ast.type_desc -> t
make ?const ?volatile ?restrict desc
returns a type from a description, associated to an invalid libclang's type. This function can be useful to construct types from OCaml programs, for instance to describe a program transformation.
val of_cxtype : ?options:Ast.Options.t -> cxtype -> t
of_cxtype ?options ty
translatesty
into its high-level representation.
val of_cursor : ?options:Ast.Options.t -> cxcursor -> t
of_cxcursor ?options cu
returns the type associated tocu
.
val of_decoration : ?options:Ast.Options.t -> Ast.decoration -> t
of_decoration ?options d
returns the type associated tod
.
val iter_fields : ?options:Ast.Options.t -> (Ast.decl -> unit) -> t -> unit
iter_fields ?options f ty
callsf
over all the declaration nodes of the fields belonging to the record typety
(either a struct or union). It is equivalent toClang.iter_type_fields (fun d -> f (Clang.Decl.of_cursor ?options d)) ty.cxtype
.
val list_of_fields : ?options:Ast.Options.t -> t -> Ast.decl list
list_of_fields ?options f ty
returns the list of all the declaration nodes of the fields belonging to the record typety
(either a struct or union). It is equivalent toList.map (Clang.Decl.of_cursor ?options) (Clang.list_of_type_fields ty.cxtype)
.
val get_declaration : ?options:Ast.Options.t -> t -> Ast.decl
get_declaration ?options ty
returns the declaration node ofty
. It is equivalent toClang.Decl.of_cxcursor ?options (Clang.get_type_declaration ty.cxtype)
.
val get_typedef_underlying_type : ?options:Ast.Options.t -> t -> t
get_declaration ?options ty
returns the underlying type of a typedefty
. It is equivalent toClang.Type.of_cxtype ?options (Clang.get_typedef_decl_underlying_type (Clang.get_type_declaration ty.cxtype))
.
val get_align_of : t -> int
get_align_of ty
returns the alignment ofty
in bytes. It is equivalent toClang.type_get_align_of ty.cxtype
.
val get_size_of : t -> int
get_align_of ty
returns the size ofty
in bytes. It is equivalent toClang.type_get_size_of ty.cxtype
.