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

Derek Schuff via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 26 17:37:24 PDT 2022


dschuff 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, "");
----------------
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()`?


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