add a simple c_str() method to SmallString.
authorChris Lattner <sabre@nondot.org>
Sat, 19 Sep 2009 23:57:31 +0000 (23:57 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 19 Sep 2009 23:57:31 +0000 (23:57 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82337 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/ADT/SmallString.h

index c39d887c238e92a9b68d305787907a4f17b5eca5..035462515a83e96d1a1e5be3edb89ff80fc0e7a6 100644 (file)
@@ -38,6 +38,12 @@ public:
   // Extra methods.
   StringRef str() const { return StringRef(this->begin(), this->size()); }
 
+  const char *c_str() {
+    this->push_back(0);
+    this->pop_back();
+    return this->data();
+  }
+  
   // Extra operators.
   const SmallString &operator=(StringRef RHS) {
     this->clear();