summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/CodeGen/CGDebugInfo.cpp10
-rw-r--r--clang/test/CodeGenCXX/debug-info-class-nolimit.cpp27
2 files changed, 31 insertions, 6 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index 71377224461..c2878c38f6e 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -1648,9 +1648,13 @@ void CGDebugInfo::completeRequiredType(const RecordDecl *RD) {
if (DebugKind <= codegenoptions::DebugLineTablesOnly)
return;
- if (const auto *CXXDecl = dyn_cast<CXXRecordDecl>(RD))
- if (CXXDecl->isDynamicClass())
- return;
+ // If this is a dynamic class and we're emitting limited debug info, wait
+ // until the vtable is emitted to complete the class debug info.
+ if (DebugKind <= codegenoptions::LimitedDebugInfo) {
+ if (const auto *CXXDecl = dyn_cast<CXXRecordDecl>(RD))
+ if (CXXDecl->isDynamicClass())
+ return;
+ }
if (DebugTypeExtRefs && RD->isFromASTFile())
return;
diff --git a/clang/test/CodeGenCXX/debug-info-class-nolimit.cpp b/clang/test/CodeGenCXX/debug-info-class-nolimit.cpp
index ce47f9fa495..4b05fd6e87d 100644
--- a/clang/test/CodeGenCXX/debug-info-class-nolimit.cpp
+++ b/clang/test/CodeGenCXX/debug-info-class-nolimit.cpp
@@ -1,8 +1,29 @@
-// RUN: %clang_cc1 -triple x86_64-unk-unk -debug-info-kind=standalone -o - -emit-llvm %s | FileCheck %s
-// On Darwin, "full" debug info is the default, so really these tests are
-// identical, as cc1 no longer chooses the effective value of DebugInfoKind.
// RUN: %clang_cc1 -triple x86_64-apple-darwin -debug-info-kind=standalone -o - -emit-llvm %s | FileCheck %s
+// We had a bug in -fstandalone-debug where UnicodeString would not be completed
+// when it was required to be complete. This orginally manifested as an
+// assertion in CodeView emission on Windows with some dllexport stuff, but it's
+// more general than that.
+
+struct UnicodeString;
+struct GetFwdDecl {
+ static UnicodeString format;
+};
+GetFwdDecl force_fwd_decl;
+struct UnicodeString {
+private:
+ virtual ~UnicodeString();
+};
+struct UseCompleteType {
+ UseCompleteType();
+ ~UseCompleteType();
+ UnicodeString currencySpcAfterSym[1];
+};
+UseCompleteType require_complete;
+// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "UnicodeString"
+// CHECK-NOT: DIFlagFwdDecl
+// CHECK-SAME: ){{$}}
+
namespace rdar14101097_1 { // see also PR16214
// Check that we emit debug info for the definition of a struct if the
// definition is available, even if it's used via a pointer wrapped in a
OpenPOWER on IntegriCloud