[llvm] r228029 - Support: Stop stringifying DW_TAG_{lo,hi}_user

Duncan P. N. Exon Smith dexonsmith at apple.com
Tue Feb 3 13:08:33 PST 2015


Author: dexonsmith
Date: Tue Feb  3 15:08:33 2015
New Revision: 228029

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

`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.

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

Modified: llvm/trunk/lib/Support/Dwarf.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Dwarf.cpp?rev=228029&r1=228028&r2=228029&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Dwarf.cpp (original)
+++ llvm/trunk/lib/Support/Dwarf.cpp Tue Feb  3 15:08:33 2015
@@ -76,8 +76,6 @@ const char *llvm::dwarf::TagString(unsig
   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";

Modified: llvm/trunk/unittests/Support/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/CMakeLists.txt?rev=228029&r1=228028&r2=228029&view=diff
==============================================================================
--- llvm/trunk/unittests/Support/CMakeLists.txt (original)
+++ llvm/trunk/unittests/Support/CMakeLists.txt Tue Feb  3 15:08:33 2015
@@ -13,6 +13,7 @@ add_llvm_unittest(SupportTests
   CompressionTest.cpp
   ConvertUTFTest.cpp
   DataExtractorTest.cpp
+  DwarfTest.cpp
   EndianTest.cpp
   ErrorOrTest.cpp
   FileOutputBufferTest.cpp

Added: llvm/trunk/unittests/Support/DwarfTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/DwarfTest.cpp?rev=228029&view=auto
==============================================================================
--- llvm/trunk/unittests/Support/DwarfTest.cpp (added)
+++ llvm/trunk/unittests/Support/DwarfTest.cpp Tue Feb  3 15:08:33 2015
@@ -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





More information about the llvm-commits mailing list