[llvm] r285475 - Refactor DW_LNE_* into Dwarf.def
Adrian Prantl via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 28 15:57:03 PDT 2016
Author: adrian
Date: Fri Oct 28 17:57:02 2016
New Revision: 285475
URL: http://llvm.org/viewvc/llvm-project?rev=285475&view=rev
Log:
Refactor DW_LNE_* 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=285475&r1=285474&r2=285475&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/Dwarf.def (original)
+++ llvm/trunk/include/llvm/Support/Dwarf.def Fri Oct 28 17:57:02 2016
@@ -12,13 +12,14 @@
//===----------------------------------------------------------------------===//
// TODO: Add other DW-based macros.
-#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_LNS || defined HANDLE_DW_LNCT || \
- defined HANDLE_DW_MACRO || defined HANDLE_DW_RLE || \
- defined HANDLE_DW_CFA || defined HANDLE_DW_APPLE_PROPERTY)
+#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_LNS || \
+ defined HANDLE_DW_LNE || defined HANDLE_DW_LNCT || \
+ defined HANDLE_DW_MACRO || defined HANDLE_DW_RLE || \
+ defined HANDLE_DW_CFA || defined HANDLE_DW_APPLE_PROPERTY)
#error "Missing macro definition of HANDLE_DW*"
#endif
@@ -62,6 +63,10 @@
#define HANDLE_DW_LNS(ID, NAME)
#endif
+#ifndef HANDLE_DW_LNE
+#define HANDLE_DW_LNE(ID, NAME)
+#endif
+
#ifndef HANDLE_DW_LNCT
#define HANDLE_DW_LNCT(ID, NAME)
#endif
@@ -687,7 +692,13 @@ HANDLE_DW_CC(0xb5, BORLAND_thiscall)
HANDLE_DW_CC(0xb6, BORLAND_fastcall)
HANDLE_DW_CC(0xc0, LLVM_vectorcall)
-/// Line Number Standard Opcode Encodings.
+// Line Number Extended Opcode Encodings
+HANDLE_DW_LNE(0x01, end_sequence)
+HANDLE_DW_LNE(0x02, set_address)
+HANDLE_DW_LNE(0x03, define_file)
+HANDLE_DW_LNE(0x04, set_discriminator)
+
+// Line Number Standard Opcode Encodings.
HANDLE_DW_LNS(0x00, extended_op)
HANDLE_DW_LNS(0x01, copy)
HANDLE_DW_LNS(0x02, advance_pc)
@@ -702,7 +713,6 @@ HANDLE_DW_LNS(0x0a, set_prologue_end)
HANDLE_DW_LNS(0x0b, set_epilogue_begin)
HANDLE_DW_LNS(0x0c, set_isa)
-
// DWARF v5 Line number header entry format.
HANDLE_DW_LNCT(0x01, path)
HANDLE_DW_LNCT(0x02, directory_index)
@@ -793,6 +803,7 @@ HANDLE_DW_APPLE_PROPERTY(0x4000, class)
#undef HANDLE_DW_DEFAULTED
#undef HANDLE_DW_CC
#undef HANDLE_DW_LNS
+#undef HANDLE_DW_LNE
#undef HANDLE_DW_LNCT
#undef HANDLE_DW_MACRO
#undef HANDLE_DW_RLE
Modified: llvm/trunk/include/llvm/Support/Dwarf.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Dwarf.h?rev=285475&r1=285474&r2=285475&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/Dwarf.h (original)
+++ llvm/trunk/include/llvm/Support/Dwarf.h Fri Oct 28 17:57:02 2016
@@ -211,12 +211,10 @@ enum LineNumberOps {
#include "llvm/Support/Dwarf.def"
};
+/// Line Number Extended Opcode Encodings.
enum LineNumberExtendedOps {
- // Line Number Extended Opcode Encodings
- DW_LNE_end_sequence = 0x01,
- DW_LNE_set_address = 0x02,
- DW_LNE_define_file = 0x03,
- DW_LNE_set_discriminator = 0x04,
+#define HANDLE_DW_LNE(ID, NAME) DW_LNE_##NAME = ID,
+#include "llvm/Support/Dwarf.def"
DW_LNE_lo_user = 0x80,
DW_LNE_hi_user = 0xff
};
Modified: llvm/trunk/lib/Support/Dwarf.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Dwarf.cpp?rev=285475&r1=285474&r2=285475&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Dwarf.cpp (original)
+++ llvm/trunk/lib/Support/Dwarf.cpp Fri Oct 28 17:57:02 2016
@@ -247,15 +247,13 @@ StringRef llvm::dwarf::LNStandardString(
StringRef llvm::dwarf::LNExtendedString(unsigned Encoding) {
switch (Encoding) {
- // Line Number Extended Opcode Encodings
- case DW_LNE_end_sequence: return "DW_LNE_end_sequence";
- case DW_LNE_set_address: return "DW_LNE_set_address";
- case DW_LNE_define_file: return "DW_LNE_define_file";
- case DW_LNE_set_discriminator: return "DW_LNE_set_discriminator";
- case DW_LNE_lo_user: return "DW_LNE_lo_user";
- case DW_LNE_hi_user: return "DW_LNE_hi_user";
+ default:
+ return StringRef();
+#define HANDLE_DW_LNE(ID, NAME) \
+ case DW_LNE_##NAME: \
+ return "DW_LNE_" #NAME;
+#include "llvm/Support/Dwarf.def"
}
- return StringRef();
}
StringRef llvm::dwarf::MacinfoString(unsigned Encoding) {
More information about the llvm-commits
mailing list