r235787 - clang-cl: Don't look up absolute paths in %LIB%.
Nico Weber
nicolasweber at gmx.de
Fri Apr 24 15:16:53 PDT 2015
Author: nico
Date: Fri Apr 24 17:16:53 2015
New Revision: 235787
URL: http://llvm.org/viewvc/llvm-project?rev=235787&view=rev
Log:
clang-cl: Don't look up absolute paths in %LIB%.
Before this patch, passing a non-existent absolute path to clang-cl would cause
stat'ing of impossible paths. For example, `clang-cl -c d:\adsfasdf.txt` would
cause a stat of
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\LIBd:\asdfadsf.cc
Modified:
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/test/Driver/cl-inputs.c
Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=235787&r1=235786&r2=235787&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Fri Apr 24 17:16:53 2015
@@ -989,7 +989,8 @@ static bool DiagnoseInputExistence(const
if (llvm::sys::fs::exists(Twine(Path)))
return true;
- if (D.IsCLMode() && llvm::sys::Process::FindInEnvPath("LIB", Value))
+ if (D.IsCLMode() && !llvm::sys::path::is_absolute(Twine(Path)) &&
+ llvm::sys::Process::FindInEnvPath("LIB", Value))
return true;
D.Diag(clang::diag::err_drv_no_such_file) << Path;
Modified: cfe/trunk/test/Driver/cl-inputs.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cl-inputs.c?rev=235787&r1=235786&r2=235787&view=diff
==============================================================================
--- cfe/trunk/test/Driver/cl-inputs.c (original)
+++ cfe/trunk/test/Driver/cl-inputs.c Fri Apr 24 17:16:53 2015
@@ -59,4 +59,9 @@
// LIBINPUT2: link.exe"
// LIBINPUT2-NOT: "cl-test2.lib"
+// RUN: %clang_cl -### -- %s /nonexisting.lib 2>&1 | FileCheck -check-prefix=LIBINPUT3 %s
+// LIBINPUT3: error: no such file or directory: '/nonexisting.lib'
+// LIBINPUT3: link.exe"
+// LIBINPUT3-NOT: "/nonexisting.lib"
+
void f();
More information about the cfe-commits
mailing list