[llvm-commits] [llvm] r82337 - /llvm/trunk/include/llvm/ADT/SmallString.h
Chris Lattner
sabre at nondot.org
Sat Sep 19 16:57:31 PDT 2009
Author: lattner
Date: Sat Sep 19 18:57:31 2009
New Revision: 82337
URL: http://llvm.org/viewvc/llvm-project?rev=82337&view=rev
Log:
add a simple c_str() method to SmallString.
Modified:
llvm/trunk/include/llvm/ADT/SmallString.h
Modified: llvm/trunk/include/llvm/ADT/SmallString.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SmallString.h?rev=82337&r1=82336&r2=82337&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/SmallString.h (original)
+++ llvm/trunk/include/llvm/ADT/SmallString.h Sat Sep 19 18:57:31 2009
@@ -38,6 +38,12 @@
// 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();
More information about the llvm-commits
mailing list