[llvm-commits] [llvm] r89848 - in /llvm/trunk: include/llvm/System/Path.h lib/System/Unix/Path.inc lib/System/Win32/Path.inc
Edward O'Callaghan
eocallaghan at auroraux.org
Tue Nov 24 22:32:20 PST 2009
Author: evocallaghan
Date: Wed Nov 25 00:32:19 2009
New Revision: 89848
URL: http://llvm.org/viewvc/llvm-project?rev=89848&view=rev
Log:
API change Path::isSpecialFile to Path::isRegularFile, improve semantics in regards to comments from 89765 post review.
Modified:
llvm/trunk/include/llvm/System/Path.h
llvm/trunk/lib/System/Unix/Path.inc
llvm/trunk/lib/System/Win32/Path.inc
Modified: llvm/trunk/include/llvm/System/Path.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/System/Path.h?rev=89848&r1=89847&r2=89848&view=diff
==============================================================================
--- llvm/trunk/include/llvm/System/Path.h (original)
+++ llvm/trunk/include/llvm/System/Path.h Wed Nov 25 00:32:19 2009
@@ -380,10 +380,12 @@
/// 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
Modified: llvm/trunk/lib/System/Unix/Path.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Unix/Path.inc?rev=89848&r1=89847&r2=89848&view=diff
==============================================================================
--- llvm/trunk/lib/System/Unix/Path.inc (original)
+++ llvm/trunk/lib/System/Unix/Path.inc Wed Nov 25 00:32:19 2009
@@ -454,17 +454,17 @@
}
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
Modified: llvm/trunk/lib/System/Win32/Path.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Win32/Path.inc?rev=89848&r1=89847&r2=89848&view=diff
==============================================================================
--- llvm/trunk/lib/System/Win32/Path.inc (original)
+++ llvm/trunk/lib/System/Win32/Path.inc Wed Nov 25 00:32:19 2009
@@ -358,8 +358,10 @@
}
bool
-Path::isSpecialFile() const {
- return false;
+Path::isRegularFile() const {
+ if (isDirectory())
+ return false;
+ return true;
}
std::string
More information about the llvm-commits
mailing list