vleschuk added reviewers: dexonsmith, echristo, aprantl.
vleschuk added a subscriber: cfe-commits.
vleschuk updated this revision to Diff 66822.
vleschuk added a comment.
Herald added a subscriber: mehdi_amini.

Expanded context, added more reviewers who took part in this parts of code.


https://reviews.llvm.org/D23167

Files:
  include/llvm/IR/DebugInfoFlags.def
  include/llvm/IR/DebugInfoMetadata.h
  include/llvm/Support/Dwarf.h
  lib/CodeGen/AsmPrinter/DwarfUnit.cpp
  lib/Support/Dwarf.cpp
  unittests/IR/DebugInfoTest.cpp

Index: unittests/IR/DebugInfoTest.cpp
===================================================================
--- unittests/IR/DebugInfoTest.cpp
+++ unittests/IR/DebugInfoTest.cpp
@@ -73,8 +73,9 @@
   CHECK_SPLIT(DINode::FlagRValueReference, {DINode::FlagRValueReference}, 0u);
   unsigned Flags[] = {DINode::FlagFwdDecl, DINode::FlagVector};
   CHECK_SPLIT(DINode::FlagFwdDecl | DINode::FlagVector, Flags, 0u);
-  CHECK_SPLIT(0x100000u, {}, 0x100000u);
-  CHECK_SPLIT(0x100000u | DINode::FlagVector, {DINode::FlagVector}, 0x100000u);
+  CHECK_SPLIT(0x200000u, {}, 0x200000u);
+  CHECK_SPLIT(0x200000u | DINode::FlagVector, {DINode::FlagVector}, 0x200000u);
+  CHECK_SPLIT(0x200000u | DINode::FlagNoReturn, {DINode::FlagNoReturn}, 
0x200000u);
 #undef CHECK_SPLIT
 }
 
Index: lib/Support/Dwarf.cpp
===================================================================
--- lib/Support/Dwarf.cpp
+++ lib/Support/Dwarf.cpp
@@ -147,6 +147,7 @@
   case DW_AT_dwo_name:                   return "DW_AT_dwo_name";
   case DW_AT_reference:                  return "DW_AT_reference";
   case DW_AT_rvalue_reference:           return "DW_AT_rvalue_reference";
+  case DW_AT_noreturn:                   return "DW_AT_noreturn";
   case DW_AT_MIPS_loop_begin:            return "DW_AT_MIPS_loop_begin";
   case DW_AT_MIPS_tail_loop_begin:       return "DW_AT_MIPS_tail_loop_begin";
   case DW_AT_MIPS_epilog_begin:          return "DW_AT_MIPS_epilog_begin";
Index: lib/CodeGen/AsmPrinter/DwarfUnit.cpp
===================================================================
--- lib/CodeGen/AsmPrinter/DwarfUnit.cpp
+++ lib/CodeGen/AsmPrinter/DwarfUnit.cpp
@@ -1248,6 +1248,9 @@
   if (SP->isRValueReference())
     addFlag(SPDie, dwarf::DW_AT_rvalue_reference);
 
+  if (SP->isNoReturn())
+    addFlag(SPDie, dwarf::DW_AT_noreturn);
+
   if (SP->isProtected())
     addUInt(SPDie, dwarf::DW_AT_accessibility, dwarf::DW_FORM_data1,
             dwarf::DW_ACCESS_protected);
Index: include/llvm/Support/Dwarf.h
===================================================================
--- include/llvm/Support/Dwarf.h
+++ include/llvm/Support/Dwarf.h
@@ -197,6 +197,7 @@
   DW_AT_reference = 0x77,
   DW_AT_rvalue_reference = 0x78,
   DW_AT_macros = 0x79,
+  DW_AT_noreturn = 0x87,
 
   DW_AT_lo_user = 0x2000,
   DW_AT_hi_user = 0x3fff,
Index: include/llvm/IR/DebugInfoMetadata.h
===================================================================
--- include/llvm/IR/DebugInfoMetadata.h
+++ include/llvm/IR/DebugInfoMetadata.h
@@ -1419,6 +1419,13 @@
     return getFlags() & FlagRValueReference;
   }
 
+  /// \brief Check if this is marked as noreturn
+  ///
+  /// Return true if this subprogram is C++11 noreturn or C11 _Noreturn
+  unsigned isNoReturn() const {
+    return getFlags() & FlagNoReturn;
+  }
+
   DIScopeRef getScope() const { return DIScopeRef(getRawScope()); }
 
   StringRef getName() const { return getStringOperand(2); }
Index: include/llvm/IR/DebugInfoFlags.def
===================================================================
--- include/llvm/IR/DebugInfoFlags.def
+++ include/llvm/IR/DebugInfoFlags.def
@@ -38,5 +38,6 @@
 HANDLE_DI_FLAG((3 << 16), VirtualInheritance)
 HANDLE_DI_FLAG((1 << 18), IntroducedVirtual)
 HANDLE_DI_FLAG((1 << 19), BitField)
+HANDLE_DI_FLAG((1 << 20), NoReturn)
 
 #undef HANDLE_DI_FLAG


Index: unittests/IR/DebugInfoTest.cpp
===================================================================
--- unittests/IR/DebugInfoTest.cpp
+++ unittests/IR/DebugInfoTest.cpp
@@ -73,8 +73,9 @@
   CHECK_SPLIT(DINode::FlagRValueReference, {DINode::FlagRValueReference}, 0u);
   unsigned Flags[] = {DINode::FlagFwdDecl, DINode::FlagVector};
   CHECK_SPLIT(DINode::FlagFwdDecl | DINode::FlagVector, Flags, 0u);
-  CHECK_SPLIT(0x100000u, {}, 0x100000u);
-  CHECK_SPLIT(0x100000u | DINode::FlagVector, {DINode::FlagVector}, 0x100000u);
+  CHECK_SPLIT(0x200000u, {}, 0x200000u);
+  CHECK_SPLIT(0x200000u | DINode::FlagVector, {DINode::FlagVector}, 0x200000u);
+  CHECK_SPLIT(0x200000u | DINode::FlagNoReturn, {DINode::FlagNoReturn}, 0x200000u);
 #undef CHECK_SPLIT
 }
 
Index: lib/Support/Dwarf.cpp
===================================================================
--- lib/Support/Dwarf.cpp
+++ lib/Support/Dwarf.cpp
@@ -147,6 +147,7 @@
   case DW_AT_dwo_name:                   return "DW_AT_dwo_name";
   case DW_AT_reference:                  return "DW_AT_reference";
   case DW_AT_rvalue_reference:           return "DW_AT_rvalue_reference";
+  case DW_AT_noreturn:                   return "DW_AT_noreturn";
   case DW_AT_MIPS_loop_begin:            return "DW_AT_MIPS_loop_begin";
   case DW_AT_MIPS_tail_loop_begin:       return "DW_AT_MIPS_tail_loop_begin";
   case DW_AT_MIPS_epilog_begin:          return "DW_AT_MIPS_epilog_begin";
Index: lib/CodeGen/AsmPrinter/DwarfUnit.cpp
===================================================================
--- lib/CodeGen/AsmPrinter/DwarfUnit.cpp
+++ lib/CodeGen/AsmPrinter/DwarfUnit.cpp
@@ -1248,6 +1248,9 @@
   if (SP->isRValueReference())
     addFlag(SPDie, dwarf::DW_AT_rvalue_reference);
 
+  if (SP->isNoReturn())
+    addFlag(SPDie, dwarf::DW_AT_noreturn);
+
   if (SP->isProtected())
     addUInt(SPDie, dwarf::DW_AT_accessibility, dwarf::DW_FORM_data1,
             dwarf::DW_ACCESS_protected);
Index: include/llvm/Support/Dwarf.h
===================================================================
--- include/llvm/Support/Dwarf.h
+++ include/llvm/Support/Dwarf.h
@@ -197,6 +197,7 @@
   DW_AT_reference = 0x77,
   DW_AT_rvalue_reference = 0x78,
   DW_AT_macros = 0x79,
+  DW_AT_noreturn = 0x87,
 
   DW_AT_lo_user = 0x2000,
   DW_AT_hi_user = 0x3fff,
Index: include/llvm/IR/DebugInfoMetadata.h
===================================================================
--- include/llvm/IR/DebugInfoMetadata.h
+++ include/llvm/IR/DebugInfoMetadata.h
@@ -1419,6 +1419,13 @@
     return getFlags() & FlagRValueReference;
   }
 
+  /// \brief Check if this is marked as noreturn
+  ///
+  /// Return true if this subprogram is C++11 noreturn or C11 _Noreturn
+  unsigned isNoReturn() const {
+    return getFlags() & FlagNoReturn;
+  }
+
   DIScopeRef getScope() const { return DIScopeRef(getRawScope()); }
 
   StringRef getName() const { return getStringOperand(2); }
Index: include/llvm/IR/DebugInfoFlags.def
===================================================================
--- include/llvm/IR/DebugInfoFlags.def
+++ include/llvm/IR/DebugInfoFlags.def
@@ -38,5 +38,6 @@
 HANDLE_DI_FLAG((3 << 16), VirtualInheritance)
 HANDLE_DI_FLAG((1 << 18), IntroducedVirtual)
 HANDLE_DI_FLAG((1 << 19), BitField)
+HANDLE_DI_FLAG((1 << 20), NoReturn)
 
 #undef HANDLE_DI_FLAG
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to