[llvm] r285470 - Refactor all DW_FORM_* constants into Dwarf.def
Adrian Prantl via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 28 15:56:45 PDT 2016
Author: adrian
Date: Fri Oct 28 17:56:45 2016
New Revision: 285470
URL: http://llvm.org/viewvc/llvm-project?rev=285470&view=rev
Log:
Refactor all DW_FORM_* constants into Dwarf.def
Modified:
llvm/trunk/include/llvm/Support/Dwarf.def
llvm/trunk/include/llvm/Support/Dwarf.h
llvm/trunk/lib/Support/Dwarf.cpp
Modified: llvm/trunk/include/llvm/Support/Dwarf.def
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Dwarf.def?rev=285470&r1=285469&r2=285470&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/Dwarf.def (original)
+++ llvm/trunk/include/llvm/Support/Dwarf.def Fri Oct 28 17:56:45 2016
@@ -12,7 +12,8 @@
//===----------------------------------------------------------------------===//
// TODO: Add other DW-based macros.
-#if !(defined HANDLE_DW_TAG || defined HANDLE_DW_AT || defined HANDLE_DW_OP || \
+#if !(defined HANDLE_DW_TAG || defined HANDLE_DW_AT || \
+ defined HANDLE_DW_FORM || defined HANDLE_DW_OP || \
defined HANDLE_DW_LANG || defined HANDLE_DW_ATE || \
defined HANDLE_DW_VIRTUALITY || defined HANDLE_DW_DEFAULTED || \
defined HANDLE_DW_CC || defined HANDLE_DW_LNCT || \
@@ -28,6 +29,10 @@
#define HANDLE_DW_AT(ID, NAME)
#endif
+#ifndef HANDLE_DW_FORM
+#define HANDLE_DW_FORM(ID, NAME)
+#endif
+
#ifndef HANDLE_DW_OP
#define HANDLE_DW_OP(ID, NAME)
#endif
@@ -358,6 +363,51 @@ HANDLE_DW_AT(0x3feb, APPLE_property_attr
HANDLE_DW_AT(0x3fec, APPLE_objc_complete_type)
HANDLE_DW_AT(0x3fed, APPLE_property)
+// Attribute form encodings.
+HANDLE_DW_FORM(0x01, addr)
+HANDLE_DW_FORM(0x03, block2)
+HANDLE_DW_FORM(0x04, block4)
+HANDLE_DW_FORM(0x05, data2)
+HANDLE_DW_FORM(0x06, data4)
+HANDLE_DW_FORM(0x07, data8)
+HANDLE_DW_FORM(0x08, string)
+HANDLE_DW_FORM(0x09, block)
+HANDLE_DW_FORM(0x0a, block1)
+HANDLE_DW_FORM(0x0b, data1)
+HANDLE_DW_FORM(0x0c, flag)
+HANDLE_DW_FORM(0x0d, sdata)
+HANDLE_DW_FORM(0x0e, strp)
+HANDLE_DW_FORM(0x0f, udata)
+HANDLE_DW_FORM(0x10, ref_addr)
+HANDLE_DW_FORM(0x11, ref1)
+HANDLE_DW_FORM(0x12, ref2)
+HANDLE_DW_FORM(0x13, ref4)
+HANDLE_DW_FORM(0x14, ref8)
+HANDLE_DW_FORM(0x15, ref_udata)
+HANDLE_DW_FORM(0x16, indirect)
+HANDLE_DW_FORM(0x17, sec_offset)
+HANDLE_DW_FORM(0x18, exprloc)
+HANDLE_DW_FORM(0x19, flag_present)
+
+// New in DWARF v5.
+HANDLE_DW_FORM(0x1a, strx)
+HANDLE_DW_FORM(0x1b, addrx)
+HANDLE_DW_FORM(0x1c, ref_sup)
+HANDLE_DW_FORM(0x1d, strp_sup)
+HANDLE_DW_FORM(0x1e, data16)
+HANDLE_DW_FORM(0x1f, line_strp)
+HANDLE_DW_FORM(0x20, ref_sig8)
+HANDLE_DW_FORM(0x21, implicit_const)
+HANDLE_DW_FORM(0x22, loclistx)
+HANDLE_DW_FORM(0x23, rnglistx)
+
+// Extensions for Fission proposal
+HANDLE_DW_FORM(0x1f01, GNU_addr_index)
+HANDLE_DW_FORM(0x1f02, GNU_str_index)
+
+// Alternate debug sections proposal (output of "dwz" tool).
+HANDLE_DW_FORM(0x1f20, GNU_ref_alt)
+HANDLE_DW_FORM(0x1f21, GNU_strp_alt)
// DWARF Expression operators.
HANDLE_DW_OP(0x03, addr)
@@ -656,6 +706,7 @@ HANDLE_DW_RLE(0x07, start_length)
#undef HANDLE_DW_TAG
#undef HANDLE_DW_AT
+#undef HANDLE_DW_FORM
#undef HANDLE_DW_OP
#undef HANDLE_DW_LANG
#undef HANDLE_DW_ATE
Modified: llvm/trunk/include/llvm/Support/Dwarf.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Dwarf.h?rev=285470&r1=285469&r2=285470&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/Dwarf.h (original)
+++ llvm/trunk/include/llvm/Support/Dwarf.h Fri Oct 28 17:56:45 2016
@@ -99,52 +99,9 @@ enum Attribute : uint16_t {
};
enum Form : uint16_t {
- // Attribute form encodings
- DW_FORM_addr = 0x01,
- DW_FORM_block2 = 0x03,
- DW_FORM_block4 = 0x04,
- DW_FORM_data2 = 0x05,
- DW_FORM_data4 = 0x06,
- DW_FORM_data8 = 0x07,
- DW_FORM_string = 0x08,
- DW_FORM_block = 0x09,
- DW_FORM_block1 = 0x0a,
- DW_FORM_data1 = 0x0b,
- DW_FORM_flag = 0x0c,
- DW_FORM_sdata = 0x0d,
- DW_FORM_strp = 0x0e,
- DW_FORM_udata = 0x0f,
- DW_FORM_ref_addr = 0x10,
- DW_FORM_ref1 = 0x11,
- DW_FORM_ref2 = 0x12,
- DW_FORM_ref4 = 0x13,
- DW_FORM_ref8 = 0x14,
- DW_FORM_ref_udata = 0x15,
- DW_FORM_indirect = 0x16,
- DW_FORM_sec_offset = 0x17,
- DW_FORM_exprloc = 0x18,
- DW_FORM_flag_present = 0x19,
-
- // New in DWARF v5.
- DW_FORM_strx = 0x1a,
- DW_FORM_addrx = 0x1b,
- DW_FORM_ref_sup = 0x1c,
- DW_FORM_strp_sup = 0x1d,
- DW_FORM_data16 = 0x1e,
- DW_FORM_line_strp = 0x1f,
- DW_FORM_ref_sig8 = 0x20,
- DW_FORM_implicit_const = 0x21,
- DW_FORM_loclistx = 0x22,
- DW_FORM_rnglistx = 0x23,
-
- DW_FORM_lo_user = 0x1f00,
- // Extensions for Fission proposal
- DW_FORM_GNU_addr_index = 0x1f01,
- DW_FORM_GNU_str_index = 0x1f02,
-
- // Alternate debug sections proposal (output of "dwz" tool).
- DW_FORM_GNU_ref_alt = 0x1f20,
- DW_FORM_GNU_strp_alt = 0x1f21
+#define HANDLE_DW_FORM(ID, NAME) DW_FORM_##NAME = ID,
+#include "llvm/Support/Dwarf.def"
+ DW_FORM_lo_user = 0x1f00, ///< Not specified by DWARF.
};
enum LocationAtom {
Modified: llvm/trunk/lib/Support/Dwarf.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Dwarf.cpp?rev=285470&r1=285469&r2=285470&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Dwarf.cpp (original)
+++ llvm/trunk/lib/Support/Dwarf.cpp Fri Oct 28 17:56:45 2016
@@ -57,41 +57,13 @@ StringRef llvm::dwarf::AttributeString(u
StringRef llvm::dwarf::FormEncodingString(unsigned Encoding) {
switch (Encoding) {
- case DW_FORM_addr: return "DW_FORM_addr";
- case DW_FORM_block2: return "DW_FORM_block2";
- case DW_FORM_block4: return "DW_FORM_block4";
- case DW_FORM_data2: return "DW_FORM_data2";
- case DW_FORM_data4: return "DW_FORM_data4";
- case DW_FORM_data8: return "DW_FORM_data8";
- case DW_FORM_string: return "DW_FORM_string";
- case DW_FORM_block: return "DW_FORM_block";
- case DW_FORM_block1: return "DW_FORM_block1";
- case DW_FORM_data1: return "DW_FORM_data1";
- case DW_FORM_flag: return "DW_FORM_flag";
- case DW_FORM_sdata: return "DW_FORM_sdata";
- case DW_FORM_strp: return "DW_FORM_strp";
- case DW_FORM_udata: return "DW_FORM_udata";
- case DW_FORM_ref_addr: return "DW_FORM_ref_addr";
- case DW_FORM_ref1: return "DW_FORM_ref1";
- case DW_FORM_ref2: return "DW_FORM_ref2";
- case DW_FORM_ref4: return "DW_FORM_ref4";
- case DW_FORM_ref8: return "DW_FORM_ref8";
- case DW_FORM_ref_udata: return "DW_FORM_ref_udata";
- case DW_FORM_indirect: return "DW_FORM_indirect";
- case DW_FORM_sec_offset: return "DW_FORM_sec_offset";
- case DW_FORM_exprloc: return "DW_FORM_exprloc";
- case DW_FORM_flag_present: return "DW_FORM_flag_present";
- case DW_FORM_ref_sig8: return "DW_FORM_ref_sig8";
-
- // DWARF5 Fission Extension Forms
- case DW_FORM_GNU_addr_index: return "DW_FORM_GNU_addr_index";
- case DW_FORM_GNU_str_index: return "DW_FORM_GNU_str_index";
-
- // Alternate debug sections proposal (output of "dwz" tool).
- case DW_FORM_GNU_ref_alt: return "DW_FORM_GNU_ref_alt";
- case DW_FORM_GNU_strp_alt: return "DW_FORM_GNU_strp_alt";
+ default:
+ return StringRef();
+#define HANDLE_DW_FORM(ID, NAME) \
+ case DW_FORM_##NAME: \
+ return "DW_FORM_" #NAME;
+#include "llvm/Support/Dwarf.def"
}
- return StringRef();
}
StringRef llvm::dwarf::OperationEncodingString(unsigned Encoding) {
More information about the llvm-commits
mailing list