summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/Support/DwarfTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/unittests/Support/DwarfTest.cpp')
-rw-r--r--llvm/unittests/Support/DwarfTest.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/unittests/Support/DwarfTest.cpp b/llvm/unittests/Support/DwarfTest.cpp
index 5352982aa13..74fcc989b45 100644
--- a/llvm/unittests/Support/DwarfTest.cpp
+++ b/llvm/unittests/Support/DwarfTest.cpp
@@ -42,6 +42,20 @@ TEST(DwarfTest, getTag) {
EXPECT_EQ(DW_TAG_invalid, getTag("DW_TAG_user_base"));
}
+TEST(DwarfTest, getOperationEncoding) {
+ // Some valid ops.
+ EXPECT_EQ(DW_OP_deref, getOperationEncoding("DW_OP_deref"));
+ EXPECT_EQ(DW_OP_bit_piece, getOperationEncoding("DW_OP_bit_piece"));
+
+ // Invalid ops.
+ EXPECT_EQ(0u, getOperationEncoding("DW_OP_otherthings"));
+ EXPECT_EQ(0u, getOperationEncoding("other"));
+
+ // Markers shouldn't be recognized.
+ EXPECT_EQ(0u, getOperationEncoding("DW_OP_lo_user"));
+ EXPECT_EQ(0u, getOperationEncoding("DW_OP_hi_user"));
+}
+
TEST(DwarfTest, LanguageStringOnInvalid) {
// This is invalid, so it shouldn't be stringified.
EXPECT_EQ(nullptr, LanguageString(0));
OpenPOWER on IntegriCloud