mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 04:30:23 +00:00
Use raw_fd_ostream instead of std::ofstream.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212483 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
7b4a688246
commit
b6b12e59a2
@ -28,7 +28,6 @@
|
|||||||
#include <cerrno>
|
#include <cerrno>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <fstream>
|
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <plugin-api.h>
|
#include <plugin-api.h>
|
||||||
#include <system_error>
|
#include <system_error>
|
||||||
@ -410,15 +409,17 @@ static bool mustPreserve(const claimed_file &F, int i) {
|
|||||||
/// been overridden by a native object file. Then, perform optimization and
|
/// been overridden by a native object file. Then, perform optimization and
|
||||||
/// codegen.
|
/// codegen.
|
||||||
static ld_plugin_status all_symbols_read_hook(void) {
|
static ld_plugin_status all_symbols_read_hook(void) {
|
||||||
std::ofstream api_file;
|
// FIXME: raw_fd_ostream should be able to represent an unopened file.
|
||||||
|
std::unique_ptr<raw_fd_ostream> api_file;
|
||||||
|
|
||||||
assert(CodeGen);
|
assert(CodeGen);
|
||||||
|
|
||||||
if (options::generate_api_file) {
|
if (options::generate_api_file) {
|
||||||
api_file.open("apifile.txt", std::ofstream::out | std::ofstream::trunc);
|
std::string Error;
|
||||||
if (!api_file.is_open()) {
|
api_file.reset(new raw_fd_ostream("apifile.txt", Error, sys::fs::F_None));
|
||||||
(*message)(LDPL_FATAL, "Unable to open apifile.txt for writing.");
|
if (!Error.empty())
|
||||||
abort();
|
(*message)(LDPL_FATAL, "Unable to open apifile.txt for writing: %s",
|
||||||
}
|
Error.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
for (std::list<claimed_file>::iterator I = Modules.begin(),
|
for (std::list<claimed_file>::iterator I = Modules.begin(),
|
||||||
@ -431,14 +432,11 @@ static ld_plugin_status all_symbols_read_hook(void) {
|
|||||||
CodeGen->addMustPreserveSymbol(I->syms[i].name);
|
CodeGen->addMustPreserveSymbol(I->syms[i].name);
|
||||||
|
|
||||||
if (options::generate_api_file)
|
if (options::generate_api_file)
|
||||||
api_file << I->syms[i].name << "\n";
|
(*api_file) << I->syms[i].name << "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options::generate_api_file)
|
|
||||||
api_file.close();
|
|
||||||
|
|
||||||
CodeGen->setCodePICModel(output_type);
|
CodeGen->setCodePICModel(output_type);
|
||||||
CodeGen->setDebugInfo(LTO_DEBUG_MODEL_DWARF);
|
CodeGen->setDebugInfo(LTO_DEBUG_MODEL_DWARF);
|
||||||
if (!options::mcpu.empty())
|
if (!options::mcpu.empty())
|
||||||
|
Loading…
Reference in New Issue
Block a user