The Smallfoot Intermediate Language: Types

`module F = Format`
`type ikind````=`

`|` `IChar` | (** `char` *)
`|` `ISChar` | (** `signed char` *)
`|` `IUChar` | (** `unsigned char` *)
`|` `IBool` | (** `bool` *)
`|` `IInt` | (** `int` *)
`|` `IUInt` | (** `unsigned int` *)
`|` `IShort` | (** `short` *)
`|` `IUShort` | (** `unsigned short` *)
`|` `ILong` | (** `long` *)
`|` `IULong` | (** `unsigned long` *)
`|` `ILongLong` | (** `long long` (or `_int64` on Microsoft Visual C) *)
`|` `IULongLong` | (** `unsigned long long` (or `unsigned _int64` on Microsoft Visual C) *)
`|` `I128` | (** `__int128_t` *)
`|` `IU128` | (** `__uint128_t` *)

``

Kinds of integers

`include sig ... end`
`val compare_ikind : ikind ‑> ikind ‑> int`
`val ikind_is_char : ikind ‑> bool`

Check whether the integer kind is a char

`val ikind_is_unsigned : ikind ‑> bool`

Check whether the integer kind is unsigned

`type fkind````=`

`|` `FFloat` | (** `float` *)
`|` `FDouble` | (** `double` *)
`|` `FLongDouble` | (** `long double` *)

``

Kinds of floating-point numbers

`include sig ... end`
`val compare_fkind : fkind ‑> fkind ‑> int`
`type ptr_kind````=`

`|` `Pk_pointer` | (** C/C++, Java, Objc standard/__strong pointer *)
`|` `Pk_reference` | (** C++ reference *)
`|` `Pk_objc_weak` | (** Obj-C __weak pointer *)
`|` `Pk_objc_unsafe_unretained` | (** Obj-C __unsafe_unretained pointer *)
`|` `Pk_objc_autoreleasing` | (** Obj-C __autoreleasing pointer *)

``

kind of pointer

`include sig ... end`
`val compare_ptr_kind : ptr_kind ‑> ptr_kind ‑> int`
`val equal_ptr_kind : ptr_kind ‑> ptr_kind ‑> bool`
`type type_quals`````
`include sig ... end`
`val compare_type_quals : type_quals ‑> type_quals ‑> int`
`val mk_type_quals : ?⁠default:type_quals ‑> ?⁠is_const:bool ‑> ?⁠is_restrict:bool ‑> ?⁠is_volatile:bool ‑> unit ‑> type_quals`
`val is_const : type_quals ‑> bool`
`val is_restrict : type_quals ‑> bool`
`val is_volatile : type_quals ‑> bool`
`type t````=` `{`

`desc : desc;`
`quals : type_quals;`

`}```

types for sil (structured) expressions

`type desc````=`

`|` `Tint of ikind` | (** integer type *)
`|` `Tfloat of fkind` | (** float type *)
`|` `Tvoid` | (** void type *)
`|` `Tfun of` `{`
`no_return : bool;`
`}``` | (** function type with noreturn attribute *)
`|` `Tptr of t * ptr_kind` | (** pointer type *)
`|` `Tstruct of name` | (** structured value type name *)
`|` `TVar of string` | (** type variable (ie. C++ template variables) *)
`|` `Tarray of` `{`
`elt : t;`
`length : IntLit.t option;`
`stride : IntLit.t option;`
`}``` | (** array type with statically fixed length and stride *)

``
`type name````=`

`|` `CStruct of QualifiedCppName.t`
`|` `CUnion of QualifiedCppName.t`
`|` `CppClass of QualifiedCppName.t * template_spec_info`
`|` `JavaClass of Mangled.t`
`|` `ObjcClass of QualifiedCppName.t`
`|` `ObjcProtocol of QualifiedCppName.t`

``
`type template_arg````=`

`|` `TType of t`
`|` `TInt of InferStdlib.IStd.Int64.t`
`|` `TNull`
`|` `TNullPtr`
`|` `TOpaque`

``
`type template_spec_info````=`

`|` `NoTemplate`
`|` `Template of` `{`
`mangled : string option;` | (** WARNING: because of type substitutions performed by `sub_type` and `sub_tname`, mangling is not guaranteed to be unique to a single type. All the information in the template arguments is also needed for uniqueness. *)
`args : template_arg list;`
`}```

``
`include sig ... end`
`val compare : t ‑> t ‑> int`
`val compare_desc : desc ‑> desc ‑> int`
`val compare_name : name ‑> name ‑> int`
`val compare_template_arg : template_arg ‑> template_arg ‑> int`
`val compare_template_spec_info : template_spec_info ‑> template_spec_info ‑> int`
`val compare : t ‑> t ‑> int`
`val compare_desc : desc ‑> desc ‑> int`
`val compare_name : name ‑> name ‑> int`
`val compare_template_arg : template_arg ‑> template_arg ‑> int`
`val compare_template_spec_info : template_spec_info ‑> template_spec_info ‑> int`
`val compare : t ‑> t ‑> int`
`val compare_desc : desc ‑> desc ‑> int`
`val compare_name : name ‑> name ‑> int`
`val compare_template_arg : template_arg ‑> template_arg ‑> int`
`val compare_template_spec_info : template_spec_info ‑> template_spec_info ‑> int`
`val compare : t ‑> t ‑> int`
`val compare_desc : desc ‑> desc ‑> int`
`val compare_name : name ‑> name ‑> int`
`val compare_template_arg : template_arg ‑> template_arg ‑> int`
`val compare_template_spec_info : template_spec_info ‑> template_spec_info ‑> int`
`val compare : t ‑> t ‑> int`
`val compare_desc : desc ‑> desc ‑> int`
`val compare_name : name ‑> name ‑> int`
`val compare_template_arg : template_arg ‑> template_arg ‑> int`
`val compare_template_spec_info : template_spec_info ‑> template_spec_info ‑> int`
`val mk : ?⁠default:t ‑> ?⁠quals:type_quals ‑> desc ‑> t`

Create Typ.t from given desc. if `default` is passed then use its value to set other fields such as quals

`val mk_array : ?⁠default:t ‑> ?⁠quals:type_quals ‑> ?⁠length:IntLit.t ‑> ?⁠stride:IntLit.t ‑> t ‑> t`

Create an array type from a given element type. If `length` or `stride` value is given, use them as static length and size.

`val void : t`

void type

`val void_star : t`

void* type

`type type_subst_t`````

Stores information about type substitution

`include sig ... end`
`val compare_type_subst_t : type_subst_t ‑> type_subst_t ‑> int`
`module Name : sig ... end`
`val equal : t ‑> t ‑> bool`

Equality for types.

`val equal_desc : desc ‑> desc ‑> bool`
`val equal_quals : type_quals ‑> type_quals ‑> bool`
`val sub_type : type_subst_t ‑> t ‑> t`
`val sub_tname : type_subst_t ‑> Name.t ‑> Name.t`
`val is_type_subst_empty : type_subst_t ‑> bool`
`val pp_full : InferStdlib.Pp.env ‑> F.formatter ‑> t ‑> unit`

Pretty print a type with all the details.

`val pp : InferStdlib.Pp.env ‑> F.formatter ‑> t ‑> unit`

Pretty print a type.

`val to_string : t ‑> string`
`val d_full : t ‑> unit`

Dump a type with all the details.

`val d_list : t list ‑> unit`

Dump a list of types.

`val name : t ‑> Name.t option`

The name of a type

`val inner_name : t ‑> Name.t option`

Name of the type of a Tstruct pointed to by a Tptr

`val strip_ptr : t ‑> t`

turn a *T into a T. fails if `t` is not a pointer type

`val array_elem : t option ‑> t ‑> t`

If an array type, return the type of the element. If not, return the default type if given, otherwise raise an exception

`val is_objc_class : t ‑> bool`
`val is_cpp_class : t ‑> bool`
`val is_pointer_to_cpp_class : t ‑> bool`
`val is_pointer : t ‑> bool`
`val is_reference : t ‑> bool`
`val has_block_prefix : string ‑> bool`
`val unsome : string ‑> t option ‑> t`
`type typ``= t```
`module Procname : sig ... end`
`module Fieldname : sig ... end`
`module Struct : sig ... end`