<div dir="ltr">Removed the macro because it seemed a bit unnecessary (nice to have, but unnecessary given the gotchas around macros, etc) in r305405.<br></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Jun 14, 2017 at 10:33 AM Galina Kistanova via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: gkistanova<br>
Date: Wed Jun 14 12:32:53 2017<br>
New Revision: 305405<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=305405&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=305405&view=rev</a><br>
Log:<br>
Specified ReportError as noreturn friendly to old compilers.<br>
<br>
Modified:<br>
    llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp<br>
<br>
Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp?rev=305405&r1=305404&r2=305405&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp?rev=305405&r1=305404&r2=305405&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp (original)<br>
+++ llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp Wed Jun 14 12:32:53 2017<br>
@@ -514,6 +514,20 @@ static uint64_t readPointer(const DataEx<br>
   }<br>
 }<br>
<br>
+// This is a workaround for old compilers which do not allow<br>
+// noreturn attribute usage in lambdas. Once the support for those<br>
+// compilers are phased out, we can remove this and return back to<br>
+// a ReportError lambda: [StartOffset](const char *ErrorMsg).<br>
+#define ReportError(ErrorMsg) ReportErrorImpl(StartOffset,ErrorMsg)<br>
+static void LLVM_ATTRIBUTE_NORETURN<br>
+ReportErrorImpl(uint32_t StartOffset, const char *ErrorMsg) {<br>
+      std::string Str;<br>
+      raw_string_ostream OS(Str);<br>
+      OS << format(ErrorMsg, StartOffset);<br>
+      OS.flush();<br>
+      report_fatal_error(Str);<br>
+}<br>
+<br>
 void DWARFDebugFrame::parse(DataExtractor Data) {<br>
   uint32_t Offset = 0;<br>
   DenseMap<uint32_t, CIE *> CIEs;<br>
@@ -521,14 +535,6 @@ void DWARFDebugFrame::parse(DataExtracto<br>
   while (Data.isValidOffset(Offset)) {<br>
     uint32_t StartOffset = Offset;<br>
<br>
-    auto ReportError = [StartOffset](const char *ErrorMsg) {<br>
-      std::string Str;<br>
-      raw_string_ostream OS(Str);<br>
-      OS << format(ErrorMsg, StartOffset);<br>
-      OS.flush();<br>
-      report_fatal_error(Str);<br>
-    };<br>
-<br>
     bool IsDWARF64 = false;<br>
     uint64_t Length = Data.getU32(&Offset);<br>
     uint64_t Id;<br>
@@ -585,7 +591,6 @@ void DWARFDebugFrame::parse(DataExtracto<br>
           switch (AugmentationString[i]) {<br>
             default:<br>
               ReportError("Unknown augmentation character in entry at %lx");<br>
-              llvm_unreachable("ReportError should not return.");<br>
             case 'L':<br>
               LSDAPointerEncoding = Data.getU8(&Offset);<br>
               break;<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div>