Support/ADT: Move c_str() from SmallString to SmallVectorImpl. The Windows PathV2
authorMichael J. Spencer <bigcheesegs@gmail.com>
Mon, 6 Dec 2010 04:27:42 +0000 (04:27 +0000)
committerMichael J. Spencer <bigcheesegs@gmail.com>
Mon, 6 Dec 2010 04:27:42 +0000 (04:27 +0000)
implementation needs it for wchar_t and SmallVectorImpl in general.

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

include/llvm/ADT/SmallString.h
include/llvm/ADT/SmallVector.h

index 05bd8a42c67f650c967e3212298deb3dda111b9a..7328560822194b3d1504b060104874609a1a140f 100644 (file)
@@ -41,12 +41,6 @@ public:
   // Implicit conversion to StringRef.
   operator StringRef() const { return str(); }
 
-  const char *c_str() {
-    this->push_back(0);
-    this->pop_back();
-    return this->data();
-  }
-
   // Extra operators.
   const SmallString &operator=(StringRef RHS) {
     this->clear();
index 0c9f7eb6345944a9b6414aa335a08912048a644f..123b85daff84f178fa0409553a8e82656da0f4d9 100644 (file)
@@ -340,6 +340,12 @@ public:
     return Result;
   }
 
+  // TODO: Make this const, if it's safe...
+  typename SuperClass::const_pointer c_str() {
+    push_back(0);
+    pop_back();
+    return this->data();
+  }
 
   void swap(SmallVectorImpl &RHS);