diff options
author | Zachary Turner <zturner@google.com> | 2017-10-11 23:33:06 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2017-10-11 23:33:06 +0000 |
commit | 337462b36512cc001891a98fb98fa5693651722f (patch) | |
tree | 4b1708ba51865a9a5611fe209082e9ace07e7a8d /llvm/lib/Object/Error.cpp | |
parent | d791eaa5594053918e517439469e7747bd52d91c (diff) | |
download | bcm5719-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/Object/Error.cpp')
-rw-r--r-- | llvm/lib/Object/Error.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Object/Error.cpp b/llvm/lib/Object/Error.cpp index 7d43a84f3e0..d4ab9163886 100644 --- a/llvm/lib/Object/Error.cpp +++ b/llvm/lib/Object/Error.cpp @@ -60,9 +60,10 @@ std::string _object_error_category::message(int EV) const { char BinaryError::ID = 0; char GenericBinaryError::ID = 0; -GenericBinaryError::GenericBinaryError(Twine Msg) : Msg(Msg.str()) {} +GenericBinaryError::GenericBinaryError(const Twine &Msg) : Msg(Msg.str()) {} -GenericBinaryError::GenericBinaryError(Twine Msg, object_error ECOverride) +GenericBinaryError::GenericBinaryError(const Twine &Msg, + object_error ECOverride) : Msg(Msg.str()) { setErrorCode(make_error_code(ECOverride)); } |