projects
/
oota-llvm.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Move a bunch of methods from CallSite to CallSiteBase, so that they can
[oota-llvm.git]
/
lib
/
Support
/
Twine.cpp
diff --git
a/lib/Support/Twine.cpp
b/lib/Support/Twine.cpp
index 94464ffe4f0e96d93303d4d010f4e5afe6f4ac61..21504e964ea93404f8e2e32f4c5c834660d96d6b 100644
(file)
--- a/
lib/Support/Twine.cpp
+++ b/
lib/Support/Twine.cpp
@@
-15,8
+15,7
@@
using namespace llvm;
std::string Twine::str() const {
SmallString<256> Vec;
std::string Twine::str() const {
SmallString<256> Vec;
- toVector(Vec);
- return std::string(Vec.begin(), Vec.end());
+ return toStringRef(Vec).str();
}
void Twine::toVector(SmallVectorImpl<char> &Out) const {
}
void Twine::toVector(SmallVectorImpl<char> &Out) const {
@@
-24,6
+23,13
@@
void Twine::toVector(SmallVectorImpl<char> &Out) const {
print(OS);
}
print(OS);
}
+StringRef Twine::toStringRef(SmallVectorImpl<char> &Out) const {
+ if (isSingleStringRef())
+ return getSingleStringRef();
+ toVector(Out);
+ return StringRef(Out.data(), Out.size());
+}
+
void Twine::printOneChild(raw_ostream &OS, const void *Ptr,
NodeKind Kind) const {
switch (Kind) {
void Twine::printOneChild(raw_ostream &OS, const void *Ptr,
NodeKind Kind) const {
switch (Kind) {