diff options
| author | Edward O'Callaghan <eocallaghan@auroraux.org> | 2009-11-25 06:32:19 +0000 |
|---|---|---|
| committer | Edward O'Callaghan <eocallaghan@auroraux.org> | 2009-11-25 06:32:19 +0000 |
| commit | 746782dde54faa42340ada7430b62a88ca95ced6 (patch) | |
| tree | 945931d6f24e89b6dbd3dcc6c351cf5d59ed4508 /llvm | |
| parent | 3ff3af4ff9b4ad40d5f945cbc68ac4c56393f8c8 (diff) | |
| download | bcm5719-llvm-746782dde54faa42340ada7430b62a88ca95ced6.tar.gz bcm5719-llvm-746782dde54faa42340ada7430b62a88ca95ced6.zip | |
API change Path::isSpecialFile to Path::isRegularFile, improve semantics in regards to comments from 89765 post review.
llvm-svn: 89848
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/include/llvm/System/Path.h | 8 | ||||
| -rw-r--r-- | llvm/lib/System/Unix/Path.inc | 10 | ||||
| -rw-r--r-- | llvm/lib/System/Win32/Path.inc | 6 |
3 files changed, 14 insertions, 10 deletions
diff --git a/llvm/include/llvm/System/Path.h b/llvm/include/llvm/System/Path.h index 04dba1db3e2..7edd5c08207 100644 --- a/llvm/include/llvm/System/Path.h +++ b/llvm/include/llvm/System/Path.h @@ -380,10 +380,12 @@ namespace sys { /// in the file system. bool canWrite() const; - /// This function checks that what we're trying to work only on a regular file or directory. - /// Check for things like /dev/null, any block special file, + /// This function checks that what we're trying to work only on a regular file + /// or directory. Check for things like /dev/null, any block special file, /// or other things that aren't "regular" regular files or directories. - bool isSpecialFile() const; + /// @returns true if the file is S_ISREG. + /// @brief Determines if the file is a regular file + bool isRegularFile() const; /// This function determines if the path name references an executable /// file in the file system. This function checks for the existence and diff --git a/llvm/lib/System/Unix/Path.inc b/llvm/lib/System/Unix/Path.inc index 8dd76a74128..4300d6719b3 100644 --- a/llvm/lib/System/Unix/Path.inc +++ b/llvm/lib/System/Unix/Path.inc @@ -454,17 +454,17 @@ Path::canWrite() const { } bool -Path::isSpecialFile() const { +Path::isRegularFile() const { // Get the status so we can determine if its a file or directory struct stat buf; if (0 != stat(path.c_str(), &buf)) - return true; - - if (S_ISDIR(buf.st_mode) || S_ISREG(buf.st_mode)) return false; - return true; + if (S_ISREG(buf.st_mode)) + return true; + + return false; } bool diff --git a/llvm/lib/System/Win32/Path.inc b/llvm/lib/System/Win32/Path.inc index 9adeca24103..634fbc7650b 100644 --- a/llvm/lib/System/Win32/Path.inc +++ b/llvm/lib/System/Win32/Path.inc @@ -358,8 +358,10 @@ Path::canExecute() const { } bool -Path::isSpecialFile() const { - return false; +Path::isRegularFile() const { + if (isDirectory()) + return false; + return true; } std::string |

