Skip to content

Commit c43b7e6

Browse files
committed
Improve an error message.
Before: $ ld.lld --plugin-opt=Os ld.lld: error: --plugin-opt: number expected, but got 's' After: $ ld.lld --plugin-opt=Os ld.lld: error: --plugin-opt=Os: number expected, but got 's' llvm-svn: 322315
1 parent cc9c8b9 commit c43b7e6

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

lld/ELF/Driver.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,8 @@ static bool getCompressDebugSections(opt::InputArgList &Args) {
584584
static int parseInt(StringRef S, opt::Arg *Arg) {
585585
int V = 0;
586586
if (!to_integer(S, V, 10))
587-
error(Arg->getSpelling() + ": number expected, but got '" + S + "'");
587+
error(Arg->getSpelling() + "=" + Arg->getValue() +
588+
": number expected, but got '" + S + "'");
588589
return V;
589590
}
590591

lld/test/ELF/lto/opt-level.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
; RUN: FileCheck --check-prefix=INVALID1 %s
2020
; RUN: not ld.lld -o %t3 -m elf_x86_64 -e main --plugin-opt=Ofoo %t.o 2>&1 | \
2121
; RUN: FileCheck --check-prefix=INVALID2 %s
22-
; INVALID2: --plugin-opt: number expected, but got 'foo'
22+
; INVALID2: --plugin-opt=Ofoo: number expected, but got 'foo'
2323

2424
; RUN: not ld.lld -o %t3 -m elf_x86_64 -e main --lto-O-1 %t.o 2>&1 | \
2525
; RUN: FileCheck --check-prefix=INVALIDNEGATIVE1 %s

0 commit comments

Comments
 (0)