add a helper method to sys::Path for clang, patch by
authorChris Lattner <sabre@nondot.org>
Mon, 11 Aug 2008 23:39:47 +0000 (23:39 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 11 Aug 2008 23:39:47 +0000 (23:39 +0000)
Kovarththanan Rajaratnam!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54655 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/System/Path.h
lib/System/Unix/Path.inc
lib/System/Win32/Path.inc

index ac0c6cbca2e481785fee683e5d6f6fad0c4a7fd5..d28e11e545688089091d8c2ffdd8d4cb7c0d0592 100644 (file)
@@ -202,6 +202,12 @@ 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
index 73ccbfbbbf6aea44eae9f1853db77f5427e77936..cdb574fc01a1cf053d056f4584d33dbfc5cf56e3 100644 (file)
@@ -81,6 +81,12 @@ Path::Path(const std::string& p)
 Path::Path(const char *StrStart, unsigned StrLen)
   : path(StrStart, StrLen) {}
 
+Path&
+Path::operator=(const std::string &that) {
+  path = that;
+  return *this;
+}
+
 bool 
 Path::isValid() const {
   // Check some obvious things
index bb1252cfdd271029c72c918908e203054c78a45f..ff96e33dfad9ebb1e1538e08fc938c5299b46d2b 100644 (file)
@@ -56,6 +56,13 @@ Path::Path(const char *StrStart, unsigned StrLen)
   FlipBackSlashes(path);
 }
 
+Path&
+Path::operator=(const std::string &that) {
+  path = that;
+  FlipBackSlashes(path);
+  return *this;
+}
+
 bool
 Path::isValid() const {
   if (path.empty())