[llvm] r247361 - Add .exe check to Execute to fix clang-modernize tests broken in r247358
Reid Kleckner via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 10 16:59:45 PDT 2015
Author: rnk
Date: Thu Sep 10 18:59:45 2015
New Revision: 247361
URL: http://llvm.org/viewvc/llvm-project?rev=247361&view=rev
Log:
Add .exe check to Execute to fix clang-modernize tests broken in r247358
Modified:
llvm/trunk/lib/Support/Windows/Program.inc
Modified: llvm/trunk/lib/Support/Windows/Program.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Windows/Program.inc?rev=247361&r1=247360&r2=247361&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Windows/Program.inc (original)
+++ llvm/trunk/lib/Support/Windows/Program.inc Thu Sep 10 18:59:45 2015
@@ -251,6 +251,14 @@ static bool Execute(ProcessInfo &PI, Str
return false;
}
+ // can_execute may succeed by looking at Program + ".exe". CreateProcessW
+ // will implicitly add the .exe if we provide a command line without an
+ // executable path, but since we use an explicit executable, we have to add
+ // ".exe" ourselves.
+ SmallString<64> ProgramStorage;
+ if (!sys::fs::exists(Program))
+ Program = Twine(Program + ".exe").toStringRef(ProgramStorage);
+
// Windows wants a command line, not an array of args, to pass to the new
// process. We have to concatenate them all, while quoting the args that
// have embedded spaces (or are empty).
More information about the llvm-commits
mailing list