summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo/GSYM/Range.cpp
diff options
context:
space:
mode:
authorGreg Clayton <clayborg@gmail.com>2019-09-04 17:32:51 +0000
committerGreg Clayton <clayborg@gmail.com>2019-09-04 17:32:51 +0000
commit7d0a545ee65eb181c28066dc06fc3fb9443a653e (patch)
tree1ec0dccfc1cac82b232b9f19bd9ec87645695234 /llvm/lib/DebugInfo/GSYM/Range.cpp
parent0e07248704fa97f6c7d9e007f82db17116fbaf78 (diff)
downloadbcm5719-llvm-7d0a545ee65eb181c28066dc06fc3fb9443a653e.tar.gz
bcm5719-llvm-7d0a545ee65eb181c28066dc06fc3fb9443a653e.zip
Add encode and decode methods to InlineInfo and document encoding format to the GSYM file format.
This patch adds the ability to encode and decode InlineInfo objects and adds test coverage. Error handling is introduced in the encoding and decoding which will be used from here on out for remaining patches. Differential Revision: https://reviews.llvm.org/D66600 llvm-svn: 370936
Diffstat (limited to 'llvm/lib/DebugInfo/GSYM/Range.cpp')
-rw-r--r--llvm/lib/DebugInfo/GSYM/Range.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/lib/DebugInfo/GSYM/Range.cpp b/llvm/lib/DebugInfo/GSYM/Range.cpp
index f4d31f328a2..19ab700fdd5 100644
--- a/llvm/lib/DebugInfo/GSYM/Range.cpp
+++ b/llvm/lib/DebugInfo/GSYM/Range.cpp
@@ -42,6 +42,17 @@ bool AddressRanges::contains(uint64_t Addr) const {
return It != Ranges.begin() && Addr < It[-1].End;
}
+bool AddressRanges::contains(AddressRange Range) const {
+ if (Range.size() == 0)
+ return false;
+ auto It = std::partition_point(
+ Ranges.begin(), Ranges.end(),
+ [=](const AddressRange &R) { return R.Start <= Range.Start; });
+ if (It == Ranges.begin())
+ return false;
+ return Range.End <= It[-1].End;
+}
+
raw_ostream &llvm::gsym::operator<<(raw_ostream &OS, const AddressRange &R) {
return OS << '[' << HEX64(R.Start) << " - " << HEX64(R.End) << ")";
}
OpenPOWER on IntegriCloud