[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)
commit337462b36512cc001891a98fb98fa5693651722f
tree4b1708ba51865a9a5611fe209082e9ace07e7a8d
parentd791eaa5594053918e517439469e7747bd52d91c
[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
24 files changed:
clang/include/clang/Tooling/CompilationDatabase.h
clang/lib/CodeGen/CGObjCMac.cpp
clang/lib/CodeGen/CodeGenAction.cpp
clang/lib/Driver/ToolChains/MSVC.cpp
clang/lib/Driver/ToolChains/MinGW.cpp
clang/lib/Tooling/CompilationDatabase.cpp
clang/unittests/Tooling/TestVisitor.h
llvm/include/llvm/ADT/Twine.h
llvm/include/llvm/IR/DiagnosticInfo.h
llvm/include/llvm/Object/Error.h
llvm/include/llvm/Object/WindowsResource.h
llvm/include/llvm/Support/Error.h
llvm/include/llvm/Support/FormatVariadicDetails.h
llvm/lib/Object/Error.cpp
llvm/lib/Support/Error.cpp
llvm/lib/Support/Twine.cpp
llvm/lib/Transforms/Scalar/SROA.cpp
llvm/tools/llvm-nm/llvm-nm.cpp
llvm/tools/llvm-objcopy/Object.cpp
llvm/tools/llvm-objcopy/Object.h
llvm/tools/llvm-objcopy/llvm-objcopy.cpp
llvm/tools/llvm-objcopy/llvm-objcopy.h
llvm/unittests/ADT/TwineTest.cpp
llvm/utils/TableGen/RegisterBankEmitter.cpp