llvm-project/lld/test/COFF/responsefile.test
Nico Weber 9b2830b46e lld-link, clang: Treat non-existent input files as possible spellos for option flags
OptTable treats arguments starting with / that aren't a known option
as filenames. This means lld-link's and clang-cl's typo correction for
unknown flags didn't do spell checking for misspelled options that start
with /.

I first tried changing OptTable, but that got pretty messy, see PR41787
comments 2 and 3.

Instead, let lld-link's and clang's (including clang-cl's) "file not
found" diagnostic check if a non-existent file looks like it could be a
mis-spelled option, and if so add a "did you mean" suggestion to the
"file not found" diagnostic.

While here, make formatting of a few diagnostics a bit more
self-consistent.

Fixes PR41787.

Differential Revision: https://reviews.llvm.org/D62276

llvm-svn: 361518
2019-05-23 17:58:33 +00:00

26 lines
890 B
Plaintext

# RUN: yaml2obj < %p/Inputs/ret42.yaml > %t.obj
# RUN: echo /out:%t.exe /entry:main %t.obj > %t.rsp
# RUN: lld-link @%t.rsp /heap:0x3000
# RUN: llvm-readobj --file-headers %t.exe | FileCheck %s
CHECK: SizeOfHeapReserve: 12288
# RUN: not lld-link --rsp-quoting=foobar @%t.rsp 2>&1 | \
# RUN: FileCheck --check-prefix=INVRSP %s
INVRSP: invalid response file quoting: foobar
# RUN: echo "blah\foo" > %t.rsp
# RUN: not lld-link @%t.rsp 2>&1 | \
# RUN: FileCheck --check-prefix=DEFRSP %s
DEFRSP: error: could not open 'blah\foo'
# RUN: echo "blah\foo" > %t.rsp
# RUN: not lld-link --rsp-quoting=windows @%t.rsp 2>&1 | \
# RUN: FileCheck --check-prefix=WINRSP %s
WINRSP: error: could not open 'blah\foo'
# RUN: echo "blah\foo" > %t.rsp
# RUN: not lld-link --rsp-quoting=posix @%t.rsp 2>&1 | \
# RUN: FileCheck --check-prefix=POSRSP %s
POSRSP: error: could not open 'blahfoo'