[PATCH] Improve Windows toolchain support for non-standard environments.

Hans Wennborg hans at chromium.org
Fri Oct 17 12:58:41 PDT 2014


================
Comment at: lib/Driver/Tools.cpp:7817
@@ +7816,3 @@
+  // system includes and libraries from one VS installation, and use cl and link
+  // from another installation.
+  llvm::Optional<std::string> OptPath = llvm::sys::Process::GetEnv("PATH");
----------------
I'm not a big fan of our code for finding a msvc installation when vcvars.bat hasn't been run. I think that if the user wants to run clang-cl as a drop-in replacement for cl.exe, it should be dropped into the same environment.

But since we have it, we might as well make it work better. The TODO sounds reasonable, as long as it still checks PATH first, before going off and looking in other places.

Also, will cl.exe and link.exe etc. actually run if they're not on PATH? I recall having problems executing them without being on PATH because they failed to load some dll.

Style nit: FIXME without name is more common than TODO, and the |text| syntax isn't used.

================
Comment at: lib/Driver/Tools.cpp:7927
@@ +7926,3 @@
+  // Make sure we're using link.exe and cl.exe from the same Visual Studio.
+  // Otherwise its possible
+  // that they may come from different locations, for example if GnuWin32 is in
----------------
nit: it's

================
Comment at: lib/Driver/Tools.cpp:7930
@@ +7929,3 @@
+  // the path.
+  llvm::SmallString<128> smartPath(
+      FindFallback("cl.exe", C.getDriver().getClangProgramPath()));
----------------
smartPath?

http://reviews.llvm.org/D5845






More information about the cfe-commits mailing list