summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2022-03-24 18:31:48 +0000
committerDavid Blaikie <dblaikie@gmail.com>2022-03-24 18:53:14 +0000
commit7b498beef03ae07bb98796461a957af836074b92 (patch)
tree27f40198164ea851720c55ea8968d3cd3a2c4721
parent0bfa1ab025e33662960363d2cddd4254eb609cf4 (diff)
downloadllvm-7b498beef03ae07bb98796461a957af836074b92.tar.gz
DebugInfo: Classify noreturn function types as non-reconstructible
This information isn't preserved in the DWARF description of function types (though probably should be - it's preserved on the function declarations/definitions themselves through the DW_AT_noreturn attribute - but we should move or also include that in the subroutine type itself too - but for now, with it not being there, the DWARF is lossy and can't be reconstructed)
-rw-r--r--clang/lib/CodeGen/CGDebugInfo.cpp1
-rw-r--r--clang/test/CodeGenCXX/debug-info-simple-template-names.cpp6
-rw-r--r--cross-project-tests/debuginfo-tests/clang_llvm_roundtrip/simplified_template_names.cpp2
3 files changed, 9 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index 75ce74b31846..beb640375dfb 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -5078,6 +5078,7 @@ struct ReconstitutableType : public RecursiveASTVisitor<ReconstitutableType> {
bool VisitFunctionProtoType(FunctionProtoType *FT) {
// noexcept is not encoded in DWARF, so the reversi
Reconstitutable &= !isNoexceptExceptionSpec(FT->getExceptionSpecType());
+ Reconstitutable &= !FT->getNoReturnAttr();
return Reconstitutable;
}
bool VisitRecordType(RecordType *RT) {
diff --git a/clang/test/CodeGenCXX/debug-info-simple-template-names.cpp b/clang/test/CodeGenCXX/debug-info-simple-template-names.cpp
index 3d8e69abed99..00c4361e11ef 100644
--- a/clang/test/CodeGenCXX/debug-info-simple-template-names.cpp
+++ b/clang/test/CodeGenCXX/debug-info-simple-template-names.cpp
@@ -116,4 +116,10 @@ void f() {
f1<const unsigned _BitInt(5)>();
// CHECK: !DISubprogram(name: "f1<const unsigned _BitInt(5)>",
+
+ // Add a parameter just so this differs from other attributed function types
+ // that don't mangle differently.
+ int fnrt() __attribute__((noreturn));
+ f1<decltype(fnrt)>();
+ // CHECK: !DISubprogram(name: "f1<int () __attribute__((noreturn))>",
}
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 5ecc3bc7fc14..5b1afcb29cc7 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
@@ -325,6 +325,8 @@ int main() {
f1<int t1<>::*>();
void fcc() __attribute__((swiftcall));
f1<decltype(fcc)>();
+ int fnrt() __attribute__((noreturn));
+ f1<decltype(fnrt)>();
}
void t8::mem() {
struct t7 { };