diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index a153193a53fe..af0cd02ed2f1 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -1655,7 +1655,8 @@ static bool isDefinedInClangModule(const RecordDecl *RD) { if (!RD->isExternallyVisible() && RD->getName().empty()) return false; if (auto *CXXDecl = dyn_cast(RD)) { - assert(CXXDecl->isCompleteDefinition() && "incomplete record definition"); + if (!CXXDecl->isCompleteDefinition()) + return false; auto TemplateKind = CXXDecl->getTemplateSpecializationKind(); if (TemplateKind != TSK_Undeclared) { // This is a template, check the origin of the first member. diff --git a/clang/test/Modules/Inputs/DebugNestedA.h b/clang/test/Modules/Inputs/DebugNestedA.h new file mode 100644 index 000000000000..58dc2a7df749 --- /dev/null +++ b/clang/test/Modules/Inputs/DebugNestedA.h @@ -0,0 +1,8 @@ +/* -*- C++ -*- */ +template class Base {}; +template struct A : public Base> { + void f(); +}; + +class F {}; +typedef A AF; diff --git a/clang/test/Modules/Inputs/DebugNestedB.h b/clang/test/Modules/Inputs/DebugNestedB.h new file mode 100644 index 000000000000..7f75d0946e20 --- /dev/null +++ b/clang/test/Modules/Inputs/DebugNestedB.h @@ -0,0 +1,7 @@ +/* -*- C++ -*- */ +#include "DebugNestedA.h" +class C { + void run(AF &af) { + af.f(); + } +}; diff --git a/clang/test/Modules/Inputs/module.map b/clang/test/Modules/Inputs/module.map index a683190e1825..2beb942861a4 100644 --- a/clang/test/Modules/Inputs/module.map +++ b/clang/test/Modules/Inputs/module.map @@ -422,3 +422,13 @@ module MacroFabs1 { module DiagOutOfDate { header "DiagOutOfDate.h" } + +module DebugNestedA { + header "DebugNestedA.h" + export * +} + +module DebugNestedB { + header "DebugNestedB.h" + export * +}