This revision was automatically updated to reflect the committed changes. Closed by commit rL295794: Fix assertion failure when generating debug information for a variable (authored by rsmith).
Changed prior to commit: https://reviews.llvm.org/D30082?vs=88943&id=89300#toc Repository: rL LLVM https://reviews.llvm.org/D30082 Files: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp cfe/trunk/test/CodeGenCXX/debug-info-template-deduction-guide.cpp Index: cfe/trunk/test/CodeGenCXX/debug-info-template-deduction-guide.cpp =================================================================== --- cfe/trunk/test/CodeGenCXX/debug-info-template-deduction-guide.cpp +++ cfe/trunk/test/CodeGenCXX/debug-info-template-deduction-guide.cpp @@ -0,0 +1,17 @@ +// RUN: %clang -S -emit-llvm -target x86_64-unknown_unknown -g %s -o - -std=c++1z | FileCheck %s + +// Verify that we don't crash when emitting debug information for objects +// created from a deduced template specialization. + +template <class T> +struct S { + S(T) {} +}; + +// CHECK: !DIGlobalVariable(name: "s1" +// CHECK-SAME: type: [[TYPE_NUM:![0-9]+]] +// CHECK: !DIGlobalVariable(name: "s2" +// CHECK-SAME: type: [[TYPE_NUM]] +// CHECK: [[TYPE_NUM]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "S<int>", +S s1(42); +S<int> s2(42); Index: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp =================================================================== --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp @@ -2475,8 +2475,9 @@ case Type::SubstTemplateTypeParm: T = cast<SubstTemplateTypeParmType>(T)->getReplacementType(); break; - case Type::Auto: { - QualType DT = cast<AutoType>(T)->getDeducedType(); + case Type::Auto: + case Type::DeducedTemplateSpecialization: { + QualType DT = cast<DeducedType>(T)->getDeducedType(); assert(!DT.isNull() && "Undeduced types shouldn't reach here."); T = DT; break;
Index: cfe/trunk/test/CodeGenCXX/debug-info-template-deduction-guide.cpp =================================================================== --- cfe/trunk/test/CodeGenCXX/debug-info-template-deduction-guide.cpp +++ cfe/trunk/test/CodeGenCXX/debug-info-template-deduction-guide.cpp @@ -0,0 +1,17 @@ +// RUN: %clang -S -emit-llvm -target x86_64-unknown_unknown -g %s -o - -std=c++1z | FileCheck %s + +// Verify that we don't crash when emitting debug information for objects +// created from a deduced template specialization. + +template <class T> +struct S { + S(T) {} +}; + +// CHECK: !DIGlobalVariable(name: "s1" +// CHECK-SAME: type: [[TYPE_NUM:![0-9]+]] +// CHECK: !DIGlobalVariable(name: "s2" +// CHECK-SAME: type: [[TYPE_NUM]] +// CHECK: [[TYPE_NUM]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "S<int>", +S s1(42); +S<int> s2(42); Index: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp =================================================================== --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp @@ -2475,8 +2475,9 @@ case Type::SubstTemplateTypeParm: T = cast<SubstTemplateTypeParmType>(T)->getReplacementType(); break; - case Type::Auto: { - QualType DT = cast<AutoType>(T)->getDeducedType(); + case Type::Auto: + case Type::DeducedTemplateSpecialization: { + QualType DT = cast<DeducedType>(T)->getDeducedType(); assert(!DT.isNull() && "Undeduced types shouldn't reach here."); T = DT; break;
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits