[llvm-commits] CVS: llvm/include/llvm/System/Path.h
Reid Spencer
reid at x10sys.com
Thu Mar 29 09:43:42 PDT 2007
Changes in directory llvm/include/llvm/System:
Path.h updated: 1.43 -> 1.44
---
Log message:
For PR789: http://llvm.org/PR789 :
* Add a method: bool isAbsolute() const, which determines if the path name
is absolute or not.
* Implement caching of file status information in the Path object. Allow it
to be updated forcefully or lazily re-fetched from the cached value.
---
Diffs of the changes: (+14 -4)
Path.h | 18 ++++++++++++++----
1 files changed, 14 insertions(+), 4 deletions(-)
Index: llvm/include/llvm/System/Path.h
diff -u llvm/include/llvm/System/Path.h:1.43 llvm/include/llvm/System/Path.h:1.44
--- llvm/include/llvm/System/Path.h:1.43 Sun Nov 5 13:31:28 2006
+++ llvm/include/llvm/System/Path.h Thu Mar 29 11:43:20 2007
@@ -123,7 +123,7 @@
/// Find the path to a library using its short name. Use the system
/// dependent library paths to locate the library.
/// @brief Find a library.
- static Path FindLibrary(std::string& short_name);
+ static Path FindLibrary(std::string& short_name);
/// Construct a path to the default LLVM configuration directory. The
/// implementation must ensure that this is a well-known (same on many
@@ -162,14 +162,14 @@
/// provided so that they can be used to indicate null or error results in
/// other lib/System functionality.
/// @brief Construct an empty (and invalid) path.
- Path() : path() {}
+ Path() : path(), status(0) {}
/// This constructor will accept a std::string as a path. No checking is
/// done on this path to determine if it is valid. To determine validity
/// of the path, use the isValid method.
/// @param p The path to assign.
/// @brief Construct a Path from a string.
- explicit Path(const std::string& p) : path(p) {}
+ explicit Path(const std::string& p) : path(p), status(0) {}
/// @}
/// @name Operators
@@ -265,6 +265,11 @@
/// @brief Determines if the path references the root directory.
bool isRootDirectory() const;
+ /// This function determines if the path name is absolute, as opposed to
+ /// relative.
+ /// @breif Determine if the path is absolute.
+ bool isAbsolute() const;
+
/// This function opens the file associated with the path name provided by
/// the Path object and reads its magic number. If the magic number at the
/// start of the file matches \p magic, true is returned. In all other
@@ -352,7 +357,11 @@
/// of the file system. This returns false on success, or true on error
/// and fills in the specified error string if specified.
/// @brief Get file status.
- bool getFileStatus(FileStatus &Status, std::string *Error = 0) const;
+ bool getFileStatus(
+ FileStatus &Status, ///< The resulting file status
+ bool forceUpdate = false, ///< Force an update from the file system
+ std::string *Error = 0 ///< Optional place to return an error msg.
+ ) const;
/// @}
/// @name Path Mutators
@@ -511,6 +520,7 @@
/// @{
private:
mutable std::string path; ///< Storage for the path name.
+ mutable FileStatus *status; ///< Status information.
/// @}
};
More information about the llvm-commits
mailing list