aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Object/Object.cpp
diff options
context:
space:
mode:
authorSimon Pilgrim <llvm-dev@redking.me.uk>2021-10-05 18:34:02 +0100
committerSimon Pilgrim <llvm-dev@redking.me.uk>2021-10-05 18:42:12 +0100
commit2e5daac21731eb27ef952efaad31cac2a5d8f254 (patch)
tree257dfe763a27a5b01eb22be93c8e8603c53bd539 /llvm/lib/Object/Object.cpp
parent5bc32ad08d9a25b1a4fc4fe7daa4056d1d1ef67f (diff)
downloadllvm-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.cpp9
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;
}