summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2017-09-29 15:41:22 +0000
committerJonas Devlieghere <jonas@devlieghere.com>2017-09-29 15:41:22 +0000
commita15f25d325f7c2e354b19e0fc80a40e99892d93c (patch)
tree0b08f39b27515b31453f4d928a438ff5a87be595 /llvm/lib
parentce4ddd06dad33ce272dce9784a0edd1d957ab208 (diff)
downloadbcm5719-llvm-a15f25d325f7c2e354b19e0fc80a40e99892d93c.tar.gz
bcm5719-llvm-a15f25d325f7c2e354b19e0fc80a40e99892d93c.zip
[dwarfdump][NFC] Consistent printing of address ranges
This implement the insertion operator for DWARF address ranges so they are consistently printed as [LowPC, HighPC). While a dump method might have felt more consistent, it is used exclusively for printing error messages in the verifier and never used for actual dumping. Hence this approach is more intuitive and creates less clutter at the call sites. Differential revision: https://reviews.llvm.org/D38395 llvm-svn: 314523
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFDebugRangeList.cpp5
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp11
2 files changed, 8 insertions, 8 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDebugRangeList.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDebugRangeList.cpp
index 62bd5af4e64..f0b7ec2751d 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFDebugRangeList.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFDebugRangeList.cpp
@@ -17,6 +17,11 @@
using namespace llvm;
+raw_ostream &llvm::operator<<(raw_ostream &OS, const DWARFAddressRange &R) {
+ return OS << format("[0x%16.16" PRIx64 ", 0x%16.16" PRIx64 ")", R.LowPC,
+ R.HighPC);
+}
+
void DWARFDebugRangeList::clear() {
Offset = -1U;
AddressSize = 0;
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
index 7f5ef1567ca..27e6a05e6dd 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
@@ -315,9 +315,7 @@ unsigned DWARFVerifier::verifyDieRanges(const DWARFDie &Die,
for (auto Range : Ranges) {
if (!Range.valid()) {
++NumErrors;
- error() << format("Invalid address range [0x%08" PRIx64 " - 0x%08" PRIx64
- "].\n",
- Range.LowPC, Range.HighPC);
+ error() << "Invalid address range " << Range << "\n";
continue;
}
@@ -325,11 +323,8 @@ unsigned DWARFVerifier::verifyDieRanges(const DWARFDie &Die,
const auto IntersectingRange = RI.insert(Range);
if (IntersectingRange != RI.Ranges.end()) {
++NumErrors;
- error() << format("DIE has overlapping address ranges: [0x%08" PRIx64
- " - 0x%08" PRIx64 "] and [0x%08" PRIx64
- " - 0x%08" PRIx64 "].\n",
- Range.LowPC, Range.HighPC, IntersectingRange->LowPC,
- IntersectingRange->HighPC);
+ error() << "DIE has overlapping address ranges: " << Range << " and "
+ << *IntersectingRange << "\n";
break;
}
}
OpenPOWER on IntegriCloud