diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index d8ba5592ad478b..91a8f278de5c41 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -5032,6 +5032,15 @@ struct ReconstitutableType : public RecursiveASTVisitor { Reconstitutable = false; return false; } + bool VisitType(Type *T) { + // _BitInt(N) isn't reconstitutable because the bit width isn't encoded in + // the DWARF, only the byte width. + if (T->isBitIntType()) { + Reconstitutable = false; + return false; + } + return true; + } bool TraverseEnumType(EnumType *ET) { // Unnamed enums can't be reconstituted due to a lack of column info we // produce in the DWARF, so we can't get Clang's full name back. diff --git a/clang/test/CodeGenCXX/debug-info-simple-template-names.cpp b/clang/test/CodeGenCXX/debug-info-simple-template-names.cpp index 06e83ea6f59eb2..d20c9478c363d6 100644 --- a/clang/test/CodeGenCXX/debug-info-simple-template-names.cpp +++ b/clang/test/CodeGenCXX/debug-info-simple-template-names.cpp @@ -105,4 +105,10 @@ void f() { f3(); // CHECK: !DISubprogram(name: "_STNf3|", + + f1<_BitInt(3)>(); + // CHECK: !DISubprogram(name: "f1<_BitInt(3)>", + + f1(); + // CHECK: !DISubprogram(name: "f1", } diff --git a/cross-project-tests/debuginfo-tests/clang_llvm_roundtrip/simplified_template_names.cpp b/cross-project-tests/debuginfo-tests/clang_llvm_roundtrip/simplified_template_names.cpp index 898b27ec0e479f..ee429ef3b5798a 100644 --- a/cross-project-tests/debuginfo-tests/clang_llvm_roundtrip/simplified_template_names.cpp +++ b/cross-project-tests/debuginfo-tests/clang_llvm_roundtrip/simplified_template_names.cpp @@ -316,6 +316,8 @@ int main() { f1(); operator_not_really(); t12 v4; + f1<_BitInt(3)>(); + f1(); } void t8::mem() { struct t7 { };