[clang] 7b498be - DebugInfo: Classify noreturn function types as non-reconstructible

David Blaikie via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 24 11:54:26 PDT 2022


Author: David Blaikie
Date: 2022-03-24T18:53:14Z
New Revision: 7b498beef03ae07bb98796461a957af836074b92

URL: https://github.com/llvm/llvm-project/commit/7b498beef03ae07bb98796461a957af836074b92
DIFF: https://github.com/llvm/llvm-project/commit/7b498beef03ae07bb98796461a957af836074b92.diff

LOG: 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)

Added: 
    

Modified: 
    clang/lib/CodeGen/CGDebugInfo.cpp
    clang/test/CodeGenCXX/debug-info-simple-template-names.cpp
    cross-project-tests/debuginfo-tests/clang_llvm_roundtrip/simplified_template_names.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index 75ce74b31846f..beb640375dfba 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 3d8e69abed99b..00c4361e11ef4 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 
diff ers from other attributed function types
+  // that don't mangle 
diff erently.
+  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 5ecc3bc7fc144..5b1afcb29cc7f 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 { };


        


More information about the cfe-commits mailing list