diff options
author | Jonas Devlieghere <jonas@devlieghere.com> | 2018-07-11 17:11:11 +0000 |
---|---|---|
committer | Jonas Devlieghere <jonas@devlieghere.com> | 2018-07-11 17:11:11 +0000 |
commit | f8497881d6aa3d753c18d65381d372c80e727c18 (patch) | |
tree | 142f9f9ea09e964f201b1ce8681bab908e8d07a9 /unittests | |
parent | 67a7a09e83be868130f048d695c3df75ce18c6ee (diff) |
[DebugInfo] Make children iterator bidirectional
Make the DIE iterator bidirectional so we can move to the previous
sibling of a DIE.
Differential revision: https://reviews.llvm.org/D49173
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336823 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r-- | unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp b/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp index 02af290a123..6b26318802a 100644 --- a/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp +++ b/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp @@ -490,6 +490,11 @@ template <uint16_t Version, class AddrType> void TestChildren() { EXPECT_TRUE(!NullDieDG.getSibling().isValid()); EXPECT_TRUE(!NullDieDG.getFirstChild().isValid()); } + + // Verify the previous sibling of our subprogram is our integer base type. + IntDieDG = NullDieDG.getPreviousSibling(); + EXPECT_TRUE(IntDieDG.isValid()); + EXPECT_EQ(IntDieDG.getTag(), DW_TAG_base_type); } TEST(DWARFDebugInfo, TestDWARF32Version2Addr4Children) { @@ -1072,6 +1077,27 @@ TEST(DWARFDebugInfo, TestRelations) { // Make sure the parent of all the children of the B are the B. EXPECT_EQ(C1.getParent(), C); EXPECT_EQ(C2.getParent(), C); + + // Make sure bidirectional iterator works as expected. + auto Begin = A.begin(); + auto End = A.end(); + auto It = A.begin(); + + EXPECT_EQ(It, Begin); + EXPECT_EQ(*It, B); + ++It; + EXPECT_EQ(*It, C); + ++It; + EXPECT_EQ(*It, D); + ++It; + EXPECT_EQ(It, End); + --It; + EXPECT_EQ(*It, D); + --It; + EXPECT_EQ(*It, C); + --It; + EXPECT_EQ(*It, B); + EXPECT_EQ(It, Begin); } TEST(DWARFDebugInfo, TestDWARFDie) { |