[PATCH] Use the newly added FindInEnvPath helper in clang

Hans Wennborg hans at chromium.org
Thu Jun 19 09:48:05 PDT 2014


================
Comment at: lib/Driver/Driver.cpp:937
@@ -959,1 +936,3 @@
+    llvm::sys::FindInEnvPath("LIB", Value);
+  return FilePath.hasValue();
 }
----------------
I think Optional<> provides a bool conversion operator, so you can just do: "return llvm::sys::FindInEnvPath("LIB", Value);".. and since the function is now just one line, maybe inline it into the caller.

================
Comment at: lib/Driver/Tools.cpp:7541
@@ -7559,1 +7540,3 @@
+      !llvm::sys::fs::equivalent(Twine(FilePath.getValue()), ClangProgramPath))
+    return FilePath.getValue();
 
----------------
This doesn't work. The previous code handles the case where there are multiple cl.exe on the PATH, whereas the new code just returns the first one.

This function is used in the Visual Studio clang-cl integration, where we rename clang-cl.exe to cl.exe and put it first on PATH. This function is then used to find the real cl.exe.

I think we have to leave this code as it is (though we can remove the definition of PathSeparators and use llvm::sys::EnvPathSeparator).

http://reviews.llvm.org/D4202






More information about the cfe-commits mailing list