summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/Support/DwarfTest.cpp
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-02-06 23:46:49 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-02-06 23:46:49 +0000
commite07f13ae35e82e5579d0d9f0dc05fd0321c6bba2 (patch)
tree256213d48956796e26fe843e1791e4555f3d7366 /llvm/unittests/Support/DwarfTest.cpp
parentdd563dd3415d6cf9028d5cf36db273ef86434a8e (diff)
downloadbcm5719-llvm-e07f13ae35e82e5579d0d9f0dc05fd0321c6bba2.tar.gz
bcm5719-llvm-e07f13ae35e82e5579d0d9f0dc05fd0321c6bba2.zip
Support: Add dwarf::getAttributeEncoding()
llvm-svn: 228470
Diffstat (limited to 'llvm/unittests/Support/DwarfTest.cpp')
-rw-r--r--llvm/unittests/Support/DwarfTest.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/llvm/unittests/Support/DwarfTest.cpp b/llvm/unittests/Support/DwarfTest.cpp
index b1a23b31c1c..25f5574ad7b 100644
--- a/llvm/unittests/Support/DwarfTest.cpp
+++ b/llvm/unittests/Support/DwarfTest.cpp
@@ -79,4 +79,20 @@ TEST(DwarfTest, AttributeEncodingStringOnInvalid) {
EXPECT_EQ(nullptr, AttributeEncodingString(DW_ATE_hi_user));
}
+TEST(DwarfTest, getAttributeEncoding) {
+ // A couple of valid languages.
+ EXPECT_EQ(DW_ATE_boolean, getAttributeEncoding("DW_ATE_boolean"));
+ EXPECT_EQ(DW_ATE_imaginary_float,
+ getAttributeEncoding("DW_ATE_imaginary_float"));
+
+ // Invalid languages.
+ EXPECT_EQ(0u, getAttributeEncoding("DW_ATE_invalid"));
+ EXPECT_EQ(0u, getAttributeEncoding("DW_TAG_array_type"));
+ EXPECT_EQ(0u, getAttributeEncoding("something else"));
+
+ // AttributeEncoding range markers should not be recognized.
+ EXPECT_EQ(0u, getAttributeEncoding("DW_ATE_lo_user"));
+ EXPECT_EQ(0u, getAttributeEncoding("DW_ATE_hi_user"));
+}
+
} // end namespace
OpenPOWER on IntegriCloud