summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/Twine.cpp
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2017-10-11 23:33:06 +0000
committerZachary Turner <zturner@google.com>2017-10-11 23:33:06 +0000
commit337462b36512cc001891a98fb98fa5693651722f (patch)
tree4b1708ba51865a9a5611fe209082e9ace07e7a8d /llvm/lib/Support/Twine.cpp
parentd791eaa5594053918e517439469e7747bd52d91c (diff)
downloadbcm5719-llvm-337462b36512cc001891a98fb98fa5693651722f.tar.gz
bcm5719-llvm-337462b36512cc001891a98fb98fa5693651722f.zip
[ADT] Make Twine's copy constructor private.
There's a lot of misuse of Twine scattered around LLVM. This ranges in severity from benign (returning a Twine from a function by value that is just a string literal) to pretty sketchy (storing a Twine by value in a class). While there are some uses for copying Twines, most of the very compelling ones are confined to the Twine class implementation itself, and other uses are either dubious or easily worked around. This patch makes Twine's copy constructor private, and fixes up all callsites. Differential Revision: https://reviews.llvm.org/D38767 llvm-svn: 315530
Diffstat (limited to 'llvm/lib/Support/Twine.cpp')
-rw-r--r--llvm/lib/Support/Twine.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/llvm/lib/Support/Twine.cpp b/llvm/lib/Support/Twine.cpp
index d17cd4e6643..bf434f34e43 100644
--- a/llvm/lib/Support/Twine.cpp
+++ b/llvm/lib/Support/Twine.cpp
@@ -120,12 +120,10 @@ void Twine::printOneChildRepr(raw_ostream &OS, Child Ptr,
<< Ptr.cString << "\"";
break;
case Twine::StdStringKind:
- OS << "std::string:\""
- << Ptr.stdString << "\"";
+ OS << "std::string:\"" << *Ptr.stdString << "\"";
break;
case Twine::StringRefKind:
- OS << "stringref:\""
- << Ptr.stringRef << "\"";
+ OS << "stringref:\"" << *Ptr.stringRef << "\"";
break;
case Twine::SmallStringKind:
OS << "smallstring:\"" << *Ptr.smallString << "\"";
OpenPOWER on IntegriCloud