[llvm-commits] [llvm] r118048 - in /llvm/trunk: include/llvm/System/Program.h lib/System/Unix/Program.inc lib/System/Win32/Program.inc

Mikhail Glushenkov foldr at codedgers.com
Tue Nov 2 13:32:39 PDT 2010


Author: foldr
Date: Tue Nov  2 15:32:39 2010
New Revision: 118048

URL: http://llvm.org/viewvc/llvm-project?rev=118048&view=rev
Log:
Make FindProgramByName return paths with slashes unmodified on Windows.

This makes its behaviour more consistent across platforms.

Modified:
    llvm/trunk/include/llvm/System/Program.h
    llvm/trunk/lib/System/Unix/Program.inc
    llvm/trunk/lib/System/Win32/Program.inc

Modified: llvm/trunk/include/llvm/System/Program.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/System/Program.h?rev=118048&r1=118047&r2=118048&view=diff
==============================================================================
--- llvm/trunk/include/llvm/System/Program.h (original)
+++ llvm/trunk/include/llvm/System/Program.h Tue Nov  2 15:32:39 2010
@@ -114,7 +114,8 @@
 
     /// This static constructor (factory) will attempt to locate a program in
     /// the operating system's file system using some pre-determined set of
-    /// locations to search (e.g. the PATH on Unix).
+    /// locations to search (e.g. the PATH on Unix). Paths with slashes are
+    /// returned unmodified.
     /// @returns A Path object initialized to the path of the program or a
     /// Path object that is empty (invalid) if the program could not be found.
     /// @brief Construct a Program by finding it by name.

Modified: llvm/trunk/lib/System/Unix/Program.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Unix/Program.inc?rev=118048&r1=118047&r2=118048&view=diff
==============================================================================
--- llvm/trunk/lib/System/Unix/Program.inc (original)
+++ llvm/trunk/lib/System/Unix/Program.inc Tue Nov  2 15:32:39 2010
@@ -66,8 +66,8 @@
   if (progName.find('/') != std::string::npos)
     return temp;
 
-  // At this point, the file name does not contain slashes. Search for it
-  // through the directories specified in the PATH environment variable.
+  // At this point, the file name is valid and does not contain slashes. Search
+  // for it through the directories specified in the PATH environment variable.
 
   // Get the path. If its empty, we can't do anything to find it.
   const char *PathStr = getenv("PATH");

Modified: llvm/trunk/lib/System/Win32/Program.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Win32/Program.inc?rev=118048&r1=118047&r2=118048&view=diff
==============================================================================
--- llvm/trunk/lib/System/Win32/Program.inc (original)
+++ llvm/trunk/lib/System/Win32/Program.inc Tue Nov  2 15:32:39 2010
@@ -67,10 +67,12 @@
   Path temp;
   if (!temp.set(progName)) // invalid name
     return Path();
-  if (temp.canExecute()) // already executable as is
+  // Return paths with slashes verbatim.
+  if (progName.find('\\') != std::string::npos ||
+      progName.find('/') != std::string::npos)
     return temp;
 
-  // At this point, the file name is valid and its not executable.
+  // At this point, the file name is valid and does not contain slashes.
   // Let Windows search for it.
   char buffer[MAX_PATH];
   char *dummy = NULL;





More information about the llvm-commits mailing list