Add PrefixPrinter arguments to the dump routines for MachineFunction and
[oota-llvm.git] / include / llvm / System / Path.h
index ba251a9dbbc825d5266b0463f99eb2a78098dc4e..8b603f5ad42c5d5f5d6c5f38f4ec1704daf46482 100644 (file)
@@ -15,6 +15,7 @@
 #define LLVM_SYSTEM_PATH_H
 
 #include "llvm/System/TimeValue.h"
+#include "llvm/Support/raw_ostream.h"
 #include <set>
 #include <string>
 #include <vector>
@@ -202,19 +203,21 @@ namespace sys {
         return *this;
       }
 
+      /// Makes a copy of \p that to \p this.
+      /// @param \p that A std::string denoting the path
+      /// @returns \p this
+      /// @brief Assignment Operator
+      Path &operator=(const std::string &that);
+
       /// Compares \p this Path with \p that Path for equality.
       /// @returns true if \p this and \p that refer to the same thing.
       /// @brief Equality Operator
-      bool operator==(const Path &that) const {
-        return path == that.path;
-      }
+      bool operator==(const Path &that) const;
 
       /// Compares \p this Path with \p that Path for inequality.
       /// @returns true if \p this and \p that refer to different things.
       /// @brief Inequality Operator
-      bool operator!=(const Path &that) const {
-        return path != that.path;
-      }
+      bool operator!=(const Path &that) const;
 
       /// Determines if \p this Path is less than \p that Path. This is required
       /// so that Path objects can be placed into ordered collections (e.g.
@@ -222,9 +225,7 @@ namespace sys {
       /// the std::string::compare method.
       /// @returns true if \p this path is lexicographically less than \p that.
       /// @brief Less Than Operator
-      bool operator<(const Path& that) const {
-        return path < that.path;
-      }
+      bool operator<(const Path& that) const;
 
     /// @}
     /// @name Path Accessors
@@ -309,6 +310,11 @@ namespace sys {
       /// @brief Determine if the path is absolute.
       bool isAbsolute() const;
 
+      /// This function determines if the path name is absolute, as opposed to
+      /// relative.
+      /// @brief Determine if the path is absolute.
+      static bool isAbsolute(const char *NameStart, unsigned NameLen);
+
       /// 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
@@ -459,6 +465,10 @@ namespace sys {
       /// @brief Make the current path name unique in the file system.
       bool makeUnique( bool reuse_current /*= true*/, std::string* ErrMsg );
 
+      /// The current Path name is made absolute by prepending the
+      /// current working directory if necessary.
+      void makeAbsolute();
+
     /// @}
     /// @name Disk Mutators
     /// @{
@@ -705,6 +715,17 @@ namespace sys {
   extern const char PathSeparator;
 }
 
+inline raw_ostream& operator<<(raw_ostream& strm, const sys::Path& aPath) {
+  strm << aPath.toString();
+  return strm;
+}
+
+inline raw_ostream& operator<<(raw_ostream& strm,
+                               const sys::PathWithStatus& aPath) {
+  strm << static_cast<const sys::Path&>(aPath);
+  return strm;
+}
+
 std::ostream& operator<<(std::ostream& strm, const sys::Path& aPath);
 inline std::ostream& operator<<(std::ostream& strm,
                                 const sys::PathWithStatus& aPath) {