[PATCH] D62276: lld-link, clang: Treat non-existent input files as possible spellos for option flags

Nico Weber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 22 17:31:01 PDT 2019


thakis created this revision.
thakis added a reviewer: rnk.
Herald added a project: LLVM.

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.


https://reviews.llvm.org/D62276

Files:
  clang/include/clang/Basic/DiagnosticDriverKinds.td
  clang/include/clang/Driver/Driver.h
  clang/lib/Driver/Driver.cpp
  clang/test/Driver/unknown-arg.c
  lld/COFF/Driver.cpp
  lld/COFF/DriverUtils.cpp
  lld/test/COFF/color-diagnostics.test
  lld/test/COFF/could-not-open.test
  lld/test/COFF/driver.test
  lld/test/COFF/error-limit.test
  lld/test/COFF/nodefaultlib.test
  lld/test/COFF/responsefile.test

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62276.200845.patch
Type: text/x-patch
Size: 16160 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190523/377d0e59/attachment.bin>


More information about the llvm-commits mailing list