Browse Source

Actually get the layout information for each class in the parser.

pull/1/head
triton 12 years ago
parent
commit
d1915d033c
  1. 11
      src/Bridge/Class.cs
  2. 5
      src/Parser/Parser.cpp

11
src/Bridge/Class.cs

@ -62,9 +62,15 @@ namespace Cxxi @@ -62,9 +62,15 @@ namespace Cxxi
public class ClassLayout
{
public CppAbi ABI { get; set; }
public bool HasOwnVFTable { get; set; }
public VFTable VirtualFunctions { get; set; }
public VBTable VirtualBases { get; set; }
public bool HasOwnVFTable;
public bool HasVirtualBases;
public int Alignment;
public int Size;
public int DataSize;
}
public enum ClassType
@ -93,7 +99,7 @@ namespace Cxxi @@ -93,7 +99,7 @@ namespace Cxxi
public ClassType Type;
// ABI-specific class layout.
public List<ClassLayout> Layouts { get; set; }
public ClassLayout Layout;
// True if class provides pure virtual methods.
public bool IsAbstract;
@ -120,6 +126,7 @@ namespace Cxxi @@ -120,6 +126,7 @@ namespace Cxxi
IsOpaque = false;
IsPOD = false;
Type = ClassType.RefType;
Layout = new ClassLayout();
}
public bool HasBase

5
src/Parser/Parser.cpp

@ -364,7 +364,12 @@ Cxxi::Class^ Parser::WalkRecordCXX(clang::CXXRecordDecl* Record, bool IsDependen @@ -364,7 +364,12 @@ Cxxi::Class^ Parser::WalkRecordCXX(clang::CXXRecordDecl* Record, bool IsDependen
// Get the record layout information.
const ASTRecordLayout* Layout = 0;
if (!IsDependent)
{
Layout = &C->getASTContext().getASTRecordLayout(Record);
RC->Layout->Alignment = (int)Layout-> getAlignment().getQuantity();
RC->Layout->Size = (int)Layout->getSize().getQuantity();
RC->Layout->DataSize = (int)Layout->getDataSize().getQuantity();
}
// Iterate through the record fields.
for(auto it = Record->field_begin(); it != Record->field_end(); ++it)

Loading…
Cancel
Save