Browse Source

Do not try to get the layout of classes with dependent fields since upstream added an assert to check for dependent types in getTypeSize.

pull/1/head
triton 13 years ago
parent
commit
fdc35a40da
  1. 27
      src/Parser/Parser.cpp

27
src/Parser/Parser.cpp

@ -281,16 +281,30 @@ static Cxxi::AccessSpecifier ConvertToAccess(clang::AccessSpecifier AS) @@ -281,16 +281,30 @@ static Cxxi::AccessSpecifier ConvertToAccess(clang::AccessSpecifier AS)
return Cxxi::AccessSpecifier::Public;
}
Cxxi::Class^ Parser::WalkRecordCXX(clang::CXXRecordDecl* Record, bool IsDependent)
static bool HasClassDependentFields(clang::CXXRecordDecl* Record)
{
using namespace clang;
using namespace clix;
if (Record->isAnonymousStructOrUnion())
for(auto it = Record->field_begin(); it != Record->field_end(); ++it)
{
assert(0);
return nullptr;
clang::FieldDecl* FD = (*it);
switch (FD->getType()->getTypeClass()) {
#define TYPE(Class, Base)
#define ABSTRACT_TYPE(Class, Base)
#define NON_CANONICAL_TYPE(Class, Base)
#define DEPENDENT_TYPE(Class, Base) case Type::Class:
#include "clang/AST/TypeNodes.def"
return true;
}
}
return false;
}
Cxxi::Class^ Parser::WalkRecordCXX(clang::CXXRecordDecl* Record, bool IsDependent)
{
using namespace clang;
using namespace clix;
if (Record->hasFlexibleArrayMember())
{
@ -337,6 +351,9 @@ Cxxi::Class^ Parser::WalkRecordCXX(clang::CXXRecordDecl* Record, bool IsDependen @@ -337,6 +351,9 @@ Cxxi::Class^ Parser::WalkRecordCXX(clang::CXXRecordDecl* Record, bool IsDependen
RC->Methods->Add(Method);
}
if (!IsDependent)
IsDependent = HasClassDependentFields(Record);
// Get the record layout information.
const ASTRecordLayout* Layout = 0;
if (!IsDependent)

Loading…
Cancel
Save