[llvm-commits] [llvm] r79453 - /llvm/trunk/include/llvm/ADT/SmallString.h
Daniel Dunbar
daniel at zuster.org
Wed Aug 19 12:57:55 PDT 2009
Author: ddunbar
Date: Wed Aug 19 14:57:55 2009
New Revision: 79453
URL: http://llvm.org/viewvc/llvm-project?rev=79453&view=rev
Log:
Add SmallString::str (which returns a StringRef); this is more efficient than
c_str().
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=79453&r1=79452&r2=79453&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/SmallString.h (original)
+++ llvm/trunk/include/llvm/ADT/SmallString.h Wed Aug 19 14:57:55 2009
@@ -15,6 +15,7 @@
#define LLVM_ADT_SMALLSTRING_H
#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/StringRef.h"
#include "llvm/Support/DataTypes.h"
#include <cstring>
@@ -45,6 +46,8 @@
return this->begin();
}
+ StringRef str() const { return StringRef(this->begin(), this->size()); }
+
// Extra operators.
const SmallString &operator=(const char *RHS) {
this->clear();
More information about the llvm-commits
mailing list