[llvm] r285474 - Refactor DW_LNS_* into Dwarf.def
Adrian Prantl via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 28 15:57:00 PDT 2016
Author: adrian
Date: Fri Oct 28 17:56:59 2016
New Revision: 285474
URL: http://llvm.org/viewvc/llvm-project?rev=285474&view=rev
Log:
Refactor DW_LNS_* 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=285474&r1=285473&r2=285474&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/Dwarf.def (original)
+++ llvm/trunk/include/llvm/Support/Dwarf.def Fri Oct 28 17:56:59 2016
@@ -12,13 +12,13 @@
//===----------------------------------------------------------------------===//
// 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_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_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
@@ -58,6 +58,10 @@
#define HANDLE_DW_CC(ID, NAME)
#endif
+#ifndef HANDLE_DW_LNS
+#define HANDLE_DW_LNS(ID, NAME)
+#endif
+
#ifndef HANDLE_DW_LNCT
#define HANDLE_DW_LNCT(ID, NAME)
#endif
@@ -683,6 +687,22 @@ HANDLE_DW_CC(0xb5, BORLAND_thiscall)
HANDLE_DW_CC(0xb6, BORLAND_fastcall)
HANDLE_DW_CC(0xc0, LLVM_vectorcall)
+/// Line Number Standard Opcode Encodings.
+HANDLE_DW_LNS(0x00, extended_op)
+HANDLE_DW_LNS(0x01, copy)
+HANDLE_DW_LNS(0x02, advance_pc)
+HANDLE_DW_LNS(0x03, advance_line)
+HANDLE_DW_LNS(0x04, set_file)
+HANDLE_DW_LNS(0x05, set_column)
+HANDLE_DW_LNS(0x06, negate_stmt)
+HANDLE_DW_LNS(0x07, set_basic_block)
+HANDLE_DW_LNS(0x08, const_add_pc)
+HANDLE_DW_LNS(0x09, fixed_advance_pc)
+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)
@@ -772,6 +792,7 @@ HANDLE_DW_APPLE_PROPERTY(0x4000, class)
#undef HANDLE_DW_VIRTUALITY
#undef HANDLE_DW_DEFAULTED
#undef HANDLE_DW_CC
+#undef HANDLE_DW_LNS
#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=285474&r1=285473&r2=285474&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/Dwarf.h (original)
+++ llvm/trunk/include/llvm/Support/Dwarf.h Fri Oct 28 17:56:59 2016
@@ -205,21 +205,10 @@ enum DiscriminantList {
DW_DSC_range = 0x01
};
+/// Line Number Standard Opcode Encodings.
enum LineNumberOps {
- // Line Number Standard Opcode Encodings
- DW_LNS_extended_op = 0x00,
- DW_LNS_copy = 0x01,
- DW_LNS_advance_pc = 0x02,
- DW_LNS_advance_line = 0x03,
- DW_LNS_set_file = 0x04,
- DW_LNS_set_column = 0x05,
- DW_LNS_negate_stmt = 0x06,
- DW_LNS_set_basic_block = 0x07,
- DW_LNS_const_add_pc = 0x08,
- DW_LNS_fixed_advance_pc = 0x09,
- DW_LNS_set_prologue_end = 0x0a,
- DW_LNS_set_epilogue_begin = 0x0b,
- DW_LNS_set_isa = 0x0c
+#define HANDLE_DW_LNS(ID, NAME) DW_LNS_##NAME = ID,
+#include "llvm/Support/Dwarf.def"
};
enum LineNumberExtendedOps {
Modified: llvm/trunk/lib/Support/Dwarf.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Dwarf.cpp?rev=285474&r1=285473&r2=285474&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Dwarf.cpp (original)
+++ llvm/trunk/lib/Support/Dwarf.cpp Fri Oct 28 17:56:59 2016
@@ -236,20 +236,13 @@ StringRef llvm::dwarf::DiscriminantStrin
StringRef llvm::dwarf::LNStandardString(unsigned Standard) {
switch (Standard) {
- case DW_LNS_copy: return "DW_LNS_copy";
- case DW_LNS_advance_pc: return "DW_LNS_advance_pc";
- case DW_LNS_advance_line: return "DW_LNS_advance_line";
- case DW_LNS_set_file: return "DW_LNS_set_file";
- case DW_LNS_set_column: return "DW_LNS_set_column";
- case DW_LNS_negate_stmt: return "DW_LNS_negate_stmt";
- case DW_LNS_set_basic_block: return "DW_LNS_set_basic_block";
- case DW_LNS_const_add_pc: return "DW_LNS_const_add_pc";
- case DW_LNS_fixed_advance_pc: return "DW_LNS_fixed_advance_pc";
- case DW_LNS_set_prologue_end: return "DW_LNS_set_prologue_end";
- case DW_LNS_set_epilogue_begin: return "DW_LNS_set_epilogue_begin";
- case DW_LNS_set_isa: return "DW_LNS_set_isa";
+ default:
+ return StringRef();
+#define HANDLE_DW_LNS(ID, NAME) \
+ case DW_LNS_##NAME: \
+ return "DW_LNS_" #NAME;
+#include "llvm/Support/Dwarf.def"
}
- return StringRef();
}
StringRef llvm::dwarf::LNExtendedString(unsigned Encoding) {
More information about the llvm-commits
mailing list