[PATCH] D32587: Add llvm::object::getELFSectionTypeName()

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 27 11:09:53 PDT 2017


ruiu added inline comments.


================
Comment at: lib/Object/ELF.cpp:149
+    switch (Type) {
+    case ELF::SHT_ARM_EXIDX:
+      return "SHT_ARM_EXIDX";
----------------
grimar wrote:
> I would use some macro here. Like in original code and
> above in this file used for relocations:
> 
> ```
> #define ELF_RELOC(name, value)                              \
>   case ELF::name:                                                       \
>     return #name;                                                       \
> ```
> 
> It should do code shorter and be less errorprone.
> May be worth to rename ELF_RELOC to something more generic and reuse,
> or introduce new one. Not sure here.
Yes, since this file already uses a macro, it is better to use a macro too for consistency in this case.


Repository:
  rL LLVM

https://reviews.llvm.org/D32587





More information about the llvm-commits mailing list