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
This commit is contained in:
Filipe Cabecinhas 2015-11-03 13:48:21 +00:00
parent de212f1589
commit f3e167af4b
1 changed files with 6 additions and 6 deletions

View File

@ -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);