llvm-project/lldb/scripts/clang.complete-type-isSafeT...

20 lines
888 B
Diff

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(),