summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/DebugInfo/DWARF
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2018-07-11 17:11:11 +0000
committerJonas Devlieghere <jonas@devlieghere.com>2018-07-11 17:11:11 +0000
commit3f27e57adeb5fc262e07c191eca07f28977a1f3b (patch)
treea616409148b8aeb7e6643f7536b0a6844071ebd0 /llvm/unittests/DebugInfo/DWARF
parent14eeb5a5c0fd8c79a71aed6ce240a32cd8f18e85 (diff)
downloadbcm5719-llvm-3f27e57adeb5fc262e07c191eca07f28977a1f3b.tar.gz
bcm5719-llvm-3f27e57adeb5fc262e07c191eca07f28977a1f3b.zip
[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 llvm-svn: 336823
Diffstat (limited to 'llvm/unittests/DebugInfo/DWARF')
-rw-r--r--llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp b/llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
index 02af290a123..6b26318802a 100644
--- a/llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
+++ b/llvm/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) {
OpenPOWER on IntegriCloud