[lld][WebAssemlby] Check for command line flags with missing arguments
I'm really not sure how this was overlooked when we first ported lld to Wasm. The upstream code in the ELF backend has these two lines but for some reason they never make it into the Wasm version. Differential Revision: https://reviews.llvm.org/D126497
This commit is contained in:
parent
35b0955aa5
commit
966427b847
@ -5,6 +5,9 @@ _start:
|
||||
.functype _start () -> ()
|
||||
end_function
|
||||
|
||||
# RUN: not wasm-ld %t -o 2>&1 | FileCheck --check-prefix=NO_O_VAL %s
|
||||
# NO_O_VAL: error: -o: missing argument
|
||||
|
||||
# RUN: not wasm-ld -o %t.exe 2>&1 | FileCheck -check-prefix=IN %s
|
||||
# IN: error: no input files
|
||||
|
||||
|
@ -184,6 +184,9 @@ opt::InputArgList WasmOptTable::parse(ArrayRef<const char *> argv) {
|
||||
args = this->ParseArgs(vec, missingIndex, missingCount);
|
||||
|
||||
handleColorDiagnostics(args);
|
||||
if (missingCount)
|
||||
error(Twine(args.getArgString(missingIndex)) + ": missing argument");
|
||||
|
||||
for (auto *arg : args.filtered(OPT_UNKNOWN))
|
||||
error("unknown argument: " + arg->getAsString(args));
|
||||
return args;
|
||||
|
Loading…
x
Reference in New Issue
Block a user