diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-02-06 22:55:13 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-02-06 22:55:13 +0000 |
commit | d40af00e66b8b15960614d423681953ea7a41eb2 (patch) | |
tree | 57e52d848fdf2b191700e0ce81dea0b890302a20 /llvm/unittests/Support/DwarfTest.cpp | |
parent | 0317944b1a6dc9aa06acc66e8849ea63df8f3da1 (diff) | |
download | bcm5719-llvm-d40af00e66b8b15960614d423681953ea7a41eb2.tar.gz bcm5719-llvm-d40af00e66b8b15960614d423681953ea7a41eb2.zip |
Support: Add dwarf::getLanguage()
llvm-svn: 228458
Diffstat (limited to 'llvm/unittests/Support/DwarfTest.cpp')
-rw-r--r-- | llvm/unittests/Support/DwarfTest.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/llvm/unittests/Support/DwarfTest.cpp b/llvm/unittests/Support/DwarfTest.cpp index a1438205f73..2dccfe7ad3c 100644 --- a/llvm/unittests/Support/DwarfTest.cpp +++ b/llvm/unittests/Support/DwarfTest.cpp @@ -52,4 +52,21 @@ TEST(DwarfTest, LanguageStringOnInvalid) { EXPECT_EQ(nullptr, LanguageString(DW_LANG_hi_user)); } +TEST(DwarfTest, getLanguage) { + // A couple of valid languages. + EXPECT_EQ(DW_LANG_C89, getLanguage("DW_LANG_C89")); + EXPECT_EQ(DW_LANG_C_plus_plus_11, getLanguage("DW_LANG_C_plus_plus_11")); + EXPECT_EQ(DW_LANG_OCaml, getLanguage("DW_LANG_OCaml")); + EXPECT_EQ(DW_LANG_Mips_Assembler, getLanguage("DW_LANG_Mips_Assembler")); + + // Invalid languages. + EXPECT_EQ(0u, getLanguage("DW_LANG_invalid")); + EXPECT_EQ(0u, getLanguage("DW_TAG_array_type")); + EXPECT_EQ(0u, getLanguage("something else")); + + // Language range markers should not be recognized. + EXPECT_EQ(0u, getLanguage("DW_LANG_lo_user")); + EXPECT_EQ(0u, getLanguage("DW_LANG_hi_user")); +} + } // end namespace |