Updated LLVM/Clang to force the record layout engine

to complete C++ classes before traversing their base
classes.

llvm-svn: 156570
This commit is contained in:
Sean Callanan 2012-05-10 20:29:51 +00:00
parent fc8118bf41
commit 6f3b394bfa
1 changed files with 19 additions and 0 deletions

View File

@ -0,0 +1,19 @@
Index: lib/CodeGen/CodeGenTypes.cpp
===================================================================
--- lib/CodeGen/CodeGenTypes.cpp (revision 152265)
+++ lib/CodeGen/CodeGenTypes.cpp (working copy)
@@ -133,6 +133,14 @@
// when a class is translated, even though they aren't embedded by-value into
// the class.
if (const CXXRecordDecl *CRD = dyn_cast<CXXRecordDecl>(RD)) {
+ if (!CRD->hasDefinition() && CRD->hasExternalLexicalStorage()) {
+ ExternalASTSource *EAS = CRD->getASTContext().getExternalSource();
+ if (!EAS)
+ return false;
+ EAS->CompleteType(const_cast<CXXRecordDecl*>(CRD));
+ if (!CRD->hasDefinition())
+ return false;
+ }
for (CXXRecordDecl::base_class_const_iterator I = CRD->bases_begin(),
E = CRD->bases_end(); I != E; ++I)
if (!isSafeToConvert(I->getType()->getAs<RecordType>()->getDecl(),