summaryrefslogtreecommitdiffstats
path: root/llvm/tools/gold/gold-plugin.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/tools/gold/gold-plugin.cpp')
-rw-r--r--llvm/tools/gold/gold-plugin.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/llvm/tools/gold/gold-plugin.cpp b/llvm/tools/gold/gold-plugin.cpp
index 8ca2628e85a..55151e0352b 100644
--- a/llvm/tools/gold/gold-plugin.cpp
+++ b/llvm/tools/gold/gold-plugin.cpp
@@ -775,9 +775,9 @@ static ld_plugin_status allSymbolsReadHook(raw_fd_ostream *ApiFile) {
else
path = output_name + ".bc";
{
- std::string Error;
- raw_fd_ostream OS(path.c_str(), Error, sys::fs::OpenFlags::F_None);
- if (!Error.empty())
+ std::error_code EC;
+ raw_fd_ostream OS(path, EC, sys::fs::OpenFlags::F_None);
+ if (EC)
message(LDPL_FATAL, "Failed to write the output file.");
WriteBitcodeToFile(L.getModule(), OS);
}
@@ -799,11 +799,11 @@ static ld_plugin_status all_symbols_read_hook(void) {
if (!options::generate_api_file) {
Ret = allSymbolsReadHook(nullptr);
} else {
- std::string Error;
- raw_fd_ostream ApiFile("apifile.txt", Error, sys::fs::F_None);
- if (!Error.empty())
+ std::error_code EC;
+ raw_fd_ostream ApiFile("apifile.txt", EC, sys::fs::F_None);
+ if (EC)
message(LDPL_FATAL, "Unable to open apifile.txt for writing: %s",
- Error.c_str());
+ EC.message().c_str());
Ret = allSymbolsReadHook(&ApiFile);
}
OpenPOWER on IntegriCloud