Support: Stop stringifying DW_LANG_{lo,hi}_user
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Fri, 6 Feb 2015 22:34:48 +0000 (22:34 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Fri, 6 Feb 2015 22:34:48 +0000 (22:34 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228451 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Support/Dwarf.cpp
unittests/Support/DwarfTest.cpp

index 80dfd1023172a6c8910bd9df81dd97fb31baea46..8367473c7280591340e496deaf9b5a3ef416eb22 100644 (file)
@@ -507,9 +507,7 @@ const char *llvm::dwarf::LanguageString(unsigned Language) {
   case DW_LANG_C_plus_plus_03:           return "DW_LANG_C_plus_plus_03";
   case DW_LANG_C_plus_plus_11:           return "DW_LANG_C_plus_plus_11";
   case DW_LANG_OCaml:                    return "DW_LANG_OCaml";
-  case DW_LANG_lo_user:                  return "DW_LANG_lo_user";
   case DW_LANG_Mips_Assembler:           return "DW_LANG_Mips_Assembler";
-  case DW_LANG_hi_user:                  return "DW_LANG_hi_user";
   }
   return nullptr;
 }
index d016aacedce8b103768f2b15d9bab921c65b6a95..a1438205f73343304d29d434f480ad9a05d1ec41 100644 (file)
@@ -42,4 +42,14 @@ TEST(DwarfTest, getTag) {
   EXPECT_EQ(DW_TAG_invalid, getTag("DW_TAG_user_base"));
 }
 
+TEST(DwarfTest, LanguageStringOnInvalid) {
+  // This is invalid, so it shouldn't be stringified.
+  EXPECT_EQ(nullptr, LanguageString(0));
+
+  // These aren't really tags: they describe ranges within tags.  They
+  // shouldn't be stringified either.
+  EXPECT_EQ(nullptr, LanguageString(DW_LANG_lo_user));
+  EXPECT_EQ(nullptr, LanguageString(DW_LANG_hi_user));
+}
+
 } // end namespace