<div dir="ltr">I mean the original change D63104. There were many issues unaddressed when committed.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Jun 29, 2019 at 10:48 AM Fāng-ruì Sòng <<a href="mailto:maskray@google.com">maskray@google.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Sorry but I think that change was not properly accepted when committed :)</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Jun 29, 2019 at 2:28 AM Shoaib Meenai <<a href="mailto:smeenai@fb.com" target="_blank">smeenai@fb.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
<br>
Could you please send changes like this for review? There's reasons the original code was written the way it was; it's certainly possible there's potential for simplification, but we should discuss those simplifications in a review (and make sure those simplifications don't conflict with any intended design decisions or complicate any planned follow-ups) instead of just committing them. Pre-commit review is more appropriate than post-commit review here IMO.<br>
<br>
Could you please revert this and put the change up for review instead?<br>
<br>
Thanks,<br>
Shoaib<br>
<br>
On 6/28/19, 3:06 AM, "llvm-commits on behalf of Fangrui Song via llvm-commits" <<a href="mailto:llvm-commits-bounces@lists.llvm.org" target="_blank">llvm-commits-bounces@lists.llvm.org</a> on behalf of <a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>> wrote:<br>
<br>
Author: maskray<br>
Date: Fri Jun 28 03:06:11 2019<br>
New Revision: 364637<br>
<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D364637-26view-3Drev&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=9k7U8PQKHsbaC7-lQKaTb9lbupnubmUuPe6K5-QRsFs&s=HHSSOOpecreYY-A_EIkI-32v-3UF3l43QAWHvnAZlzU&e=" rel="noreferrer" target="_blank">https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D364637-26view-3Drev&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=9k7U8PQKHsbaC7-lQKaTb9lbupnubmUuPe6K5-QRsFs&s=HHSSOOpecreYY-A_EIkI-32v-3UF3l43QAWHvnAZlzU&e=</a> <br>
Log:<br>
[DebugInfo] Simplify GSYM::AddressRange and GSYM::AddressRanges<br>
<br>
Delete unnecessary getters of AddressRange.<br>
Simplify AddressRange::size(): Start <= End check should be checked in an upper layer.<br>
Delete isContiguousWith() that doesn't make sense.<br>
Simplify AddressRanges::insert. Delete commented code. Fix it when more than 1 ranges are to be deleted.<br>
Delete trailing newline.<br>
<br>
Modified:<br>
llvm/trunk/include/llvm/DebugInfo/GSYM/FunctionInfo.h<br>
llvm/trunk/include/llvm/DebugInfo/GSYM/Range.h<br>
llvm/trunk/lib/DebugInfo/GSYM/FunctionInfo.cpp<br>
llvm/trunk/lib/DebugInfo/GSYM/InlineInfo.cpp<br>
llvm/trunk/lib/DebugInfo/GSYM/Range.cpp<br>
llvm/trunk/unittests/DebugInfo/GSYM/GSYMTest.cpp<br>
<br>
Modified: llvm/trunk/include/llvm/DebugInfo/GSYM/FunctionInfo.h<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_include_llvm_DebugInfo_GSYM_FunctionInfo.h-3Frev-3D364637-26r1-3D364636-26r2-3D364637-26view-3Ddiff&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=9k7U8PQKHsbaC7-lQKaTb9lbupnubmUuPe6K5-QRsFs&s=mmQTOGibvK--0aX6eaTu1duWFnVth5HTuAAKDuTG9Us&e=" rel="noreferrer" target="_blank">https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_include_llvm_DebugInfo_GSYM_FunctionInfo.h-3Frev-3D364637-26r1-3D364636-26r2-3D364637-26view-3Ddiff&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=9k7U8PQKHsbaC7-lQKaTb9lbupnubmUuPe6K5-QRsFs&s=mmQTOGibvK--0aX6eaTu1duWFnVth5HTuAAKDuTG9Us&e=</a> <br>
==============================================================================<br>
--- llvm/trunk/include/llvm/DebugInfo/GSYM/FunctionInfo.h (original)<br>
+++ llvm/trunk/include/llvm/DebugInfo/GSYM/FunctionInfo.h Fri Jun 28 03:06:11 2019<br>
@@ -56,15 +56,15 @@ struct FunctionInfo {<br>
return Name != 0;<br>
}<br>
<br>
- uint64_t startAddress() const { return Range.startAddress(); }<br>
- uint64_t endAddress() const { return Range.endAddress(); }<br>
+ uint64_t startAddress() const { return Range.Start; }<br>
+ uint64_t endAddress() const { return Range.End; }<br>
uint64_t size() const { return Range.size(); }<br>
- void setStartAddress(uint64_t Addr) { Range.setStartAddress(Addr); }<br>
- void setEndAddress(uint64_t Addr) { Range.setEndAddress(Addr); }<br>
- void setSize(uint64_t Size) { Range.setSize(Size); }<br>
+ void setStartAddress(uint64_t Addr) { Range.End = Addr; }<br>
+ void setEndAddress(uint64_t Addr) { Range.End = Addr; }<br>
+ void setSize(uint64_t Size) { Range.End = Range.Start + Size; }<br>
<br>
void clear() {<br>
- Range.clear();<br>
+ Range = {0, 0};<br>
Name = 0;<br>
Lines.clear();<br>
Inline.clear();<br>
<br>
Modified: llvm/trunk/include/llvm/DebugInfo/GSYM/Range.h<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_include_llvm_DebugInfo_GSYM_Range.h-3Frev-3D364637-26r1-3D364636-26r2-3D364637-26view-3Ddiff&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=9k7U8PQKHsbaC7-lQKaTb9lbupnubmUuPe6K5-QRsFs&s=EMTyHM9NH0f4YtAPDT4VF_4qaLWLyOsNfflwielcy7g&e=" rel="noreferrer" target="_blank">https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_include_llvm_DebugInfo_GSYM_Range.h-3Frev-3D364637-26r1-3D364636-26r2-3D364637-26view-3Ddiff&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=9k7U8PQKHsbaC7-lQKaTb9lbupnubmUuPe6K5-QRsFs&s=EMTyHM9NH0f4YtAPDT4VF_4qaLWLyOsNfflwielcy7g&e=</a> <br>
==============================================================================<br>
--- llvm/trunk/include/llvm/DebugInfo/GSYM/Range.h (original)<br>
+++ llvm/trunk/include/llvm/DebugInfo/GSYM/Range.h Fri Jun 28 03:06:11 2019<br>
@@ -27,58 +27,28 @@ namespace gsym {<br>
<br>
/// A class that represents an address range. The range is specified using<br>
/// a start and an end address.<br>
-class AddressRange {<br>
+struct AddressRange {<br>
uint64_t Start;<br>
uint64_t End;<br>
-public:<br>
- AddressRange(uint64_t S = 0, uint64_t E = 0) : Start(S), End(E) {}<br>
- /// Access to the size must use the size() accessor to ensure the correct<br>
- /// answer. This allows an AddressRange to be constructed with invalid<br>
- /// address ranges where the end address is less that the start address<br>
- /// either because it was not set, or because of incorrect data.<br>
- uint64_t size() const { return Start < End ? End - Start : 0; }<br>
- void setStartAddress(uint64_t Addr) { Start = Addr; }<br>
- void setEndAddress(uint64_t Addr) { End = Addr; }<br>
- void setSize(uint64_t Size) { End = Start + Size; }<br>
- uint64_t startAddress() const { return Start; }<br>
- /// Access to the end address must use the size() accessor to ensure the<br>
- /// correct answer. This allows an AddressRange to be constructed with<br>
- /// invalid address ranges where the end address is less that the start<br>
- /// address either because it was not set, or because of incorrect data.<br>
- uint64_t endAddress() const { return Start + size(); }<br>
- void clear() {<br>
- Start = 0;<br>
- End = 0;<br>
+ AddressRange() : Start(0), End(0) {}<br>
+ AddressRange(uint64_t S, uint64_t E) : Start(S), End(E) {}<br>
+ uint64_t size() const { return End - Start; }<br>
+ bool contains(uint64_t Addr) const { return Start <= Addr && Addr < End; }<br>
+ bool intersects(const AddressRange &R) const {<br>
+ return Start < R.End && R.Start < End;<br>
}<br>
- bool contains(uint64_t Addr) const { return Start <= Addr && Addr < endAddress(); }<br>
- bool isContiguousWith(const AddressRange &R) const {<br>
- return (Start <= R.endAddress()) && (endAddress() >= R.Start);<br>
+<br>
+ bool operator==(const AddressRange &R) const {<br>
+ return Start == R.Start && End == R.End;<br>
}<br>
- bool intersects(const AddressRange &R) const {<br>
- return (Start < R.endAddress()) && (endAddress() > R.Start);<br>
+ bool operator!=(const AddressRange &R) const {<br>
+ return !(*this == R);<br>
}<br>
- bool intersect(const AddressRange &R) {<br>
- if (intersects(R)) {<br>
- Start = std::min<uint64_t>(Start, R.Start);<br>
- End = std::max<uint64_t>(endAddress(), R.endAddress());<br>
- return true;<br>
- }<br>
- return false;<br>
+ bool operator<(const AddressRange &R) const {<br>
+ return std::make_pair(Start, End) < std::make_pair(R.Start, R.End);<br>
}<br>
};<br>
<br>
-inline bool operator==(const AddressRange &LHS, const AddressRange &RHS) {<br>
- return LHS.startAddress() == RHS.startAddress() && LHS.endAddress() == RHS.endAddress();<br>
-}<br>
-inline bool operator!=(const AddressRange &LHS, const AddressRange &RHS) {<br>
- return LHS.startAddress() != RHS.startAddress() || LHS.endAddress() != RHS.endAddress();<br>
-}<br>
-inline bool operator<(const AddressRange &LHS, const AddressRange &RHS) {<br>
- if (LHS.startAddress() == RHS.startAddress())<br>
- return LHS.endAddress() < RHS.endAddress();<br>
- return LHS.startAddress() < RHS.startAddress();<br>
-}<br>
-<br>
raw_ostream &operator<<(raw_ostream &OS, const AddressRange &R);<br>
<br>
/// The AddressRanges class helps normalize address range collections.<br>
@@ -96,7 +66,7 @@ public:<br>
void clear() { Ranges.clear(); }<br>
bool empty() const { return Ranges.empty(); }<br>
bool contains(uint64_t Addr) const;<br>
- void insert(const AddressRange &R);<br>
+ void insert(AddressRange Range);<br>
size_t size() const { return Ranges.size(); }<br>
bool operator==(const AddressRanges &RHS) const {<br>
return Ranges == RHS.Ranges;<br>
<br>
Modified: llvm/trunk/lib/DebugInfo/GSYM/FunctionInfo.cpp<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_DebugInfo_GSYM_FunctionInfo.cpp-3Frev-3D364637-26r1-3D364636-26r2-3D364637-26view-3Ddiff&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=9k7U8PQKHsbaC7-lQKaTb9lbupnubmUuPe6K5-QRsFs&s=sUHcNNabUTGc7vOIFREnTXOitPy11EE0XyMja95XYno&e=" rel="noreferrer" target="_blank">https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_DebugInfo_GSYM_FunctionInfo.cpp-3Frev-3D364637-26r1-3D364636-26r2-3D364637-26view-3Ddiff&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=9k7U8PQKHsbaC7-lQKaTb9lbupnubmUuPe6K5-QRsFs&s=sUHcNNabUTGc7vOIFREnTXOitPy11EE0XyMja95XYno&e=</a> <br>
==============================================================================<br>
--- llvm/trunk/lib/DebugInfo/GSYM/FunctionInfo.cpp (original)<br>
+++ llvm/trunk/lib/DebugInfo/GSYM/FunctionInfo.cpp Fri Jun 28 03:06:11 2019<br>
@@ -13,8 +13,7 @@ using namespace llvm;<br>
using namespace gsym;<br>
<br>
raw_ostream &llvm::gsym::operator<<(raw_ostream &OS, const FunctionInfo &FI) {<br>
- OS << '[' << HEX64(FI.Range.startAddress()) << '-'<br>
- << HEX64(FI.Range.endAddress()) << "): "<br>
+ OS << '[' << HEX64(FI.Range.Start) << '-' << HEX64(FI.Range.End) << "): "<br>
<< "Name=" << HEX32(FI.Name) << '\n';<br>
for (const auto &Line : FI.Lines)<br>
OS << Line << '\n';<br>
<br>
Modified: llvm/trunk/lib/DebugInfo/GSYM/InlineInfo.cpp<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_DebugInfo_GSYM_InlineInfo.cpp-3Frev-3D364637-26r1-3D364636-26r2-3D364637-26view-3Ddiff&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=9k7U8PQKHsbaC7-lQKaTb9lbupnubmUuPe6K5-QRsFs&s=hfxnzru6HE2peOD0j7_rKzCpPPZkGKjaFG9coTTnddA&e=" rel="noreferrer" target="_blank">https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_DebugInfo_GSYM_InlineInfo.cpp-3Frev-3D364637-26r1-3D364636-26r2-3D364637-26view-3Ddiff&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=9k7U8PQKHsbaC7-lQKaTb9lbupnubmUuPe6K5-QRsFs&s=hfxnzru6HE2peOD0j7_rKzCpPPZkGKjaFG9coTTnddA&e=</a> <br>
==============================================================================<br>
--- llvm/trunk/lib/DebugInfo/GSYM/InlineInfo.cpp (original)<br>
+++ llvm/trunk/lib/DebugInfo/GSYM/InlineInfo.cpp Fri Jun 28 03:06:11 2019<br>
@@ -34,7 +34,7 @@ raw_ostream &llvm::gsym::operator<<(raw_<br>
return OS;<br>
}<br>
<br>
-static bool getInlineStackHelper(const InlineInfo &II, uint64_t Addr, <br>
+static bool getInlineStackHelper(const InlineInfo &II, uint64_t Addr,<br>
std::vector<const InlineInfo *> &InlineStack) {<br>
if (II.Ranges.contains(Addr)) {<br>
// If this is the top level that represents the concrete function,<br>
<br>
Modified: llvm/trunk/lib/DebugInfo/GSYM/Range.cpp<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_DebugInfo_GSYM_Range.cpp-3Frev-3D364637-26r1-3D364636-26r2-3D364637-26view-3Ddiff&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=9k7U8PQKHsbaC7-lQKaTb9lbupnubmUuPe6K5-QRsFs&s=GXQpX_tQFMdcEJojiF98ivqbX50mCp5gZgyG8Ihi1L8&e=" rel="noreferrer" target="_blank">https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_DebugInfo_GSYM_Range.cpp-3Frev-3D364637-26r1-3D364636-26r2-3D364637-26view-3Ddiff&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=9k7U8PQKHsbaC7-lQKaTb9lbupnubmUuPe6K5-QRsFs&s=GXQpX_tQFMdcEJojiF98ivqbX50mCp5gZgyG8Ihi1L8&e=</a> <br>
==============================================================================<br>
--- llvm/trunk/lib/DebugInfo/GSYM/Range.cpp (original)<br>
+++ llvm/trunk/lib/DebugInfo/GSYM/Range.cpp Fri Jun 28 03:06:11 2019<br>
@@ -15,53 +15,41 @@ using namespace llvm;<br>
using namespace gsym;<br>
<br>
<br>
-void AddressRanges::insert(const AddressRange &Range) {<br>
+void AddressRanges::insert(AddressRange Range) {<br>
if (Range.size() == 0)<br>
return;<br>
- // Ranges.insert(std::upper_bound(Ranges.begin(), Ranges.end(), Range), Range);<br>
<br>
- // // Check if an existing range intersects with this range, and if so, <br>
- // // grow the intersecting ranges instead of adding a new one.<br>
- auto Begin = Ranges.begin();<br>
- auto End = Ranges.end();<br>
- const auto Iter = std::upper_bound(Begin, End, Range);<br>
- if (Iter != Begin) {<br>
- auto PrevIter = Iter - 1;<br>
- // If the previous range itersects with "Range" they will be combined.<br>
- if (PrevIter->intersect(Range)) {<br>
- // Now check if the previous range intersects with the next range since<br>
- // the previous range was combined. If so, combine them and remove the<br>
- // next range.<br>
- if (Iter != End && PrevIter->intersect(*Iter))<br>
- Ranges.erase(Iter);<br>
- return;<br>
- }<br>
+ auto It = llvm::upper_bound(Ranges, Range);<br>
+ auto It2 = It;<br>
+ while (It2 != Ranges.end() && It2->Start < Range.End)<br>
+ ++It2;<br>
+ if (It != It2) {<br>
+ Range.End = std::max(Range.End, It2[-1].End);<br>
+ It = Ranges.erase(It, It2);<br>
}<br>
- // If the next range intersects with "Range", combined and return.<br>
- if (Iter != End && Iter->intersect(Range))<br>
- return;<br>
- Ranges.insert(Iter, Range);<br>
+ if (It != Ranges.begin() && Range.Start < It[-1].End)<br>
+ It[-1].End = std::max(It[-1].End, Range.End);<br>
+ else<br>
+ Ranges.insert(It, Range);<br>
}<br>
<br>
bool AddressRanges::contains(uint64_t Addr) const {<br>
auto It = std::partition_point(<br>
Ranges.begin(), Ranges.end(),<br>
- [=](const AddressRange &R) { return R.startAddress() <= Addr; });<br>
- return It != Ranges.begin() && It[-1].contains(Addr);<br>
+ [=](const AddressRange &R) { return R.Start <= Addr; });<br>
+ return It != Ranges.begin() && Addr < It[-1].End;<br>
}<br>
<br>
raw_ostream &llvm::gsym::operator<<(raw_ostream &OS, const AddressRange &R) {<br>
- return OS << '[' << HEX64(R.startAddress()) << " - " << HEX64(R.endAddress())<br>
- << ")";<br>
+ return OS << '[' << HEX64(R.Start) << " - " << HEX64(R.End) << ")";<br>
}<br>
<br>
raw_ostream &llvm::gsym::operator<<(raw_ostream &OS, const AddressRanges &AR) {<br>
size_t Size = AR.size();<br>
- for (size_t I=0; I<Size; ++I) {<br>
+ for (size_t I = 0; I < Size; ++I) {<br>
if (I)<br>
OS << ' ';<br>
OS << AR[I];<br>
}<br>
return OS;<br>
}<br>
-<br>
<br>
Modified: llvm/trunk/unittests/DebugInfo/GSYM/GSYMTest.cpp<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_unittests_DebugInfo_GSYM_GSYMTest.cpp-3Frev-3D364637-26r1-3D364636-26r2-3D364637-26view-3Ddiff&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=9k7U8PQKHsbaC7-lQKaTb9lbupnubmUuPe6K5-QRsFs&s=dOdDQ6bFYyyjxoLnolMX58e1M7nkR346P3arFOgQneE&e=" rel="noreferrer" target="_blank">https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_unittests_DebugInfo_GSYM_GSYMTest.cpp-3Frev-3D364637-26r1-3D364636-26r2-3D364637-26view-3Ddiff&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=9k7U8PQKHsbaC7-lQKaTb9lbupnubmUuPe6K5-QRsFs&s=dOdDQ6bFYyyjxoLnolMX58e1M7nkR346P3arFOgQneE&e=</a> <br>
==============================================================================<br>
--- llvm/trunk/unittests/DebugInfo/GSYM/GSYMTest.cpp (original)<br>
+++ llvm/trunk/unittests/DebugInfo/GSYM/GSYMTest.cpp Fri Jun 28 03:06:11 2019<br>
@@ -179,33 +179,33 @@ TEST(GSYMTest, TestInlineInfo) {<br>
EXPECT_FALSE(Root.getInlineStack(0x50));<br>
<br>
// Verify that we get no inline stacks for addresses out of [0x100-0x200)<br>
- EXPECT_FALSE(Root.getInlineStack(Root.Ranges[0].startAddress() - 1));<br>
- EXPECT_FALSE(Root.getInlineStack(Root.Ranges[0].endAddress()));<br>
+ EXPECT_FALSE(Root.getInlineStack(Root.Ranges[0].Start - 1));<br>
+ EXPECT_FALSE(Root.getInlineStack(Root.Ranges[0].End));<br>
<br>
// Verify we get no inline stack entries for addresses that are in<br>
// [0x100-0x200) but not in [0x150-0x160)<br>
- EXPECT_FALSE(Root.getInlineStack(Inline1.Ranges[0].startAddress() - 1));<br>
- EXPECT_FALSE(Root.getInlineStack(Inline1.Ranges[0].endAddress()));<br>
+ EXPECT_FALSE(Root.getInlineStack(Inline1.Ranges[0].Start - 1));<br>
+ EXPECT_FALSE(Root.getInlineStack(Inline1.Ranges[0].End));<br>
<br>
// Verify we get one inline stack entry for addresses that are in<br>
// [[0x150-0x160)) but not in [0x152-0x155) or [0x157-0x158)<br>
- auto InlineInfos = Root.getInlineStack(Inline1.Ranges[0].startAddress());<br>
+ auto InlineInfos = Root.getInlineStack(Inline1.Ranges[0].Start);<br>
ASSERT_TRUE(InlineInfos);<br>
ASSERT_EQ(InlineInfos->size(), 1u);<br>
ASSERT_EQ(*InlineInfos->at(0), Inline1);<br>
- InlineInfos = Root.getInlineStack(Inline1.Ranges[0].endAddress() - 1);<br>
+ InlineInfos = Root.getInlineStack(Inline1.Ranges[0].End - 1);<br>
EXPECT_TRUE(InlineInfos);<br>
ASSERT_EQ(InlineInfos->size(), 1u);<br>
ASSERT_EQ(*InlineInfos->at(0), Inline1);<br>
<br>
// Verify we get two inline stack entries for addresses that are in<br>
// [0x152-0x155)<br>
- InlineInfos = Root.getInlineStack(Inline1Sub1.Ranges[0].startAddress());<br>
+ InlineInfos = Root.getInlineStack(Inline1Sub1.Ranges[0].Start);<br>
EXPECT_TRUE(InlineInfos);<br>
ASSERT_EQ(InlineInfos->size(), 2u);<br>
ASSERT_EQ(*InlineInfos->at(0), Inline1Sub1);<br>
ASSERT_EQ(*InlineInfos->at(1), Inline1);<br>
- InlineInfos = Root.getInlineStack(Inline1Sub1.Ranges[0].endAddress() - 1);<br>
+ InlineInfos = Root.getInlineStack(Inline1Sub1.Ranges[0].End - 1);<br>
EXPECT_TRUE(InlineInfos);<br>
ASSERT_EQ(InlineInfos->size(), 2u);<br>
ASSERT_EQ(*InlineInfos->at(0), Inline1Sub1);<br>
@@ -213,12 +213,12 @@ TEST(GSYMTest, TestInlineInfo) {<br>
<br>
// Verify we get two inline stack entries for addresses that are in<br>
// [0x157-0x158)<br>
- InlineInfos = Root.getInlineStack(Inline1Sub2.Ranges[0].startAddress());<br>
+ InlineInfos = Root.getInlineStack(Inline1Sub2.Ranges[0].Start);<br>
EXPECT_TRUE(InlineInfos);<br>
ASSERT_EQ(InlineInfos->size(), 2u);<br>
ASSERT_EQ(*InlineInfos->at(0), Inline1Sub2);<br>
ASSERT_EQ(*InlineInfos->at(1), Inline1);<br>
- InlineInfos = Root.getInlineStack(Inline1Sub2.Ranges[0].endAddress() - 1);<br>
+ InlineInfos = Root.getInlineStack(Inline1Sub2.Ranges[0].End - 1);<br>
EXPECT_TRUE(InlineInfos);<br>
ASSERT_EQ(InlineInfos->size(), 2u);<br>
ASSERT_EQ(*InlineInfos->at(0), Inline1Sub2);<br>
@@ -257,8 +257,6 @@ TEST(GSYMTest, TestRanges) {<br>
const uint64_t EndAddr = 0x2000;<br>
// Verify constructor and API to ensure it takes start and end address.<br>
const AddressRange Range(StartAddr, EndAddr);<br>
- EXPECT_EQ(Range.startAddress(), StartAddr);<br>
- EXPECT_EQ(Range.endAddress(), EndAddr);<br>
EXPECT_EQ(Range.size(), EndAddr - StartAddr);<br>
<br>
// Verify llvm::gsym::AddressRange::contains().<br>
@@ -291,9 +289,9 @@ TEST(GSYMTest, TestRanges) {<br>
EXPECT_LT(Range, RangeDifferentEnd);<br>
EXPECT_LT(Range, RangeDifferentStartEnd);<br>
// Test "bool operator<(const AddressRange &, uint64_t)"<br>
- EXPECT_LT(Range, StartAddr + 1);<br>
+ EXPECT_LT(Range.Start, StartAddr + 1);<br>
// Test "bool operator<(uint64_t, const AddressRange &)"<br>
- EXPECT_LT(StartAddr - 1, Range);<br>
+ EXPECT_LT(StartAddr - 1, Range.Start);<br>
<br>
// Verify llvm::gsym::AddressRange::isContiguousWith() and<br>
// llvm::gsym::AddressRange::intersects().<br>
@@ -305,14 +303,6 @@ TEST(GSYMTest, TestRanges) {<br>
const AddressRange StartsAtRangeEnd(EndAddr, EndAddr + 0x100);<br>
const AddressRange StartsAfterRangeEnd(EndAddr + 1, EndAddr + 0x100);<br>
<br>
- EXPECT_FALSE(Range.isContiguousWith(EndsBeforeRangeStart));<br>
- EXPECT_TRUE(Range.isContiguousWith(EndsAtRangeStart));<br>
- EXPECT_TRUE(Range.isContiguousWith(OverlapsRangeStart));<br>
- EXPECT_TRUE(Range.isContiguousWith(InsideRange));<br>
- EXPECT_TRUE(Range.isContiguousWith(OverlapsRangeEnd));<br>
- EXPECT_TRUE(Range.isContiguousWith(StartsAtRangeEnd));<br>
- EXPECT_FALSE(Range.isContiguousWith(StartsAfterRangeEnd));<br>
-<br>
EXPECT_FALSE(Range.intersects(EndsBeforeRangeStart));<br>
EXPECT_FALSE(Range.intersects(EndsAtRangeStart));<br>
EXPECT_TRUE(Range.intersects(OverlapsRangeStart));<br>
@@ -350,12 +340,12 @@ TEST(GSYMTest, TestRanges) {<br>
EXPECT_EQ(Ranges[0], AddressRange(0x1100, 0x1F00));<br>
<br>
// Verify a range that starts before and intersects gets combined.<br>
- Ranges.insert(AddressRange(0x1000, Ranges[0].startAddress() + 1));<br>
+ Ranges.insert(AddressRange(0x1000, Ranges[0].Start + 1));<br>
EXPECT_EQ(Ranges.size(), 1u);<br>
EXPECT_EQ(Ranges[0], AddressRange(0x1000, 0x1F00));<br>
<br>
// Verify a range that starts inside and extends ranges gets combined.<br>
- Ranges.insert(AddressRange(Ranges[0].endAddress() - 1, 0x2000));<br>
+ Ranges.insert(AddressRange(Ranges[0].End - 1, 0x2000));<br>
EXPECT_EQ(Ranges.size(), 1u);<br>
EXPECT_EQ(Ranges[0], AddressRange(0x1000, 0x2000));<br>
<br>
@@ -366,10 +356,15 @@ TEST(GSYMTest, TestRanges) {<br>
EXPECT_EQ(Ranges[1], AddressRange(0x2000, 0x3000));<br>
// Verify if we add an address range that intersects two ranges<br>
// that they get combined<br>
- Ranges.insert(<br>
- AddressRange(Ranges[0].endAddress() - 1, Ranges[1].startAddress() + 1));<br>
+ Ranges.insert(AddressRange(Ranges[0].End - 1, Ranges[1].Start + 1));<br>
EXPECT_EQ(Ranges.size(), 1u);<br>
EXPECT_EQ(Ranges[0], AddressRange(0x1000, 0x3000));<br>
+<br>
+ Ranges.insert(AddressRange(0x3000, 0x4000));<br>
+ Ranges.insert(AddressRange(0x4000, 0x5000));<br>
+ Ranges.insert(AddressRange(0x2000, 0x4500));<br>
+ EXPECT_EQ(Ranges.size(), 1u);<br>
+ EXPECT_EQ(Ranges[0], AddressRange(0x1000, 0x5000));<br>
}<br>
<br>
TEST(GSYMTest, TestStringTable) {<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="https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_llvm-2Dcommits&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=9k7U8PQKHsbaC7-lQKaTb9lbupnubmUuPe6K5-QRsFs&s=xxXTzX5HBWrjAYbiATYKI3lg2yAC_Wqg61ov6xSFL2o&e=" rel="noreferrer" target="_blank">https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_llvm-2Dcommits&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=9k7U8PQKHsbaC7-lQKaTb9lbupnubmUuPe6K5-QRsFs&s=xxXTzX5HBWrjAYbiATYKI3lg2yAC_Wqg61ov6xSFL2o&e=</a> <br>
<br>
<br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail-m_-717497505813350941gmail_signature"><div dir="ltr">宋方睿</div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr">宋方睿</div></div>