[PATCH] D37714: llvm-dwarfdump: Replace -debug-dump=sect option with individual options.

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 11 16:29:55 PDT 2017


rnk added a comment.

+1 for dropping the old names



================
Comment at: include/llvm/DebugInfo/DIContext.h:115-124
+namespace {
+/// This is just a helper to programmatically construct DIDumpType.
+enum DIDumpTypeCounter {
+  DIDT_ID_Null = 0,
+#define HANDLE_DWARF_SECTION(ENUM_NAME, ELF_NAME, CMDLINE_NAME) \
+  DIDT_ID##ENUM_NAME,
+#include "llvm/BinaryFormat/Dwarf.def"
----------------
dblaikie wrote:
> Anonymous namespaces in headers are generally a bit suspect - tend to create ODR violations.
> 
> 
+1

Also, think it's worth adding DIDT_ID_Count and a `static_assert(DIDT_ID_Count < 64)`?


================
Comment at: include/llvm/DebugInfo/DIContext.h:122
+#include "llvm/BinaryFormat/Dwarf.def"
+#undef HANDLE_DWARF_SECTION
+};
----------------
This is redundant with the .def file.


================
Comment at: include/llvm/DebugInfo/DIContext.h:131
+#define HANDLE_DWARF_SECTION(ENUM_NAME, ELF_NAME, CMDLINE_NAME) \
+  DIDT_##ENUM_NAME = 1 << DIDT_ID##ENUM_NAME,
+#include "llvm/BinaryFormat/Dwarf.def"
----------------
Is `1ULL <<` necessary to avoid UB here?


Repository:
  rL LLVM

https://reviews.llvm.org/D37714





More information about the llvm-commits mailing list