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/tools/llvm-objcopy/Object.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/tools/llvm-objcopy/Object.cpp')
-rw-r--r-- | llvm/tools/llvm-objcopy/Object.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/tools/llvm-objcopy/Object.cpp b/llvm/tools/llvm-objcopy/Object.cpp index f9acf001ae9..f4c159cd1cb 100644 --- a/llvm/tools/llvm-objcopy/Object.cpp +++ b/llvm/tools/llvm-objcopy/Object.cpp @@ -428,15 +428,15 @@ void initRelocations(RelocationSection<ELFT> *Relocs, } } -SectionBase *SectionTableRef::getSection(uint16_t Index, Twine ErrMsg) { +SectionBase *SectionTableRef::getSection(uint16_t Index, const Twine &ErrMsg) { if (Index == SHN_UNDEF || Index > Sections.size()) error(ErrMsg); return Sections[Index - 1].get(); } template <class T> -T *SectionTableRef::getSectionOfType(uint16_t Index, Twine IndexErrMsg, - Twine TypeErrMsg) { +T *SectionTableRef::getSectionOfType(uint16_t Index, const Twine &IndexErrMsg, + const Twine &TypeErrMsg) { if (T *Sec = llvm::dyn_cast<T>(getSection(Index, IndexErrMsg))) return Sec; error(TypeErrMsg); |