[PATCH] D126509: [Objcopy][Wasm] Allow selecting known sections by name

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 27 07:03:51 PDT 2022


sbc100 added inline comments.


================
Comment at: llvm/lib/Object/WasmObjectFile.cpp:1732
     return S.Name;
-  default:
+  if (S.Type > wasm::WASM_SEC_TAG)
     return createStringError(object_error::invalid_section_index, "");
----------------
dschuff wrote:
> This is ugly now because it "knows" that TAG is the last known section id, which will be wrong when we add another. Do you prefer a fix of adding some kind of LAST_SECTION_ID in BinaryFormat/Wasm.h, maybe a function like `isValidSectionId()`?
Its still better than the status quo of duplicating the entire function.   Are you planning on landing the refactoring/de-duplication change first/separately?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D126509



More information about the llvm-commits mailing list