diff options
author | David Blaikie <dblaikie@gmail.com> | 2014-12-16 23:49:18 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2014-12-16 23:49:18 +0000 |
commit | 0317bc9e55c9e4546416e8d141d4bca813adb67f (patch) | |
tree | cc9dfaa8aaf48c2d5ff479d1108a159b6640f504 | |
parent | 224cb82a39851c9d9f34c13c469c78e14ca4d8e4 (diff) | |
download | bcm5719-llvm-0317bc9e55c9e4546416e8d141d4bca813adb67f.tar.gz bcm5719-llvm-0317bc9e55c9e4546416e8d141d4bca813adb67f.zip |
PR21909: Don't try (and crash) to generate debug info for explicit instantiations of explicit specializations.
llvm-svn: 224394
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 3 | ||||
-rw-r--r-- | clang/test/CodeGenCXX/debug-info-template-explicit-specialization.cpp | 8 |
2 files changed, 10 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 87bd955a6c0..25aaa30855b 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -3283,7 +3283,8 @@ void CodeGenModule::EmitTopLevelDecl(Decl *D) { case Decl::ClassTemplateSpecialization: { const auto *Spec = cast<ClassTemplateSpecializationDecl>(D); if (DebugInfo && - Spec->getSpecializationKind() == TSK_ExplicitInstantiationDefinition) + Spec->getSpecializationKind() == TSK_ExplicitInstantiationDefinition && + Spec->hasDefinition()) DebugInfo->completeTemplateDefinition(*Spec); break; } diff --git a/clang/test/CodeGenCXX/debug-info-template-explicit-specialization.cpp b/clang/test/CodeGenCXX/debug-info-template-explicit-specialization.cpp index 506c0d53575..461303884b8 100644 --- a/clang/test/CodeGenCXX/debug-info-template-explicit-specialization.cpp +++ b/clang/test/CodeGenCXX/debug-info-template-explicit-specialization.cpp @@ -91,3 +91,11 @@ struct j { extern template class j<int>; j<int> jj; // CHECK: ; [ DW_TAG_structure_type ] [j<int, int>] + +template <typename T> +struct k { +}; +template <> +struct k<int>; +template struct k<int>; +// CHECK-NOT: ; [ DW_TAG_structure_type ] [k<int>] |