跳到內容

layouts

本頁內容尚未翻譯。

record ClassLayout

A class’s size, alignment and data size (its size without the tail padding).

def Layouts.depth : Nat

How deep classes nest at most in a layout (a bound for the recursion over the hierarchy).

def Layouts.plain (ext : TypeExtension Cpp.constructs) (tgt : Target) (t : Ty Cpp.constructs) : ClassLayout

The layout of a type by C’s rules (its whole size its data).

def Layouts.classNamed (g : Globals Cpp.constructs) (x : String) : Option ClassMembers

The class of a name in the tables, if it is one.

def Layouts.isBase (f : FieldTy Cpp.constructs) : Bool

Whether a field is a base subobject.

def Layouts.isVirtualStorage (f : FieldTy Cpp.constructs) : Bool

Whether a field is where a complete object keeps a virtual base.

def Layouts.isHidden (f : FieldTy Cpp.constructs) : Bool

Whether a field takes no room of its own: a pointer to a virtual base, or the construction contexts (the virtual table pointer stands for them).

def Layouts.needsPointer (g : Globals Cpp.constructs) (cls : ClassMembers) (fs : List (FieldTy Cpp.constructs)) : Bool

Whether a class (with its fields) needs a virtual table pointer it has no member for: it keeps virtual bases, has no dynamic type of its own, and its first base (non-virtual) has no virtual table to share.

def Layouts.isWritten (f : FieldTy Cpp.constructs) : Bool

Whether a field is a data member the program wrote (not a base, nor the dynamic type).

def Layouts.nameOf (f : FieldTy Cpp.constructs) : String

A field’s name.

def Layouts.typeOf (f : FieldTy Cpp.constructs) : Ty Cpp.constructs

A field’s type.

def Layouts.access (cls : ClassMembers) (f : FieldTy Cpp.constructs) : Access

A field’s access in its class (public when the class does not list it).

def Layouts.sameAccess (a : Access) (b : Access) : Bool

Whether two accesses are the same.

def Layouts.isTrivial (cls : ClassMembers) : Bool

Whether a class is trivial for the layout: no constructors, destructor, virtual functions or assignment operator.

def Layouts.ofClass (ext : TypeExtension Cpp.constructs) (tgt : Target) (g : Globals Cpp.constructs) (t : Ty Cpp.constructs) : Option (Nat * Nat)

A class’s size and alignment by the Itanium C++ ABI, for a dialect’s layout (none for a type that is not a class), given the extension that lays out C++’s own types.