mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 04:30:23 +00:00
Use function pointers with just f(1,2) instead of (*f)(1,2).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214265 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
f8b862d87c
commit
601bb093ef
@ -100,8 +100,9 @@ namespace options {
|
|||||||
llvm::StringRef path = opt.substr(strlen("also-emit-llvm="));
|
llvm::StringRef path = opt.substr(strlen("also-emit-llvm="));
|
||||||
generate_bc_file = BC_ALSO;
|
generate_bc_file = BC_ALSO;
|
||||||
if (!bc_path.empty()) {
|
if (!bc_path.empty()) {
|
||||||
(*message)(LDPL_WARNING, "Path to the output IL file specified twice. "
|
message(LDPL_WARNING, "Path to the output IL file specified twice. "
|
||||||
"Discarding %s", opt_);
|
"Discarding %s",
|
||||||
|
opt_);
|
||||||
} else {
|
} else {
|
||||||
bc_path = path;
|
bc_path = path;
|
||||||
}
|
}
|
||||||
@ -150,8 +151,7 @@ ld_plugin_status onload(ld_plugin_tv *tv) {
|
|||||||
output_type = LTO_CODEGEN_PIC_MODEL_STATIC;
|
output_type = LTO_CODEGEN_PIC_MODEL_STATIC;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
(*message)(LDPL_ERROR, "Unknown output file type %d",
|
message(LDPL_ERROR, "Unknown output file type %d", tv->tv_u.tv_val);
|
||||||
tv->tv_u.tv_val);
|
|
||||||
return LDPS_ERR;
|
return LDPS_ERR;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -207,11 +207,11 @@ ld_plugin_status onload(ld_plugin_tv *tv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!registeredClaimFile) {
|
if (!registeredClaimFile) {
|
||||||
(*message)(LDPL_ERROR, "register_claim_file not passed to LLVMgold.");
|
message(LDPL_ERROR, "register_claim_file not passed to LLVMgold.");
|
||||||
return LDPS_ERR;
|
return LDPS_ERR;
|
||||||
}
|
}
|
||||||
if (!add_symbols) {
|
if (!add_symbols) {
|
||||||
(*message)(LDPL_ERROR, "add_symbols not passed to LLVMgold.");
|
message(LDPL_ERROR, "add_symbols not passed to LLVMgold.");
|
||||||
return LDPS_ERR;
|
return LDPS_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -252,7 +252,7 @@ static ld_plugin_status claim_file_hook(const ld_plugin_input_file *file,
|
|||||||
std::unique_ptr<MemoryBuffer> buffer;
|
std::unique_ptr<MemoryBuffer> buffer;
|
||||||
if (get_view) {
|
if (get_view) {
|
||||||
if (get_view(file->handle, &view) != LDPS_OK) {
|
if (get_view(file->handle, &view) != LDPS_OK) {
|
||||||
(*message)(LDPL_ERROR, "Failed to get a view of %s", file->name);
|
message(LDPL_ERROR, "Failed to get a view of %s", file->name);
|
||||||
return LDPS_ERR;
|
return LDPS_ERR;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -266,7 +266,7 @@ static ld_plugin_status claim_file_hook(const ld_plugin_input_file *file,
|
|||||||
MemoryBuffer::getOpenFileSlice(file->fd, file->name, file->filesize,
|
MemoryBuffer::getOpenFileSlice(file->fd, file->name, file->filesize,
|
||||||
offset);
|
offset);
|
||||||
if (std::error_code EC = BufferOrErr.getError()) {
|
if (std::error_code EC = BufferOrErr.getError()) {
|
||||||
(*message)(LDPL_ERROR, EC.message().c_str());
|
message(LDPL_ERROR, EC.message().c_str());
|
||||||
return LDPS_ERR;
|
return LDPS_ERR;
|
||||||
}
|
}
|
||||||
buffer = std::move(BufferOrErr.get());
|
buffer = std::move(BufferOrErr.get());
|
||||||
@ -282,8 +282,7 @@ static ld_plugin_status claim_file_hook(const ld_plugin_input_file *file,
|
|||||||
LTOModule *M =
|
LTOModule *M =
|
||||||
LTOModule::createFromBuffer(view, file->filesize, TargetOpts, Error);
|
LTOModule::createFromBuffer(view, file->filesize, TargetOpts, Error);
|
||||||
if (!M) {
|
if (!M) {
|
||||||
(*message)(LDPL_ERROR,
|
message(LDPL_ERROR, "LLVM gold plugin has failed to create LTO module: %s",
|
||||||
"LLVM gold plugin has failed to create LTO module: %s",
|
|
||||||
Error.c_str());
|
Error.c_str());
|
||||||
return LDPS_ERR;
|
return LDPS_ERR;
|
||||||
}
|
}
|
||||||
@ -325,7 +324,7 @@ static ld_plugin_status claim_file_hook(const ld_plugin_input_file *file,
|
|||||||
sym.visibility = LDPV_DEFAULT;
|
sym.visibility = LDPV_DEFAULT;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
(*message)(LDPL_ERROR, "Unknown scope attribute: %d", scope);
|
message(LDPL_ERROR, "Unknown scope attribute: %d", scope);
|
||||||
return LDPS_ERR;
|
return LDPS_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -349,7 +348,7 @@ static ld_plugin_status claim_file_hook(const ld_plugin_input_file *file,
|
|||||||
sym.def = LDPK_WEAKUNDEF;
|
sym.def = LDPK_WEAKUNDEF;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
(*message)(LDPL_ERROR, "Unknown definition attribute: %d", definition);
|
message(LDPL_ERROR, "Unknown definition attribute: %d", definition);
|
||||||
return LDPS_ERR;
|
return LDPS_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -361,8 +360,8 @@ static ld_plugin_status claim_file_hook(const ld_plugin_input_file *file,
|
|||||||
cf.syms.reserve(cf.syms.size());
|
cf.syms.reserve(cf.syms.size());
|
||||||
|
|
||||||
if (!cf.syms.empty()) {
|
if (!cf.syms.empty()) {
|
||||||
if ((*add_symbols)(cf.handle, cf.syms.size(), &cf.syms[0]) != LDPS_OK) {
|
if (add_symbols(cf.handle, cf.syms.size(), &cf.syms[0]) != LDPS_OK) {
|
||||||
(*message)(LDPL_ERROR, "Unable to add symbols!");
|
message(LDPL_ERROR, "Unable to add symbols!");
|
||||||
return LDPS_ERR;
|
return LDPS_ERR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -370,7 +369,7 @@ static ld_plugin_status claim_file_hook(const ld_plugin_input_file *file,
|
|||||||
if (CodeGen) {
|
if (CodeGen) {
|
||||||
std::string Error;
|
std::string Error;
|
||||||
if (!CodeGen->addModule(M, Error)) {
|
if (!CodeGen->addModule(M, Error)) {
|
||||||
(*message)(LDPL_ERROR, "Error linking module: %s", Error.c_str());
|
message(LDPL_ERROR, "Error linking module: %s", Error.c_str());
|
||||||
return LDPS_ERR;
|
return LDPS_ERR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -402,7 +401,7 @@ static ld_plugin_status all_symbols_read_hook(void) {
|
|||||||
std::string Error;
|
std::string Error;
|
||||||
api_file.reset(new raw_fd_ostream("apifile.txt", Error, sys::fs::F_None));
|
api_file.reset(new raw_fd_ostream("apifile.txt", Error, sys::fs::F_None));
|
||||||
if (!Error.empty())
|
if (!Error.empty())
|
||||||
(*message)(LDPL_FATAL, "Unable to open apifile.txt for writing: %s",
|
message(LDPL_FATAL, "Unable to open apifile.txt for writing: %s",
|
||||||
Error.c_str());
|
Error.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -410,7 +409,7 @@ static ld_plugin_status all_symbols_read_hook(void) {
|
|||||||
E = Modules.end(); I != E; ++I) {
|
E = Modules.end(); I != E; ++I) {
|
||||||
if (I->syms.empty())
|
if (I->syms.empty())
|
||||||
continue;
|
continue;
|
||||||
(*get_symbols)(I->handle, I->syms.size(), &I->syms[0]);
|
get_symbols(I->handle, I->syms.size(), &I->syms[0]);
|
||||||
for (unsigned i = 0, e = I->syms.size(); i != e; i++) {
|
for (unsigned i = 0, e = I->syms.size(); i != e; i++) {
|
||||||
if (mustPreserve(*I, i)) {
|
if (mustPreserve(*I, i)) {
|
||||||
CodeGen->addMustPreserveSymbol(I->syms[i].name);
|
CodeGen->addMustPreserveSymbol(I->syms[i].name);
|
||||||
@ -436,7 +435,7 @@ static ld_plugin_status all_symbols_read_hook(void) {
|
|||||||
path = output_name + ".bc";
|
path = output_name + ".bc";
|
||||||
std::string Error;
|
std::string Error;
|
||||||
if (!CodeGen->writeMergedModules(path.c_str(), Error))
|
if (!CodeGen->writeMergedModules(path.c_str(), Error))
|
||||||
(*message)(LDPL_FATAL, "Failed to write the output file.");
|
message(LDPL_FATAL, "Failed to write the output file.");
|
||||||
if (options::generate_bc_file == options::BC_ONLY) {
|
if (options::generate_bc_file == options::BC_ONLY) {
|
||||||
delete CodeGen;
|
delete CodeGen;
|
||||||
exit(0);
|
exit(0);
|
||||||
@ -449,7 +448,7 @@ static ld_plugin_status all_symbols_read_hook(void) {
|
|||||||
std::string Error;
|
std::string Error;
|
||||||
if (!CodeGen->compile_to_file(&Temp, /*DisableOpt*/ false, /*DisableInline*/
|
if (!CodeGen->compile_to_file(&Temp, /*DisableOpt*/ false, /*DisableInline*/
|
||||||
false, /*DisableGVNLoadPRE*/ false, Error))
|
false, /*DisableGVNLoadPRE*/ false, Error))
|
||||||
(*message)(LDPL_ERROR, "Could not produce a combined object file\n");
|
message(LDPL_ERROR, "Could not produce a combined object file\n");
|
||||||
ObjPath = Temp;
|
ObjPath = Temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -462,15 +461,15 @@ static ld_plugin_status all_symbols_read_hook(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((*add_input_file)(ObjPath.c_str()) != LDPS_OK) {
|
if (add_input_file(ObjPath.c_str()) != LDPS_OK) {
|
||||||
(*message)(LDPL_ERROR, "Unable to add .o file to the link.");
|
message(LDPL_ERROR, "Unable to add .o file to the link.");
|
||||||
(*message)(LDPL_ERROR, "File left behind in: %s", ObjPath.c_str());
|
message(LDPL_ERROR, "File left behind in: %s", ObjPath.c_str());
|
||||||
return LDPS_ERR;
|
return LDPS_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!options::extra_library_path.empty() &&
|
if (!options::extra_library_path.empty() &&
|
||||||
set_extra_library_path(options::extra_library_path.c_str()) != LDPS_OK) {
|
set_extra_library_path(options::extra_library_path.c_str()) != LDPS_OK) {
|
||||||
(*message)(LDPL_ERROR, "Unable to set the extra library path.");
|
message(LDPL_ERROR, "Unable to set the extra library path.");
|
||||||
return LDPS_ERR;
|
return LDPS_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -484,7 +483,7 @@ static ld_plugin_status cleanup_hook(void) {
|
|||||||
for (int i = 0, e = Cleanup.size(); i != e; ++i) {
|
for (int i = 0, e = Cleanup.size(); i != e; ++i) {
|
||||||
std::error_code EC = sys::fs::remove(Cleanup[i]);
|
std::error_code EC = sys::fs::remove(Cleanup[i]);
|
||||||
if (EC)
|
if (EC)
|
||||||
(*message)(LDPL_ERROR, "Failed to delete '%s': %s", Cleanup[i].c_str(),
|
message(LDPL_ERROR, "Failed to delete '%s': %s", Cleanup[i].c_str(),
|
||||||
EC.message().c_str());
|
EC.message().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user