[llvm] r228451 - Support: Stop stringifying DW_LANG_{lo,hi}_user

Duncan P. N. Exon Smith dexonsmith at apple.com
Fri Feb 6 14:34:48 PST 2015


Author: dexonsmith
Date: Fri Feb  6 16:34:48 2015
New Revision: 228451

URL: http://llvm.org/viewvc/llvm-project?rev=228451&view=rev
Log:
Support: Stop stringifying DW_LANG_{lo,hi}_user

Modified:
    llvm/trunk/lib/Support/Dwarf.cpp
    llvm/trunk/unittests/Support/DwarfTest.cpp

Modified: llvm/trunk/lib/Support/Dwarf.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Dwarf.cpp?rev=228451&r1=228450&r2=228451&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Dwarf.cpp (original)
+++ llvm/trunk/lib/Support/Dwarf.cpp Fri Feb  6 16:34:48 2015
@@ -507,9 +507,7 @@ const char *llvm::dwarf::LanguageString(
   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;
 }

Modified: llvm/trunk/unittests/Support/DwarfTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/DwarfTest.cpp?rev=228451&r1=228450&r2=228451&view=diff
==============================================================================
--- llvm/trunk/unittests/Support/DwarfTest.cpp (original)
+++ llvm/trunk/unittests/Support/DwarfTest.cpp Fri Feb  6 16:34:48 2015
@@ -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





More information about the llvm-commits mailing list