[llvm-commits] [llvm] r123209 - in /llvm/trunk: include/llvm/Support/PathV1.h lib/Support/PathV2.cpp lib/Support/Unix/Path.inc lib/Support/Windows/Path.inc
Michael J. Spencer
bigcheesegs at gmail.com
Mon Jan 10 17:21:55 PST 2011
Author: mspencer
Date: Mon Jan 10 19:21:55 2011
New Revision: 123209
URL: http://llvm.org/viewvc/llvm-project?rev=123209&view=rev
Log:
Support/Path: Deprecate PathV1::isDirectory and replace all uses with PathV2::is_directory.
Modified:
llvm/trunk/include/llvm/Support/PathV1.h
llvm/trunk/lib/Support/PathV2.cpp
llvm/trunk/lib/Support/Unix/Path.inc
llvm/trunk/lib/Support/Windows/Path.inc
Modified: llvm/trunk/include/llvm/Support/PathV1.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/PathV1.h?rev=123209&r1=123208&r2=123209&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/PathV1.h (original)
+++ llvm/trunk/include/llvm/Support/PathV1.h Mon Jan 10 19:21:55 2011
@@ -387,7 +387,8 @@
/// existing directory.
/// @returns true if the pathname references an existing directory.
/// @brief Determines if the path is a directory in the file system.
- bool isDirectory() const;
+ LLVM_ATTRIBUTE_DEPRECATED(bool isDirectory() const,
+ LLVM_PATH_DEPRECATED_MSG(fs::is_directory));
/// This function determines if the path name references an
/// existing symbolic link.
Modified: llvm/trunk/lib/Support/PathV2.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/PathV2.cpp?rev=123209&r1=123208&r2=123209&view=diff
==============================================================================
--- llvm/trunk/lib/Support/PathV2.cpp (original)
+++ llvm/trunk/lib/Support/PathV2.cpp Mon Jan 10 19:21:55 2011
@@ -636,10 +636,26 @@
return status.type() == file_type::directory_file;
}
+error_code is_directory(const Twine &path, bool &result) {
+ file_status st;
+ if (error_code ec = status(path, st))
+ return ec;
+ result = is_directory(st);
+ return success;
+}
+
bool is_regular_file(file_status status) {
return status.type() == file_type::regular_file;
}
+error_code is_regular_file(const Twine &path, bool &result) {
+ file_status st;
+ if (error_code ec = status(path, st))
+ return ec;
+ result = is_regular_file(st);
+ return success;
+}
+
bool is_symlink(file_status status) {
return status.type() == file_type::symlink_file;
}
Modified: llvm/trunk/lib/Support/Unix/Path.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Unix/Path.inc?rev=123209&r1=123208&r2=123209&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Unix/Path.inc (original)
+++ llvm/trunk/lib/Support/Unix/Path.inc Mon Jan 10 19:21:55 2011
@@ -823,7 +823,8 @@
Buf.resize(path.size()+8);
char *FNBuffer = &Buf[0];
path.copy(FNBuffer,path.size());
- if (isDirectory())
+ bool isdir;
+ if (!fs::is_directory(path, isdir) && isdir)
strcpy(FNBuffer+path.size(), "/XXXXXX");
else
strcpy(FNBuffer+path.size(), "-XXXXXX");
Modified: llvm/trunk/lib/Support/Windows/Path.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Windows/Path.inc?rev=123209&r1=123208&r2=123209&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Windows/Path.inc (original)
+++ llvm/trunk/lib/Support/Windows/Path.inc Mon Jan 10 19:21:55 2011
@@ -410,9 +410,10 @@
bool
Path::isRegularFile() const {
- if (isDirectory())
+ bool res;
+ if (fs::is_regular_file(path, res))
return false;
- return true;
+ return res;
}
StringRef
More information about the llvm-commits
mailing list