Support: Stop stringifying DW_TAG_{lo,hi}_user
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Tue, 3 Feb 2015 21:08:33 +0000 (21:08 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Tue, 3 Feb 2015 21:08:33 +0000 (21:08 +0000)
`dwarf::TagString()` shouldn't stringify `DW_TAG_lo_user` or
`DW_TAG_hi_user`.  These aren't actual tags; they're markers for the
edge of vendor-specific tag regions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228029 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Support/Dwarf.cpp
unittests/Support/CMakeLists.txt
unittests/Support/DwarfTest.cpp [new file with mode: 0644]

index 4b6337ecc52cefcfac4b1155b38caa243331cfb2..2101037e71430b5b55a1296792442fffe1071876 100644 (file)
@@ -76,8 +76,6 @@ const char *llvm::dwarf::TagString(unsigned Tag) {
   case DW_TAG_imported_unit:             return "DW_TAG_imported_unit";
   case DW_TAG_condition:                 return "DW_TAG_condition";
   case DW_TAG_shared_type:               return "DW_TAG_shared_type";
-  case DW_TAG_lo_user:                   return "DW_TAG_lo_user";
-  case DW_TAG_hi_user:                   return "DW_TAG_hi_user";
   case DW_TAG_auto_variable:             return "DW_TAG_auto_variable";
   case DW_TAG_arg_variable:              return "DW_TAG_arg_variable";
   case DW_TAG_expression:                return "DW_TAG_expression";
index dd270ccea42de297b1fc515aaeb8209ade11d5a9..214972ef8a91c08459b6230438a621d8d385817f 100644 (file)
@@ -13,6 +13,7 @@ add_llvm_unittest(SupportTests
   CompressionTest.cpp
   ConvertUTFTest.cpp
   DataExtractorTest.cpp
+  DwarfTest.cpp
   EndianTest.cpp
   ErrorOrTest.cpp
   FileOutputBufferTest.cpp
diff --git a/unittests/Support/DwarfTest.cpp b/unittests/Support/DwarfTest.cpp
new file mode 100644 (file)
index 0000000..9b14160
--- /dev/null
@@ -0,0 +1,29 @@
+//===- unittest/Support/DwarfTest.cpp - Dwarf support tests ---------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/Support/Dwarf.h"
+#include "gtest/gtest.h"
+
+using namespace llvm;
+using namespace llvm::dwarf;
+
+namespace {
+
+TEST(DwarfTest, TagStringOnInvalid) {
+  // This is invalid, so it shouldn't be stringified.
+  EXPECT_EQ(nullptr, TagString(DW_TAG_invalid));
+
+  // These aren't really tags: they describe ranges within tags.  They
+  // shouldn't be stringified either.
+  EXPECT_EQ(nullptr, TagString(DW_TAG_lo_user));
+  EXPECT_EQ(nullptr, TagString(DW_TAG_hi_user));
+  EXPECT_EQ(nullptr, TagString(DW_TAG_user_base));
+}
+
+} // end namespace