[llvm] r364637 - [DebugInfo] Simplify GSYM::AddressRange and GSYM::AddressRanges
Fāng-ruì Sòng via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 28 19:53:18 PDT 2019
> Could you please revert this and put the change up for review instead?
Many issues in D63104 were unaddressed when it was committed. I think
D63104 should also be reverted if my r364634 and r364637 are to be reverted.
On Sat, Jun 29, 2019 at 10:49 AM Fāng-ruì Sòng <maskray at google.com> wrote:
> I mean the original change D63104. There were many issues unaddressed when
> committed.
>
> On Sat, Jun 29, 2019 at 10:48 AM Fāng-ruì Sòng <maskray at google.com> wrote:
>
>> Sorry but I think that change was not properly accepted when committed :)
>>
>> On Sat, Jun 29, 2019 at 2:28 AM Shoaib Meenai <smeenai at fb.com> wrote:
>>
>>> Hi,
>>>
>>> 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.
>>>
>>> Could you please revert this and put the change up for review instead?
>>>
>>> Thanks,
>>> Shoaib
>>>
>>> On 6/28/19, 3:06 AM, "llvm-commits on behalf of Fangrui Song via
>>> llvm-commits" <llvm-commits-bounces at lists.llvm.org on behalf of
>>> llvm-commits at lists.llvm.org> wrote:
>>>
>>> Author: maskray
>>> Date: Fri Jun 28 03:06:11 2019
>>> New Revision: 364637
>>>
>>> URL:
>>> 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=
>>> Log:
>>> [DebugInfo] Simplify GSYM::AddressRange and GSYM::AddressRanges
>>>
>>> Delete unnecessary getters of AddressRange.
>>> Simplify AddressRange::size(): Start <= End check should be checked
>>> in an upper layer.
>>> Delete isContiguousWith() that doesn't make sense.
>>> Simplify AddressRanges::insert. Delete commented code. Fix it when
>>> more than 1 ranges are to be deleted.
>>> Delete trailing newline.
>>>
>>> Modified:
>>> llvm/trunk/include/llvm/DebugInfo/GSYM/FunctionInfo.h
>>> llvm/trunk/include/llvm/DebugInfo/GSYM/Range.h
>>> llvm/trunk/lib/DebugInfo/GSYM/FunctionInfo.cpp
>>> llvm/trunk/lib/DebugInfo/GSYM/InlineInfo.cpp
>>> llvm/trunk/lib/DebugInfo/GSYM/Range.cpp
>>> llvm/trunk/unittests/DebugInfo/GSYM/GSYMTest.cpp
>>>
>>> Modified: llvm/trunk/include/llvm/DebugInfo/GSYM/FunctionInfo.h
>>> URL:
>>> 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=
>>>
>>> ==============================================================================
>>> --- llvm/trunk/include/llvm/DebugInfo/GSYM/FunctionInfo.h (original)
>>> +++ llvm/trunk/include/llvm/DebugInfo/GSYM/FunctionInfo.h Fri Jun 28
>>> 03:06:11 2019
>>> @@ -56,15 +56,15 @@ struct FunctionInfo {
>>> return Name != 0;
>>> }
>>>
>>> - uint64_t startAddress() const { return Range.startAddress(); }
>>> - uint64_t endAddress() const { return Range.endAddress(); }
>>> + uint64_t startAddress() const { return Range.Start; }
>>> + uint64_t endAddress() const { return Range.End; }
>>> uint64_t size() const { return Range.size(); }
>>> - void setStartAddress(uint64_t Addr) {
>>> Range.setStartAddress(Addr); }
>>> - void setEndAddress(uint64_t Addr) { Range.setEndAddress(Addr); }
>>> - void setSize(uint64_t Size) { Range.setSize(Size); }
>>> + void setStartAddress(uint64_t Addr) { Range.End = Addr; }
>>> + void setEndAddress(uint64_t Addr) { Range.End = Addr; }
>>> + void setSize(uint64_t Size) { Range.End = Range.Start + Size; }
>>>
>>> void clear() {
>>> - Range.clear();
>>> + Range = {0, 0};
>>> Name = 0;
>>> Lines.clear();
>>> Inline.clear();
>>>
>>> Modified: llvm/trunk/include/llvm/DebugInfo/GSYM/Range.h
>>> URL:
>>> 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=
>>>
>>> ==============================================================================
>>> --- llvm/trunk/include/llvm/DebugInfo/GSYM/Range.h (original)
>>> +++ llvm/trunk/include/llvm/DebugInfo/GSYM/Range.h Fri Jun 28
>>> 03:06:11 2019
>>> @@ -27,58 +27,28 @@ namespace gsym {
>>>
>>> /// A class that represents an address range. The range is
>>> specified using
>>> /// a start and an end address.
>>> -class AddressRange {
>>> +struct AddressRange {
>>> uint64_t Start;
>>> uint64_t End;
>>> -public:
>>> - AddressRange(uint64_t S = 0, uint64_t E = 0) : Start(S), End(E) {}
>>> - /// Access to the size must use the size() accessor to ensure the
>>> correct
>>> - /// answer. This allows an AddressRange to be constructed with
>>> invalid
>>> - /// address ranges where the end address is less that the start
>>> address
>>> - /// either because it was not set, or because of incorrect data.
>>> - uint64_t size() const { return Start < End ? End - Start : 0; }
>>> - void setStartAddress(uint64_t Addr) { Start = Addr; }
>>> - void setEndAddress(uint64_t Addr) { End = Addr; }
>>> - void setSize(uint64_t Size) { End = Start + Size; }
>>> - uint64_t startAddress() const { return Start; }
>>> - /// Access to the end address must use the size() accessor to
>>> ensure the
>>> - /// correct answer. This allows an AddressRange to be constructed
>>> with
>>> - /// invalid address ranges where the end address is less that the
>>> start
>>> - /// address either because it was not set, or because of
>>> incorrect data.
>>> - uint64_t endAddress() const { return Start + size(); }
>>> - void clear() {
>>> - Start = 0;
>>> - End = 0;
>>> + AddressRange() : Start(0), End(0) {}
>>> + AddressRange(uint64_t S, uint64_t E) : Start(S), End(E) {}
>>> + uint64_t size() const { return End - Start; }
>>> + bool contains(uint64_t Addr) const { return Start <= Addr && Addr
>>> < End; }
>>> + bool intersects(const AddressRange &R) const {
>>> + return Start < R.End && R.Start < End;
>>> }
>>> - bool contains(uint64_t Addr) const { return Start <= Addr && Addr
>>> < endAddress(); }
>>> - bool isContiguousWith(const AddressRange &R) const {
>>> - return (Start <= R.endAddress()) && (endAddress() >= R.Start);
>>> +
>>> + bool operator==(const AddressRange &R) const {
>>> + return Start == R.Start && End == R.End;
>>> }
>>> - bool intersects(const AddressRange &R) const {
>>> - return (Start < R.endAddress()) && (endAddress() > R.Start);
>>> + bool operator!=(const AddressRange &R) const {
>>> + return !(*this == R);
>>> }
>>> - bool intersect(const AddressRange &R) {
>>> - if (intersects(R)) {
>>> - Start = std::min<uint64_t>(Start, R.Start);
>>> - End = std::max<uint64_t>(endAddress(), R.endAddress());
>>> - return true;
>>> - }
>>> - return false;
>>> + bool operator<(const AddressRange &R) const {
>>> + return std::make_pair(Start, End) < std::make_pair(R.Start,
>>> R.End);
>>> }
>>> };
>>>
>>> -inline bool operator==(const AddressRange &LHS, const AddressRange
>>> &RHS) {
>>> - return LHS.startAddress() == RHS.startAddress() &&
>>> LHS.endAddress() == RHS.endAddress();
>>> -}
>>> -inline bool operator!=(const AddressRange &LHS, const AddressRange
>>> &RHS) {
>>> - return LHS.startAddress() != RHS.startAddress() ||
>>> LHS.endAddress() != RHS.endAddress();
>>> -}
>>> -inline bool operator<(const AddressRange &LHS, const AddressRange
>>> &RHS) {
>>> - if (LHS.startAddress() == RHS.startAddress())
>>> - return LHS.endAddress() < RHS.endAddress();
>>> - return LHS.startAddress() < RHS.startAddress();
>>> -}
>>> -
>>> raw_ostream &operator<<(raw_ostream &OS, const AddressRange &R);
>>>
>>> /// The AddressRanges class helps normalize address range
>>> collections.
>>> @@ -96,7 +66,7 @@ public:
>>> void clear() { Ranges.clear(); }
>>> bool empty() const { return Ranges.empty(); }
>>> bool contains(uint64_t Addr) const;
>>> - void insert(const AddressRange &R);
>>> + void insert(AddressRange Range);
>>> size_t size() const { return Ranges.size(); }
>>> bool operator==(const AddressRanges &RHS) const {
>>> return Ranges == RHS.Ranges;
>>>
>>> Modified: llvm/trunk/lib/DebugInfo/GSYM/FunctionInfo.cpp
>>> URL:
>>> 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=
>>>
>>> ==============================================================================
>>> --- llvm/trunk/lib/DebugInfo/GSYM/FunctionInfo.cpp (original)
>>> +++ llvm/trunk/lib/DebugInfo/GSYM/FunctionInfo.cpp Fri Jun 28
>>> 03:06:11 2019
>>> @@ -13,8 +13,7 @@ using namespace llvm;
>>> using namespace gsym;
>>>
>>> raw_ostream &llvm::gsym::operator<<(raw_ostream &OS, const
>>> FunctionInfo &FI) {
>>> - OS << '[' << HEX64(FI.Range.startAddress()) << '-'
>>> - << HEX64(FI.Range.endAddress()) << "): "
>>> + OS << '[' << HEX64(FI.Range.Start) << '-' << HEX64(FI.Range.End)
>>> << "): "
>>> << "Name=" << HEX32(FI.Name) << '\n';
>>> for (const auto &Line : FI.Lines)
>>> OS << Line << '\n';
>>>
>>> Modified: llvm/trunk/lib/DebugInfo/GSYM/InlineInfo.cpp
>>> URL:
>>> 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=
>>>
>>> ==============================================================================
>>> --- llvm/trunk/lib/DebugInfo/GSYM/InlineInfo.cpp (original)
>>> +++ llvm/trunk/lib/DebugInfo/GSYM/InlineInfo.cpp Fri Jun 28 03:06:11
>>> 2019
>>> @@ -34,7 +34,7 @@ raw_ostream &llvm::gsym::operator<<(raw_
>>> return OS;
>>> }
>>>
>>> -static bool getInlineStackHelper(const InlineInfo &II, uint64_t
>>> Addr,
>>> +static bool getInlineStackHelper(const InlineInfo &II, uint64_t
>>> Addr,
>>> std::vector<const InlineInfo *> &InlineStack) {
>>> if (II.Ranges.contains(Addr)) {
>>> // If this is the top level that represents the concrete
>>> function,
>>>
>>> Modified: llvm/trunk/lib/DebugInfo/GSYM/Range.cpp
>>> URL:
>>> 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=
>>>
>>> ==============================================================================
>>> --- llvm/trunk/lib/DebugInfo/GSYM/Range.cpp (original)
>>> +++ llvm/trunk/lib/DebugInfo/GSYM/Range.cpp Fri Jun 28 03:06:11 2019
>>> @@ -15,53 +15,41 @@ using namespace llvm;
>>> using namespace gsym;
>>>
>>>
>>> -void AddressRanges::insert(const AddressRange &Range) {
>>> +void AddressRanges::insert(AddressRange Range) {
>>> if (Range.size() == 0)
>>> return;
>>> - // Ranges.insert(std::upper_bound(Ranges.begin(), Ranges.end(),
>>> Range), Range);
>>>
>>> - // // Check if an existing range intersects with this range, and
>>> if so,
>>> - // // grow the intersecting ranges instead of adding a new one.
>>> - auto Begin = Ranges.begin();
>>> - auto End = Ranges.end();
>>> - const auto Iter = std::upper_bound(Begin, End, Range);
>>> - if (Iter != Begin) {
>>> - auto PrevIter = Iter - 1;
>>> - // If the previous range itersects with "Range" they will be
>>> combined.
>>> - if (PrevIter->intersect(Range)) {
>>> - // Now check if the previous range intersects with the next
>>> range since
>>> - // the previous range was combined. If so, combine them and
>>> remove the
>>> - // next range.
>>> - if (Iter != End && PrevIter->intersect(*Iter))
>>> - Ranges.erase(Iter);
>>> - return;
>>> - }
>>> + auto It = llvm::upper_bound(Ranges, Range);
>>> + auto It2 = It;
>>> + while (It2 != Ranges.end() && It2->Start < Range.End)
>>> + ++It2;
>>> + if (It != It2) {
>>> + Range.End = std::max(Range.End, It2[-1].End);
>>> + It = Ranges.erase(It, It2);
>>> }
>>> - // If the next range intersects with "Range", combined and return.
>>> - if (Iter != End && Iter->intersect(Range))
>>> - return;
>>> - Ranges.insert(Iter, Range);
>>> + if (It != Ranges.begin() && Range.Start < It[-1].End)
>>> + It[-1].End = std::max(It[-1].End, Range.End);
>>> + else
>>> + Ranges.insert(It, Range);
>>> }
>>>
>>> bool AddressRanges::contains(uint64_t Addr) const {
>>> auto It = std::partition_point(
>>> Ranges.begin(), Ranges.end(),
>>> - [=](const AddressRange &R) { return R.startAddress() <= Addr;
>>> });
>>> - return It != Ranges.begin() && It[-1].contains(Addr);
>>> + [=](const AddressRange &R) { return R.Start <= Addr; });
>>> + return It != Ranges.begin() && Addr < It[-1].End;
>>> }
>>>
>>> raw_ostream &llvm::gsym::operator<<(raw_ostream &OS, const
>>> AddressRange &R) {
>>> - return OS << '[' << HEX64(R.startAddress()) << " - " <<
>>> HEX64(R.endAddress())
>>> - << ")";
>>> + return OS << '[' << HEX64(R.Start) << " - " << HEX64(R.End) <<
>>> ")";
>>> }
>>>
>>> raw_ostream &llvm::gsym::operator<<(raw_ostream &OS, const
>>> AddressRanges &AR) {
>>> size_t Size = AR.size();
>>> - for (size_t I=0; I<Size; ++I) {
>>> + for (size_t I = 0; I < Size; ++I) {
>>> if (I)
>>> OS << ' ';
>>> OS << AR[I];
>>> }
>>> return OS;
>>> }
>>> -
>>>
>>> Modified: llvm/trunk/unittests/DebugInfo/GSYM/GSYMTest.cpp
>>> URL:
>>> 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=
>>>
>>> ==============================================================================
>>> --- llvm/trunk/unittests/DebugInfo/GSYM/GSYMTest.cpp (original)
>>> +++ llvm/trunk/unittests/DebugInfo/GSYM/GSYMTest.cpp Fri Jun 28
>>> 03:06:11 2019
>>> @@ -179,33 +179,33 @@ TEST(GSYMTest, TestInlineInfo) {
>>> EXPECT_FALSE(Root.getInlineStack(0x50));
>>>
>>> // Verify that we get no inline stacks for addresses out of
>>> [0x100-0x200)
>>> - EXPECT_FALSE(Root.getInlineStack(Root.Ranges[0].startAddress() -
>>> 1));
>>> - EXPECT_FALSE(Root.getInlineStack(Root.Ranges[0].endAddress()));
>>> + EXPECT_FALSE(Root.getInlineStack(Root.Ranges[0].Start - 1));
>>> + EXPECT_FALSE(Root.getInlineStack(Root.Ranges[0].End));
>>>
>>> // Verify we get no inline stack entries for addresses that are in
>>> // [0x100-0x200) but not in [0x150-0x160)
>>> - EXPECT_FALSE(Root.getInlineStack(Inline1.Ranges[0].startAddress()
>>> - 1));
>>> - EXPECT_FALSE(Root.getInlineStack(Inline1.Ranges[0].endAddress()));
>>> + EXPECT_FALSE(Root.getInlineStack(Inline1.Ranges[0].Start - 1));
>>> + EXPECT_FALSE(Root.getInlineStack(Inline1.Ranges[0].End));
>>>
>>> // Verify we get one inline stack entry for addresses that are in
>>> // [[0x150-0x160)) but not in [0x152-0x155) or [0x157-0x158)
>>> - auto InlineInfos =
>>> Root.getInlineStack(Inline1.Ranges[0].startAddress());
>>> + auto InlineInfos = Root.getInlineStack(Inline1.Ranges[0].Start);
>>> ASSERT_TRUE(InlineInfos);
>>> ASSERT_EQ(InlineInfos->size(), 1u);
>>> ASSERT_EQ(*InlineInfos->at(0), Inline1);
>>> - InlineInfos = Root.getInlineStack(Inline1.Ranges[0].endAddress()
>>> - 1);
>>> + InlineInfos = Root.getInlineStack(Inline1.Ranges[0].End - 1);
>>> EXPECT_TRUE(InlineInfos);
>>> ASSERT_EQ(InlineInfos->size(), 1u);
>>> ASSERT_EQ(*InlineInfos->at(0), Inline1);
>>>
>>> // Verify we get two inline stack entries for addresses that are
>>> in
>>> // [0x152-0x155)
>>> - InlineInfos =
>>> Root.getInlineStack(Inline1Sub1.Ranges[0].startAddress());
>>> + InlineInfos = Root.getInlineStack(Inline1Sub1.Ranges[0].Start);
>>> EXPECT_TRUE(InlineInfos);
>>> ASSERT_EQ(InlineInfos->size(), 2u);
>>> ASSERT_EQ(*InlineInfos->at(0), Inline1Sub1);
>>> ASSERT_EQ(*InlineInfos->at(1), Inline1);
>>> - InlineInfos =
>>> Root.getInlineStack(Inline1Sub1.Ranges[0].endAddress() - 1);
>>> + InlineInfos = Root.getInlineStack(Inline1Sub1.Ranges[0].End - 1);
>>> EXPECT_TRUE(InlineInfos);
>>> ASSERT_EQ(InlineInfos->size(), 2u);
>>> ASSERT_EQ(*InlineInfos->at(0), Inline1Sub1);
>>> @@ -213,12 +213,12 @@ TEST(GSYMTest, TestInlineInfo) {
>>>
>>> // Verify we get two inline stack entries for addresses that are
>>> in
>>> // [0x157-0x158)
>>> - InlineInfos =
>>> Root.getInlineStack(Inline1Sub2.Ranges[0].startAddress());
>>> + InlineInfos = Root.getInlineStack(Inline1Sub2.Ranges[0].Start);
>>> EXPECT_TRUE(InlineInfos);
>>> ASSERT_EQ(InlineInfos->size(), 2u);
>>> ASSERT_EQ(*InlineInfos->at(0), Inline1Sub2);
>>> ASSERT_EQ(*InlineInfos->at(1), Inline1);
>>> - InlineInfos =
>>> Root.getInlineStack(Inline1Sub2.Ranges[0].endAddress() - 1);
>>> + InlineInfos = Root.getInlineStack(Inline1Sub2.Ranges[0].End - 1);
>>> EXPECT_TRUE(InlineInfos);
>>> ASSERT_EQ(InlineInfos->size(), 2u);
>>> ASSERT_EQ(*InlineInfos->at(0), Inline1Sub2);
>>> @@ -257,8 +257,6 @@ TEST(GSYMTest, TestRanges) {
>>> const uint64_t EndAddr = 0x2000;
>>> // Verify constructor and API to ensure it takes start and end
>>> address.
>>> const AddressRange Range(StartAddr, EndAddr);
>>> - EXPECT_EQ(Range.startAddress(), StartAddr);
>>> - EXPECT_EQ(Range.endAddress(), EndAddr);
>>> EXPECT_EQ(Range.size(), EndAddr - StartAddr);
>>>
>>> // Verify llvm::gsym::AddressRange::contains().
>>> @@ -291,9 +289,9 @@ TEST(GSYMTest, TestRanges) {
>>> EXPECT_LT(Range, RangeDifferentEnd);
>>> EXPECT_LT(Range, RangeDifferentStartEnd);
>>> // Test "bool operator<(const AddressRange &, uint64_t)"
>>> - EXPECT_LT(Range, StartAddr + 1);
>>> + EXPECT_LT(Range.Start, StartAddr + 1);
>>> // Test "bool operator<(uint64_t, const AddressRange &)"
>>> - EXPECT_LT(StartAddr - 1, Range);
>>> + EXPECT_LT(StartAddr - 1, Range.Start);
>>>
>>> // Verify llvm::gsym::AddressRange::isContiguousWith() and
>>> // llvm::gsym::AddressRange::intersects().
>>> @@ -305,14 +303,6 @@ TEST(GSYMTest, TestRanges) {
>>> const AddressRange StartsAtRangeEnd(EndAddr, EndAddr + 0x100);
>>> const AddressRange StartsAfterRangeEnd(EndAddr + 1, EndAddr +
>>> 0x100);
>>>
>>> - EXPECT_FALSE(Range.isContiguousWith(EndsBeforeRangeStart));
>>> - EXPECT_TRUE(Range.isContiguousWith(EndsAtRangeStart));
>>> - EXPECT_TRUE(Range.isContiguousWith(OverlapsRangeStart));
>>> - EXPECT_TRUE(Range.isContiguousWith(InsideRange));
>>> - EXPECT_TRUE(Range.isContiguousWith(OverlapsRangeEnd));
>>> - EXPECT_TRUE(Range.isContiguousWith(StartsAtRangeEnd));
>>> - EXPECT_FALSE(Range.isContiguousWith(StartsAfterRangeEnd));
>>> -
>>> EXPECT_FALSE(Range.intersects(EndsBeforeRangeStart));
>>> EXPECT_FALSE(Range.intersects(EndsAtRangeStart));
>>> EXPECT_TRUE(Range.intersects(OverlapsRangeStart));
>>> @@ -350,12 +340,12 @@ TEST(GSYMTest, TestRanges) {
>>> EXPECT_EQ(Ranges[0], AddressRange(0x1100, 0x1F00));
>>>
>>> // Verify a range that starts before and intersects gets combined.
>>> - Ranges.insert(AddressRange(0x1000, Ranges[0].startAddress() + 1));
>>> + Ranges.insert(AddressRange(0x1000, Ranges[0].Start + 1));
>>> EXPECT_EQ(Ranges.size(), 1u);
>>> EXPECT_EQ(Ranges[0], AddressRange(0x1000, 0x1F00));
>>>
>>> // Verify a range that starts inside and extends ranges gets
>>> combined.
>>> - Ranges.insert(AddressRange(Ranges[0].endAddress() - 1, 0x2000));
>>> + Ranges.insert(AddressRange(Ranges[0].End - 1, 0x2000));
>>> EXPECT_EQ(Ranges.size(), 1u);
>>> EXPECT_EQ(Ranges[0], AddressRange(0x1000, 0x2000));
>>>
>>> @@ -366,10 +356,15 @@ TEST(GSYMTest, TestRanges) {
>>> EXPECT_EQ(Ranges[1], AddressRange(0x2000, 0x3000));
>>> // Verify if we add an address range that intersects two ranges
>>> // that they get combined
>>> - Ranges.insert(
>>> - AddressRange(Ranges[0].endAddress() - 1,
>>> Ranges[1].startAddress() + 1));
>>> + Ranges.insert(AddressRange(Ranges[0].End - 1, Ranges[1].Start +
>>> 1));
>>> EXPECT_EQ(Ranges.size(), 1u);
>>> EXPECT_EQ(Ranges[0], AddressRange(0x1000, 0x3000));
>>> +
>>> + Ranges.insert(AddressRange(0x3000, 0x4000));
>>> + Ranges.insert(AddressRange(0x4000, 0x5000));
>>> + Ranges.insert(AddressRange(0x2000, 0x4500));
>>> + EXPECT_EQ(Ranges.size(), 1u);
>>> + EXPECT_EQ(Ranges[0], AddressRange(0x1000, 0x5000));
>>> }
>>>
>>> TEST(GSYMTest, TestStringTable) {
>>>
>>>
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at lists.llvm.org
>>>
>>> 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=
>>>
>>>
>>>
>>
>> --
>> 宋方睿
>>
>
>
> --
> 宋方睿
>
--
宋方睿
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190629/3e728f45/attachment.html>
More information about the llvm-commits
mailing list