[PATCH] D77919: [MC][ELF] Add section flags to diagnostic

Brian Cain via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 21 08:04:20 PDT 2020


bcain marked an inline comment as done.
bcain added inline comments.


================
Comment at: llvm/lib/MC/MCParser/ELFAsmParser.cpp:290
+          Twine(((flags & ELF::SHF_TLS) != 0) ? "T" : "") +
+          Twine(((flags & ELF::XCORE_SHF_CP_SECTION) != 0) ? "c" : "") +
+          Twine(((flags & ELF::XCORE_SHF_DP_SECTION) != 0) ? "d" : "") +
----------------
MaskRay wrote:
> It is incorrect to mix OS/processor specific flags here. Hard coding generic flags and their strings are also error-prone. I left this as a TODO because it is not very easy to reuse `lib/MC/MCSectionELF.cpp#L53` code. I'll check more carefully how to reuse.
> it is not very easy to reuse lib/MC/MCSectionELF.cpp#L53 code. I'll check more carefully how to reuse.

What If I just abstracted the portion of code in PrintSwitchToSection() relating to the flags to a method that takes `unsigned Flags` and returns the text as a string?  That could be used here in ELFAsmParser but also in PrintSwitchToSection()?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77919/new/

https://reviews.llvm.org/D77919





More information about the llvm-commits mailing list