[PATCH] D120229: [WebAssembly] Update WebAssemblyAsmTypeCheck for table.get
Sam Clegg via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 23 09:15:31 PST 2022
sbc100 added inline comments.
================
Comment at: llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmTypeCheck.cpp:195
+ break;
+ case wasm::WASM_SYMBOL_TYPE_FUNCTION:
+ case wasm::WASM_SYMBOL_TYPE_DATA:
----------------
pmatos wrote:
> If we are doing a `getTable` here, the only valid case here is `WASM_SYMBOL_TYPE_TABLE`. I think the others can be removed and the `switch` simplified to an `if`.
Can you use an early return here to avoid the else?
```
if (if (WasmSym->getType().getValueOr(wasm::WASM_SYMBOL_TYPE_DATA) !=
wasm::WASM_SYMBOL_TYPE_TABLE)
return typeError(ErrorLoc, StringRef("symbol ") + WasmSym->getName() + ...
Type = static_cast<wasm::ValType>(WasmSym->getTableType().ElemType);
return false;
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D120229/new/
https://reviews.llvm.org/D120229
More information about the llvm-commits
mailing list