Revert "[ADT] Make Twine's copy constructor private."
This reverts commit 4e4ee1c507e2707bb3c208e1e1b6551c3015cbf5.
This is failing due to some code that isn't built on MSVC
so I didn't catch. Not immediately obvious how to fix this
at first glance, so I'm reverting for now.
llvm-svn: 315536
diff --git a/llvm/tools/llvm-objcopy/Object.cpp b/llvm/tools/llvm-objcopy/Object.cpp
index f4c159c..f9acf00 100644
--- a/llvm/tools/llvm-objcopy/Object.cpp
+++ b/llvm/tools/llvm-objcopy/Object.cpp
@@ -428,15 +428,15 @@
}
}
-SectionBase *SectionTableRef::getSection(uint16_t Index, const Twine &ErrMsg) {
+SectionBase *SectionTableRef::getSection(uint16_t Index, 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, const Twine &IndexErrMsg,
- const Twine &TypeErrMsg) {
+T *SectionTableRef::getSectionOfType(uint16_t Index, Twine IndexErrMsg,
+ Twine TypeErrMsg) {
if (T *Sec = llvm::dyn_cast<T>(getSection(Index, IndexErrMsg)))
return Sec;
error(TypeErrMsg);
diff --git a/llvm/tools/llvm-objcopy/Object.h b/llvm/tools/llvm-objcopy/Object.h
index d266912..f608843 100644
--- a/llvm/tools/llvm-objcopy/Object.h
+++ b/llvm/tools/llvm-objcopy/Object.h
@@ -29,11 +29,11 @@
: Sections(Secs) {}
SectionTableRef(const SectionTableRef &) = default;
- SectionBase *getSection(uint16_t Index, const llvm::Twine &ErrMsg);
+ SectionBase *getSection(uint16_t Index, llvm::Twine ErrMsg);
template <class T>
- T *getSectionOfType(uint16_t Index, const llvm::Twine &IndexErrMsg,
- const llvm::Twine &TypeErrMsg);
+ T *getSectionOfType(uint16_t Index, llvm::Twine IndexErrMsg,
+ llvm::Twine TypeErrMsg);
};
class SectionBase {
diff --git a/llvm/tools/llvm-objcopy/llvm-objcopy.cpp b/llvm/tools/llvm-objcopy/llvm-objcopy.cpp
index 9fc2897..7f55a43 100644
--- a/llvm/tools/llvm-objcopy/llvm-objcopy.cpp
+++ b/llvm/tools/llvm-objcopy/llvm-objcopy.cpp
@@ -27,7 +27,7 @@
namespace llvm {
-LLVM_ATTRIBUTE_NORETURN void error(const Twine &Message) {
+LLVM_ATTRIBUTE_NORETURN void error(Twine Message) {
errs() << ToolName << ": " << Message << ".\n";
errs().flush();
exit(1);
diff --git a/llvm/tools/llvm-objcopy/llvm-objcopy.h b/llvm/tools/llvm-objcopy/llvm-objcopy.h
index d30b43a..de7bf36 100644
--- a/llvm/tools/llvm-objcopy/llvm-objcopy.h
+++ b/llvm/tools/llvm-objcopy/llvm-objcopy.h
@@ -14,7 +14,7 @@
namespace llvm {
-LLVM_ATTRIBUTE_NORETURN extern void error(const Twine &Message);
+LLVM_ATTRIBUTE_NORETURN extern void error(Twine Message);
// This is taken from llvm-readobj.
// [see here](llvm/tools/llvm-readobj/llvm-readobj.h:38)