aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/ADT
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-08-19 19:57:55 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-08-19 19:57:55 +0000
commit0660c997d3f173eb2d9576a7218376ec12ec2b31 (patch)
treecd772b61d9be63e529fd2547b48659266e6415f5 /include/llvm/ADT
parenta8c318d6420e67211ee3dd6882f6ee586b36cfdb (diff)
downloadexternal_llvm-0660c997d3f173eb2d9576a7218376ec12ec2b31.zip
external_llvm-0660c997d3f173eb2d9576a7218376ec12ec2b31.tar.gz
external_llvm-0660c997d3f173eb2d9576a7218376ec12ec2b31.tar.bz2
Add SmallString::str (which returns a StringRef); this is more efficient than
c_str(). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79453 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/ADT')
-rw-r--r--include/llvm/ADT/SmallString.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/llvm/ADT/SmallString.h b/include/llvm/ADT/SmallString.h
index 7d3bff6..fe97807 100644
--- a/include/llvm/ADT/SmallString.h
+++ b/include/llvm/ADT/SmallString.h
@@ -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 @@ public:
return this->begin();
}
+ StringRef str() const { return StringRef(this->begin(), this->size()); }
+
// Extra operators.
const SmallString &operator=(const char *RHS) {
this->clear();