public Class() { Bases = new List <BaseClassSpecifier>(); Fields = new List <Field>(); Properties = new List <Property>(); Methods = new List <Method>(); Specifiers = new List <AccessSpecifierDecl>(); IsAbstract = false; IsUnion = false; IsOpaque = false; IsPOD = false; Type = ClassType.RefType; Layout = new ClassLayout(); }
public Class() { Bases = new List <BaseClassSpecifier>(); Fields = new List <Field>(); Properties = new List <Property>(); Methods = new List <Method>(); Specifiers = new List <AccessSpecifierDecl>(); IsAbstract = false; IsUnion = false; IsFinal = false; IsPOD = false; Type = ClassType.RefType; Layout = new ClassLayout(); templateParameters = new List <Declaration>(); specializations = new List <ClassTemplateSpecialization>(); }
public ClassLayout(ClassLayout classLayout) : this() { ABI = classLayout.ABI; HasOwnVFPtr = classLayout.HasOwnVFPtr; VBPtrOffset = classLayout.VBPtrOffset; PrimaryBase = classLayout.PrimaryBase; HasVirtualBases = classLayout.HasVirtualBases; Alignment = classLayout.Alignment; Size = classLayout.Size; DataSize = classLayout.DataSize; VFTables.AddRange(classLayout.VFTables); if (classLayout.Layout != null) { Layout = new VTableLayout(); Layout.Components.AddRange(classLayout.Layout.Components); } }
public Class(Class @class) : base(@class) { Bases = new List <BaseClassSpecifier>(@class.Bases); Fields = new List <Field>(@class.Fields); Properties = new List <Property>(@class.Properties); Methods = new List <Method>(@class.Methods); Specifiers = new List <AccessSpecifierDecl>(@class.Specifiers); IsPOD = @class.IsPOD; Type = @class.Type; Layout = new ClassLayout(@class.Layout); IsAbstract = @class.IsAbstract; IsUnion = @class.IsUnion; IsOpaque = @class.IsOpaque; IsDynamic = @class.IsDynamic; IsPolymorphic = @class.IsPolymorphic; HasNonTrivialDefaultConstructor = @class.HasNonTrivialDefaultConstructor; HasNonTrivialCopyConstructor = @class.HasNonTrivialCopyConstructor; HasNonTrivialDestructor = @class.HasNonTrivialDestructor; IsStatic = @class.IsStatic; }
AST.ClassLayout VisitClassLayout(ClassLayout layout) { var _layout = new AST.ClassLayout { ABI = VisitCppAbi(layout.ABI), Layout = VisitVTableLayout(layout.Layout), HasOwnVFPtr = layout.HasOwnVFPtr, VBPtrOffset = layout.VBPtrOffset, Alignment = layout.Alignment, Size = layout.Size, DataSize = layout.DataSize }; for (uint i = 0; i < layout.VFTablesCount; ++i) { var vftableInfo = layout.getVFTables(i); var _vftableInfo = VisitVFTableInfo(vftableInfo); _layout.VFTables.Add(_vftableInfo); } return(_layout); }
public static int GetSize(this ClassLayout layout) => /// There's at least one ABI (System V) that gives to empty structs /// size 1 in C++ and size 0 in C. The former causes crashes in older versions of Mono. layout.Size == 1 && layout.DataSize == 0 ? 0 : layout.Size;