diff options
author | Simon Pilgrim <llvm-dev@redking.me.uk> | 2021-10-05 18:34:02 +0100 |
---|---|---|
committer | Simon Pilgrim <llvm-dev@redking.me.uk> | 2021-10-05 18:42:12 +0100 |
commit | 2e5daac21731eb27ef952efaad31cac2a5d8f254 (patch) | |
tree | 257dfe763a27a5b01eb22be93c8e8603c53bd539 /llvm/lib/Object/Object.cpp | |
parent | 5bc32ad08d9a25b1a4fc4fe7daa4056d1d1ef67f (diff) | |
download | llvm-2e5daac21731eb27ef952efaad31cac2a5d8f254.zip llvm-2e5daac21731eb27ef952efaad31cac2a5d8f254.tar.gz llvm-2e5daac21731eb27ef952efaad31cac2a5d8f254.tar.bz2 |
[llvm] Update report_fatal_error calls from raw_string_ostream to use Twine(OS.str())
As described on D111049, we're trying to remove the <string> dependency from error handling and replace uses of report_fatal_error(const std::string&) with the Twine() variant which can be forward declared.
We can use the raw_string_ostream::str() method to perform the implicit flush() and return a reference to the std::string container that we can then wrap inside Twine().
Diffstat (limited to 'llvm/lib/Object/Object.cpp')
-rw-r--r-- | llvm/lib/Object/Object.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/llvm/lib/Object/Object.cpp b/llvm/lib/Object/Object.cpp index b486e9f..0659cf6 100644 --- a/llvm/lib/Object/Object.cpp +++ b/llvm/lib/Object/Object.cpp @@ -222,8 +222,7 @@ void LLVMMoveToContainingSection(LLVMSectionIteratorRef Sect, std::string Buf; raw_string_ostream OS(Buf); logAllUnhandledErrors(SecOrErr.takeError(), OS); - OS.flush(); - report_fatal_error(Buf); + report_fatal_error(Twine(OS.str())); } *unwrap(Sect) = *SecOrErr; } @@ -304,8 +303,7 @@ const char *LLVMGetSymbolName(LLVMSymbolIteratorRef SI) { std::string Buf; raw_string_ostream OS(Buf); logAllUnhandledErrors(Ret.takeError(), OS); - OS.flush(); - report_fatal_error(Buf); + report_fatal_error(Twine(OS.str())); } return Ret->data(); } @@ -316,8 +314,7 @@ uint64_t LLVMGetSymbolAddress(LLVMSymbolIteratorRef SI) { std::string Buf; raw_string_ostream OS(Buf); logAllUnhandledErrors(Ret.takeError(), OS); - OS.flush(); - report_fatal_error(Buf); + report_fatal_error(Twine(OS.str())); } return *Ret; } |