[PATCH] D118070: Make lld-link work in a non-MSVC shell

Nico Weber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 11 19:33:39 PST 2022


thakis added a comment.

It fails on this:

  // Validate that the default triple is used when run an empty tools dir is specified
  // RUN: %clang_cl -vctoolsdir "" -### -- %s 2>&1 | FileCheck %s --check-prefix VCTOOLSDIR
  // VCTOOLSDIR: "-triple" "{{[a-zA-Z0-9_-]*}}-pc-windows-msvc19.20.0"

With this:

  C:\buildbot-root\llvm-clang-x86_64-sie-win\llvm-project\clang\test\Driver\cl-options.c:761:16: error: VCTOOLSDIR: expected string not found in input
  // VCTOOLSDIR: "-triple" "{{[a-zA-Z0-9_-]*}}-pc-windows-msvc19.20.0"
                 ^
  <stdin>:1:1: note: scanning from here
  clang version 15.0.0 (https://github.com/llvm/llvm-project.git 0574b5fc657451c9d13d3f6d8fe14ea15c23a681)
  ^
  <stdin>:5:68: note: possible intended match here
   "c:\\buildbot-root\\llvm-clang-x86_64-sie-win\\build\\bin\\clang.exe" "-cc1" "-triple" "x86_64-pc-windows-msvc19.29.30137" ...

That test was added in D85998 <https://reviews.llvm.org/D85998>.

I think this is a true regression. findVCToolChainViaCommandLine() used to return true on present-but-empty strings, but llvm::findVCToolChainViaCommandLine() uses the empty string as "not set".

The fix is probably to make llvm::findVCToolChainViaCommandLine() take Optional<StringRef>s instead, and use the Optional value instead of string emptiness.

It's late over here, so I won't get to that myself today. Feel free to revert for now.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D118070/new/

https://reviews.llvm.org/D118070



More information about the llvm-commits mailing list