[PATCH] D99810: [ifs] Prepare llvm-ifs for elfabi/ifs merging.

Haowei Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 17 14:58:22 PDT 2021


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


================
Comment at: llvm/include/llvm/InterfaceStub/ELFObjHandler.h:25
 
 namespace elfabi {
 
----------------
phosek wrote:
> Shouldn't this be in namespace `ifs`?
This was renamed to ifs in D100139.  Rename it here will need some changes in elfabi code, which is unnecessary (and will be deleted in D100139)


================
Comment at: llvm/lib/InterfaceStub/IFSStub.cpp:65
+uint8_t elfabi::convertIFSBitWidthToELF(IFSBitWidthType BitWidth) {
+  return BitWidth == IFSBitWidthType::IFS32 ? ELF::ELFCLASS32 : ELF::ELFCLASS64;
+}
----------------
phosek wrote:
> I'd consider using `switch` here so if someone adds a new entry to the `IFSBitWidthType` enum, it gets caught by the compiler.
I changed it to switch and I added `llvm_unreachable("unkown bitwidth");` to cases where an unknown bitwidth or endianness is used. Please let me know if it is OK to do so.

The Unknown enum is reserved for ifs file that has unknown bitwidth or endianness field and will trigger ifs tool's early termination. So it shouldn't be seen when IFS library is writing an ELF file.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99810



More information about the cfe-commits mailing list