summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-11-21 02:01:24 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-11-21 02:01:24 +0000
commit983c7fe847dd3f46945f0117ab19345b9c68e88f (patch)
tree6d5d8d5b0db0165db5608245ecddff0a7eebc95b /include
parent80bf1d52789d84d774f903a1991bd62639ff9464 (diff)
downloadllvm-983c7fe847dd3f46945f0117ab19345b9c68e88f.tar.gz
llvm-983c7fe847dd3f46945f0117ab19345b9c68e88f.tar.bz2
llvm-983c7fe847dd3f46945f0117ab19345b9c68e88f.tar.xz
Allow SmallString to implicitly convert to StringRef.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89529 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/ADT/SmallString.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/include/llvm/ADT/SmallString.h b/include/llvm/ADT/SmallString.h
index 035462515a..05bd8a42c6 100644
--- a/include/llvm/ADT/SmallString.h
+++ b/include/llvm/ADT/SmallString.h
@@ -38,12 +38,15 @@ public:
// Extra methods.
StringRef str() const { return StringRef(this->begin(), this->size()); }
+ // 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();