From f3e167af4b714487982208cb4b94218cdfbb75c1 Mon Sep 17 00:00:00 2001 From: Filipe Cabecinhas Date: Tue, 3 Nov 2015 13:48:21 +0000 Subject: 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. llvm-svn: 251909 --- llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp') diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index 4b8b554..74a5553 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/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); -- cgit v1.1