summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/Support/DwarfTest.cpp
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-02-07 00:36:23 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-02-07 00:36:23 +0000
commitd6f357421098c8c1a3433d422e87f5b35aeeca29 (patch)
tree3c1454fa7656d93baff8ebbecb396c7a9f50f991 /llvm/unittests/Support/DwarfTest.cpp
parentdc494d5303e01c36237de42ec09077b03b58fa88 (diff)
downloadbcm5719-llvm-d6f357421098c8c1a3433d422e87f5b35aeeca29.tar.gz
bcm5719-llvm-d6f357421098c8c1a3433d422e87f5b35aeeca29.zip
Support: Use Dwarf.def for DW_VIRTUALITY, NFC
Use definition file for `DW_VIRTUALITY_*`. Add a `DW_VIRTUALITY_max` both for ease of testing and for future use by the `LLParser`. llvm-svn: 228473
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 25f5574ad7b..38a179f7929 100644
--- a/llvm/unittests/Support/DwarfTest.cpp
+++ b/llvm/unittests/Support/DwarfTest.cpp
@@ -95,4 +95,18 @@ TEST(DwarfTest, getAttributeEncoding) {
EXPECT_EQ(0u, getAttributeEncoding("DW_ATE_hi_user"));
}
+TEST(DwarfTest, VirtualityString) {
+ EXPECT_EQ("DW_VIRTUALITY_none", VirtualityString(DW_VIRTUALITY_none));
+ EXPECT_EQ("DW_VIRTUALITY_virtual", VirtualityString(DW_VIRTUALITY_virtual));
+ EXPECT_EQ("DW_VIRTUALITY_pure_virtual",
+ VirtualityString(DW_VIRTUALITY_pure_virtual));
+
+ // DW_VIRTUALITY_max should be pure virtual.
+ EXPECT_EQ("DW_VIRTUALITY_pure_virtual", VirtualityString(DW_VIRTUALITY_max));
+
+ // Invalid numbers shouldn't be stringified.
+ EXPECT_EQ(nullptr, VirtualityString(DW_VIRTUALITY_max + 1));
+ EXPECT_EQ(nullptr, VirtualityString(DW_VIRTUALITY_max + 77));
+}
+
} // end namespace
OpenPOWER on IntegriCloud