Browse Source

Fixed parser to not try to get the class layout for invalid declarations.

pull/22/merge
triton 13 years ago
parent
commit
cb812206b3
  1. 6
      src/Parser/Parser.cpp

6
src/Parser/Parser.cpp

@ -579,9 +579,11 @@ CppSharp::AST::Class^ Parser::WalkRecordCXX(clang::CXXRecordDecl* Record)
auto &Sema = C->getSema(); auto &Sema = C->getSema();
Sema.ForceDeclarationOfImplicitMembers(Record); Sema.ForceDeclarationOfImplicitMembers(Record);
bool hasLayout = !Record->isDependentType() && !Record->isInvalidDecl();
// Get the record layout information. // Get the record layout information.
const ASTRecordLayout* Layout = 0; const ASTRecordLayout* Layout = 0;
if (!Record->isDependentType()) if (hasLayout)
{ {
Layout = &C->getASTContext().getASTRecordLayout(Record); Layout = &C->getASTContext().getASTRecordLayout(Record);
RC->Layout->Alignment = (int)Layout-> getAlignment().getQuantity(); RC->Layout->Alignment = (int)Layout-> getAlignment().getQuantity();
@ -662,7 +664,7 @@ CppSharp::AST::Class^ Parser::WalkRecordCXX(clang::CXXRecordDecl* Record)
} }
// Process the vtables // Process the vtables
if (Record->isDynamicClass()) if (hasLayout && Record->isDynamicClass())
WalkVTable(Record, RC); WalkVTable(Record, RC);
return RC; return RC;

Loading…
Cancel
Save