[llvm-commits] CVS: llvm/lib/System/Unix/Path.inc Program.inc

Reid Spencer reid at x10sys.com
Thu Jul 7 11:21:57 PDT 2005



Changes in directory llvm/lib/System/Unix:

Path.inc updated: 1.35 -> 1.36
Program.inc updated: 1.13 -> 1.14
---
Log message:

For PR495: http://llvm.cs.uiuc.edu/PR495 :
Change interface to Path class:
readable -> canRead
writable -> canWrite
executable -> canExecute

More (incremental) changes coming to close 495.



---
Diffs of the changes:  (+9 -9)

 Path.inc    |   12 ++++++------
 Program.inc |    6 +++---
 2 files changed, 9 insertions(+), 9 deletions(-)


Index: llvm/lib/System/Unix/Path.inc
diff -u llvm/lib/System/Unix/Path.inc:1.35 llvm/lib/System/Unix/Path.inc:1.36
--- llvm/lib/System/Unix/Path.inc:1.35	Thu Jun  2 00:38:20 2005
+++ llvm/lib/System/Unix/Path.inc	Thu Jul  7 13:21:42 2005
@@ -168,14 +168,14 @@
   while( delim != 0 ) {
     std::string tmp(at, size_t(delim-at));
     if (tmpPath.setDirectory(tmp))
-      if (tmpPath.readable())
+      if (tmpPath.canRead())
         Paths.push_back(tmpPath);
     at = delim + 1;
     delim = strchr(at, ':');
   }
   if (*at != 0)
     if (tmpPath.setDirectory(std::string(at)))
-      if (tmpPath.readable())
+      if (tmpPath.canRead())
         Paths.push_back(tmpPath);
 
 }
@@ -205,7 +205,7 @@
   {
     Path tmpPath;
     if (tmpPath.setDirectory(LLVM_LIBDIR))
-      if (tmpPath.readable())
+      if (tmpPath.canRead())
         Paths.push_back(tmpPath);
   }
 #endif
@@ -305,17 +305,17 @@
 }
 
 bool
-Path::readable() const {
+Path::canRead() const {
   return 0 == access(path.c_str(), F_OK | R_OK );
 }
 
 bool
-Path::writable() const {
+Path::canWrite() const {
   return 0 == access(path.c_str(), F_OK | W_OK );
 }
 
 bool
-Path::executable() const {
+Path::canExecute() const {
   struct stat st;
   int r = stat(path.c_str(), &st);
   if (r != 0 || !S_ISREG(st.st_mode))


Index: llvm/lib/System/Unix/Program.inc
diff -u llvm/lib/System/Unix/Program.inc:1.13 llvm/lib/System/Unix/Program.inc:1.14
--- llvm/lib/System/Unix/Program.inc:1.13	Thu May  5 17:33:06 2005
+++ llvm/lib/System/Unix/Program.inc	Thu Jul  7 13:21:42 2005
@@ -46,7 +46,7 @@
     return Path();
   // FIXME: have to check for absolute filename - we cannot assume anything
   // about "." being in $PATH
-  if (temp.executable()) // already executable as is
+  if (temp.canExecute()) // already executable as is
     return temp;
 
   // At this point, the file name is valid and its not executable
@@ -66,7 +66,7 @@
     Path FilePath;
     if (FilePath.setDirectory(std::string(PathStr,Colon))) {
       FilePath.appendFile(progName);
-      if (FilePath.executable())
+      if (FilePath.canExecute())
         return FilePath;                    // Found the executable!
     }
 
@@ -109,7 +109,7 @@
                         const Path** redirects,
                         unsigned secondsToWait
 ) {
-  if (!path.executable())
+  if (!path.canExecute())
     throw path.toString() + " is not executable"; 
 
 #ifdef HAVE_SYS_WAIT_H






More information about the llvm-commits mailing list