diff --git a/llvm/test/tools/llvm-lipo/replace-invalid-input.test b/llvm/test/tools/llvm-lipo/replace-invalid-input.test index c0ea4d783091..214f6218f180 100644 --- a/llvm/test/tools/llvm-lipo/replace-invalid-input.test +++ b/llvm/test/tools/llvm-lipo/replace-invalid-input.test @@ -3,7 +3,7 @@ # RUN: yaml2obj %p/Inputs/i386-x86_64-universal.yaml -o %t-universal.o # RUN: not llvm-lipo %t-universal.o -replace %t-32.o 2>&1 | FileCheck --check-prefix=MISSING_ARG %s -# MISSING_ARG: error: replace is missing an argument: expects -replace arch_type file_name +# MISSING_ARG: error: missing argument to -replace option # RUN: not llvm-lipo %t-universal.o -replace i386 %t-32.o 2>&1 | FileCheck --check-prefix=OUTPUT_FILE %s # OUTPUT_FILE: error: replace expects a single output file to be specified diff --git a/llvm/test/tools/llvm-lipo/segalign-invalid-input.test b/llvm/test/tools/llvm-lipo/segalign-invalid-input.test index aa6aceb77cc7..48a625e47561 100644 --- a/llvm/test/tools/llvm-lipo/segalign-invalid-input.test +++ b/llvm/test/tools/llvm-lipo/segalign-invalid-input.test @@ -2,7 +2,7 @@ # RUN: yaml2obj %p/Inputs/armv7-slice.yaml -o %t-armv7.o # RUN: not llvm-lipo %t-armv7.o %t-arm64.o -create -o %t.o -segalign a 2>&1 | FileCheck --check-prefix=MISSING_ARG %s -# MISSING_ARG: error: segalign is missing an argument: expects -segalign arch_type alignment_value +# MISSING_ARG: error: missing argument to -segalign option # RUN: not llvm-lipo %t-armv7.o %t-arm64.o -o %t.o -segalign arm64 10 2>&1 | FileCheck --check-prefix=MISSING_ACTION %s # MISSING_ACTION: error: at least one action should be specified diff --git a/llvm/tools/llvm-lipo/llvm-lipo.cpp b/llvm/tools/llvm-lipo/llvm-lipo.cpp index 43dd97ed2c3b..a1247a30734a 100644 --- a/llvm/tools/llvm-lipo/llvm-lipo.cpp +++ b/llvm/tools/llvm-lipo/llvm-lipo.cpp @@ -183,9 +183,7 @@ static Config parseLipoOptions(ArrayRef ArgsArr) { C.InputFiles.push_back({None, Arg->getValue()}); for (auto Arg : InputArgs.filtered(LIPO_arch)) { validateArchitectureName(Arg->getValue(0)); - if (!Arg->getValue(1)) - reportError( - "arch is missing an argument: expects -arch arch_type file_name"); + assert(Arg->getValue(1) && "file_name is missing"); C.InputFiles.push_back({StringRef(Arg->getValue(0)), Arg->getValue(1)}); } @@ -294,10 +292,7 @@ static Config parseLipoOptions(ArrayRef ArgsArr) { case LIPO_replace: for (auto Action : ActionArgs) { - if (!Action->getValue(1)) - reportError( - "replace is missing an argument: expects -replace arch_type " - "file_name"); + assert(Action->getValue(1) && "file_name is missing"); validateArchitectureName(Action->getValue(0)); C.ReplacementFiles.push_back( {StringRef(Action->getValue(0)), Action->getValue(1)}); @@ -725,7 +720,7 @@ replaceSlices(LLVMContext &LLVMCtx, int main(int argc, char **argv) { InitLLVM X(argc, argv); - Config C = parseLipoOptions(makeArrayRef(argv + 1, argc)); + Config C = parseLipoOptions(makeArrayRef(argv + 1, argc - 1)); LLVMContext LLVMCtx; SmallVector, 1> InputBinaries = readInputBinaries(LLVMCtx, C.InputFiles);