r375012 - [DWARF5] Added support for DW_AT_noreturn attribute to be emitted for

Adrian Prantl via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 16 09:30:38 PDT 2019


Author: adrian
Date: Wed Oct 16 09:30:38 2019
New Revision: 375012

URL: http://llvm.org/viewvc/llvm-project?rev=375012&view=rev
Log:
[DWARF5] Added support for DW_AT_noreturn attribute to be emitted for
C++ class member functions.

Patch by Sourabh Singh Tomar!

Differential Revision: https://reviews.llvm.org/D68697

Added:
    cfe/trunk/test/CodeGenCXX/debug-info-noreturn.cpp
Modified:
    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=375012&r1=375011&r2=375012&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Wed Oct 16 09:30:38 2019
@@ -1605,6 +1605,8 @@ llvm::DISubprogram *CGDebugInfo::CreateC
     ContainingType = RecordTy;
   }
 
+  if (Method->isNoReturn())
+    Flags |= llvm::DINode::FlagNoReturn;
   if (Method->isStatic())
     Flags |= llvm::DINode::FlagStaticMember;
   if (Method->isImplicit())

Added: cfe/trunk/test/CodeGenCXX/debug-info-noreturn.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-noreturn.cpp?rev=375012&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenCXX/debug-info-noreturn.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/debug-info-noreturn.cpp Wed Oct 16 09:30:38 2019
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -std=c++11 -emit-llvm -fcxx-exceptions -debug-info-kind=standalone  %s -o - | FileCheck %s
+// Test for NoReturn flags in debug info.
+
+// CHECK: DISubprogram(name: "f", {{.*}}, flags: DIFlagPrototyped | DIFlagNoReturn, spFlags: DISPFlagDefinition
+// CHECK: DISubprogram(name: "foo_member", {{.*}}, flags: DIFlagPrototyped | DIFlagNoReturn, spFlags: 0
+// CHECK-NOT: DISubprogram(name: "func",{{.*}}, flags: DIFlagPrototyped | DIFlagNoReturn, spFlags: DISPFlagDefinition
+
+class foo {
+
+  [[noreturn]] void foo_member() { throw 1; }
+};
+
+[[noreturn]] void f() {
+  throw 1;
+}
+
+void func() {
+  foo object;
+}




More information about the cfe-commits mailing list