]> granicus.if.org Git - llvm/commit
[ADT] Make Twine's copy constructor private.
authorZachary Turner <zturner@google.com>
Wed, 11 Oct 2017 23:33:06 +0000 (23:33 +0000)
committerZachary Turner <zturner@google.com>
Wed, 11 Oct 2017 23:33:06 +0000 (23:33 +0000)
commitdc62a47c34a9bc82054e4e221c10c4592c89eea3
tree6f4d538c1a1a44160ff01391e15b2d1eb0b30005
parent3a5178e70a91ad23d2aa3c24a52eace3c61cab08
[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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315530 91177308-0d34-0410-b5e6-96231b3b80d8
17 files changed:
include/llvm/ADT/Twine.h
include/llvm/IR/DiagnosticInfo.h
include/llvm/Object/Error.h
include/llvm/Object/WindowsResource.h
include/llvm/Support/Error.h
include/llvm/Support/FormatVariadicDetails.h
lib/Object/Error.cpp
lib/Support/Error.cpp
lib/Support/Twine.cpp
lib/Transforms/Scalar/SROA.cpp
tools/llvm-nm/llvm-nm.cpp
tools/llvm-objcopy/Object.cpp
tools/llvm-objcopy/Object.h
tools/llvm-objcopy/llvm-objcopy.cpp
tools/llvm-objcopy/llvm-objcopy.h
unittests/ADT/TwineTest.cpp
utils/TableGen/RegisterBankEmitter.cpp