From b6e9fa5e101e226cd6174e378d31a18995e9b02c Mon Sep 17 00:00:00 2001 From: Filipe Cabecinhas Date: Tue, 3 Nov 2015 13:48:21 +0000 Subject: [PATCH] Don't use Twine objects after their lifetimes end. No test, since it would depend on what the compiler can optimize/reuse. My next commit made this bug visible on Linux Release compiles with some versions of gcc. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251909 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Bitcode/Reader/BitcodeReader.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/Bitcode/Reader/BitcodeReader.cpp b/lib/Bitcode/Reader/BitcodeReader.cpp index 4b8b554b252..74a5553ce6e 100644 --- a/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/lib/Bitcode/Reader/BitcodeReader.cpp @@ -526,19 +526,19 @@ static std::error_code error(DiagnosticHandlerFunction DiagnosticHandler, std::error_code BitcodeReader::error(BitcodeError E, const Twine &Message) { if (!ProducerIdentification.empty()) { - Twine MsgWithID = Message + " (Producer: '" + ProducerIdentification + - "' Reader: 'LLVM " + LLVM_VERSION_STRING "')"; - return ::error(DiagnosticHandler, make_error_code(E), MsgWithID); + return ::error(DiagnosticHandler, make_error_code(E), + Message + " (Producer: '" + ProducerIdentification + + "' Reader: 'LLVM " + LLVM_VERSION_STRING "')"); } return ::error(DiagnosticHandler, make_error_code(E), Message); } std::error_code BitcodeReader::error(const Twine &Message) { if (!ProducerIdentification.empty()) { - Twine MsgWithID = Message + " (Producer: '" + ProducerIdentification + - "' Reader: 'LLVM " + LLVM_VERSION_STRING "')"; return ::error(DiagnosticHandler, - make_error_code(BitcodeError::CorruptedBitcode), MsgWithID); + make_error_code(BitcodeError::CorruptedBitcode), + Message + " (Producer: '" + ProducerIdentification + + "' Reader: 'LLVM " + LLVM_VERSION_STRING "')"); } return ::error(DiagnosticHandler, make_error_code(BitcodeError::CorruptedBitcode), Message); -- 2.34.1