summaryrefslogtreecommitdiffstats
path: root/llvm/lib/System/Unix
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2005-07-07 18:21:42 +0000
committerReid Spencer <rspencer@reidspencer.com>2005-07-07 18:21:42 +0000
commit5b891e98471ec8a21e3cd2182a322c77aad200bb (patch)
tree41dd8e6fcd6d4347ca4ed7e22e8f52386e0a0d39 /llvm/lib/System/Unix
parent2e81f65eb8c066ceb7f7eaa88abc37069ef4bc56 (diff)
downloadbcm5719-llvm-5b891e98471ec8a21e3cd2182a322c77aad200bb.tar.gz
bcm5719-llvm-5b891e98471ec8a21e3cd2182a322c77aad200bb.zip
For PR495:
Change interface to Path class: readable -> canRead writable -> canWrite executable -> canExecute More (incremental) changes coming to close 495. llvm-svn: 22345
Diffstat (limited to 'llvm/lib/System/Unix')
-rw-r--r--llvm/lib/System/Unix/Path.inc12
-rw-r--r--llvm/lib/System/Unix/Program.inc6
2 files changed, 9 insertions, 9 deletions
diff --git a/llvm/lib/System/Unix/Path.inc b/llvm/lib/System/Unix/Path.inc
index b371d00e69b..f871adb2c70 100644
--- a/llvm/lib/System/Unix/Path.inc
+++ b/llvm/lib/System/Unix/Path.inc
@@ -168,14 +168,14 @@ static void getPathList(const char*path, std::vector<sys::Path>& Paths) {
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::GetBytecodeLibraryPaths(std::vector<sys::Path>& Paths) {
{
Path tmpPath;
if (tmpPath.setDirectory(LLVM_LIBDIR))
- if (tmpPath.readable())
+ if (tmpPath.canRead())
Paths.push_back(tmpPath);
}
#endif
@@ -305,17 +305,17 @@ Path::exists() const {
}
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))
diff --git a/llvm/lib/System/Unix/Program.inc b/llvm/lib/System/Unix/Program.inc
index de5ae7f1978..774bd02e88b 100644
--- a/llvm/lib/System/Unix/Program.inc
+++ b/llvm/lib/System/Unix/Program.inc
@@ -46,7 +46,7 @@ Program::FindProgramByName(const std::string& progName) {
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 @@ Program::FindProgramByName(const std::string& progName) {
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 @@ Program::ExecuteAndWait(const Path& path,
const Path** redirects,
unsigned secondsToWait
) {
- if (!path.executable())
+ if (!path.canExecute())
throw path.toString() + " is not executable";
#ifdef HAVE_SYS_WAIT_H
OpenPOWER on IntegriCloud