diff options
Diffstat (limited to 'contrib/llvm/lib/DebugInfo/DWARF/DWARFDebugRangeList.cpp')
| -rw-r--r-- | contrib/llvm/lib/DebugInfo/DWARF/DWARFDebugRangeList.cpp | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/contrib/llvm/lib/DebugInfo/DWARF/DWARFDebugRangeList.cpp b/contrib/llvm/lib/DebugInfo/DWARF/DWARFDebugRangeList.cpp index a565718debd0..dfb913000a46 100644 --- a/contrib/llvm/lib/DebugInfo/DWARF/DWARFDebugRangeList.cpp +++ b/contrib/llvm/lib/DebugInfo/DWARF/DWARFDebugRangeList.cpp @@ -9,6 +9,7 @@ #include "llvm/DebugInfo/DWARF/DWARFDebugRangeList.h" #include "llvm/DebugInfo/DWARF/DWARFContext.h" +#include "llvm/Support/Errc.h" #include "llvm/Support/Format.h" #include "llvm/Support/raw_ostream.h" #include <cinttypes> @@ -16,15 +17,6 @@ using namespace llvm; -// FIXME: There are several versions of this. Consolidate them. -template <typename... Ts> -static Error createError(char const *Fmt, const Ts &... Vals) { - std::string Buffer; - raw_string_ostream Stream(Buffer); - Stream << format(Fmt, Vals...); - return make_error<StringError>(Stream.str(), inconvertibleErrorCode()); -} - void DWARFDebugRangeList::clear() { Offset = -1U; AddressSize = 0; @@ -35,11 +27,13 @@ Error DWARFDebugRangeList::extract(const DWARFDataExtractor &data, uint32_t *offset_ptr) { clear(); if (!data.isValidOffset(*offset_ptr)) - return createError("invalid range list offset 0x%" PRIx32, *offset_ptr); + return createStringError(errc::invalid_argument, + "invalid range list offset 0x%" PRIx32, *offset_ptr); AddressSize = data.getAddressSize(); if (AddressSize != 4 && AddressSize != 8) - return createError("invalid address size: %d", AddressSize); + return createStringError(errc::invalid_argument, + "invalid address size: %" PRIu8, AddressSize); Offset = *offset_ptr; while (true) { RangeListEntry Entry; @@ -53,7 +47,8 @@ Error DWARFDebugRangeList::extract(const DWARFDataExtractor &data, // Check that both values were extracted correctly. if (*offset_ptr != prev_offset + 2 * AddressSize) { clear(); - return createError("invalid range list entry at offset 0x%" PRIx32, + return createStringError(errc::invalid_argument, + "invalid range list entry at offset 0x%" PRIx32, prev_offset); } if (Entry.isEndOfListEntry()) @@ -74,7 +69,7 @@ void DWARFDebugRangeList::dump(raw_ostream &OS) const { } DWARFAddressRangesVector DWARFDebugRangeList::getAbsoluteRanges( - llvm::Optional<BaseAddress> BaseAddr) const { + llvm::Optional<SectionedAddress> BaseAddr) const { DWARFAddressRangesVector Res; for (const RangeListEntry &RLE : Entries) { if (RLE.isBaseAddressSelectionEntry(AddressSize)) { |
