[llvm] r305405 - Specified ReportError as noreturn friendly to old compilers.
Galina Kistanova via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 14 10:32:53 PDT 2017
Author: gkistanova
Date: Wed Jun 14 12:32:53 2017
New Revision: 305405
URL: http://llvm.org/viewvc/llvm-project?rev=305405&view=rev
Log:
Specified ReportError as noreturn friendly to old compilers.
Modified:
llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp?rev=305405&r1=305404&r2=305405&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp Wed Jun 14 12:32:53 2017
@@ -514,6 +514,20 @@ static uint64_t readPointer(const DataEx
}
}
+// This is a workaround for old compilers which do not allow
+// noreturn attribute usage in lambdas. Once the support for those
+// compilers are phased out, we can remove this and return back to
+// a ReportError lambda: [StartOffset](const char *ErrorMsg).
+#define ReportError(ErrorMsg) ReportErrorImpl(StartOffset,ErrorMsg)
+static void LLVM_ATTRIBUTE_NORETURN
+ReportErrorImpl(uint32_t StartOffset, const char *ErrorMsg) {
+ std::string Str;
+ raw_string_ostream OS(Str);
+ OS << format(ErrorMsg, StartOffset);
+ OS.flush();
+ report_fatal_error(Str);
+}
+
void DWARFDebugFrame::parse(DataExtractor Data) {
uint32_t Offset = 0;
DenseMap<uint32_t, CIE *> CIEs;
@@ -521,14 +535,6 @@ void DWARFDebugFrame::parse(DataExtracto
while (Data.isValidOffset(Offset)) {
uint32_t StartOffset = Offset;
- auto ReportError = [StartOffset](const char *ErrorMsg) {
- std::string Str;
- raw_string_ostream OS(Str);
- OS << format(ErrorMsg, StartOffset);
- OS.flush();
- report_fatal_error(Str);
- };
-
bool IsDWARF64 = false;
uint64_t Length = Data.getU32(&Offset);
uint64_t Id;
@@ -585,7 +591,6 @@ void DWARFDebugFrame::parse(DataExtracto
switch (AugmentationString[i]) {
default:
ReportError("Unknown augmentation character in entry at %lx");
- llvm_unreachable("ReportError should not return.");
case 'L':
LSDAPointerEncoding = Data.getU8(&Offset);
break;
More information about the llvm-commits
mailing list