aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian McCarthy <amccarth@google.com>2016-05-20 15:46:23 +0000
committerAdrian McCarthy <amccarth@google.com>2016-05-20 15:46:23 +0000
commit8e0879a9d3d0dbeea7c193bdec05e31ff4e2913f (patch)
treecb342a1bd5f21bb096988d897062665a03735616
parent08713bd1ed6ee0d28a480d74fbf0f575532b0fab (diff)
downloadllvm-8e0879a9d3d0dbeea7c193bdec05e31ff4e2913f.zip
llvm-8e0879a9d3d0dbeea7c193bdec05e31ff4e2913f.tar.gz
llvm-8e0879a9d3d0dbeea7c193bdec05e31ff4e2913f.tar.bz2
Eliminate unnecessary file access checks in Clang driver on Windows
Differential Revision: http://reviews.llvm.org/D20454 llvm-svn: 270226
-rw-r--r--clang/lib/Driver/MSVCToolChain.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/Driver/MSVCToolChain.cpp b/clang/lib/Driver/MSVCToolChain.cpp
index a80ad60..4af142d 100644
--- a/clang/lib/Driver/MSVCToolChain.cpp
+++ b/clang/lib/Driver/MSVCToolChain.cpp
@@ -408,7 +408,10 @@ bool MSVCToolChain::getVisualStudioBinariesFolder(const char *clangProgramPath,
SmallString<128> FilePath(PathSegment);
llvm::sys::path::append(FilePath, "cl.exe");
- if (llvm::sys::fs::can_execute(FilePath.c_str()) &&
+ // Checking if cl.exe exists is a small optimization over calling
+ // can_execute, which really only checks for existence but will also do
+ // extra checks for cl.exe.exe. These add up when walking a long path.
+ if (llvm::sys::fs::exists(FilePath.c_str()) &&
!llvm::sys::fs::equivalent(FilePath.c_str(), clangProgramPath)) {
// If we found it on the PATH, use it exactly as is with no
// modifications.