mirror of
https://github.com/RPCS3/llvm.git
synced 2025-02-07 11:08:46 +00:00
[llvm-lto] Uniform error handling. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266255 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
3df4c84057
commit
a6ab26162c
@ -603,9 +603,7 @@ int main(int argc, char **argv) {
|
||||
CodeGen.setModule(std::move(Module));
|
||||
} else if (!CodeGen.addModule(Module.get())) {
|
||||
// Print a message here so that we know addModule() did not abort.
|
||||
errs() << argv[0] << ": error adding file '" << InputFilenames[i]
|
||||
<< "'\n";
|
||||
return 1;
|
||||
error("error adding file '" + InputFilenames[i] + "'");
|
||||
}
|
||||
}
|
||||
|
||||
@ -639,8 +637,7 @@ int main(int argc, char **argv) {
|
||||
if (!CodeGen.optimize(DisableVerify, DisableInline, DisableGVNLoadPRE,
|
||||
DisableLTOVectorization)) {
|
||||
// Diagnostic messages should have been printed by the handler.
|
||||
errs() << argv[0] << ": error optimizing the code\n";
|
||||
return 1;
|
||||
error("error optimizing the code");
|
||||
}
|
||||
|
||||
if (SaveModuleFile) {
|
||||
@ -648,10 +645,8 @@ int main(int argc, char **argv) {
|
||||
ModuleFilename += ".merged.bc";
|
||||
std::string ErrMsg;
|
||||
|
||||
if (!CodeGen.writeMergedModules(ModuleFilename.c_str())) {
|
||||
errs() << argv[0] << ": writing merged module failed.\n";
|
||||
return 1;
|
||||
}
|
||||
if (!CodeGen.writeMergedModules(ModuleFilename.c_str()))
|
||||
error("writing merged module failed.");
|
||||
}
|
||||
|
||||
std::list<tool_output_file> OSs;
|
||||
@ -662,40 +657,29 @@ int main(int argc, char **argv) {
|
||||
PartFilename += "." + utostr(I);
|
||||
std::error_code EC;
|
||||
OSs.emplace_back(PartFilename, EC, sys::fs::F_None);
|
||||
if (EC) {
|
||||
errs() << argv[0] << ": error opening the file '" << PartFilename
|
||||
<< "': " << EC.message() << "\n";
|
||||
return 1;
|
||||
}
|
||||
if (EC)
|
||||
error("error opening the file '" + PartFilename + "': " + EC.message());
|
||||
OSPtrs.push_back(&OSs.back().os());
|
||||
}
|
||||
|
||||
if (!CodeGen.compileOptimized(OSPtrs)) {
|
||||
if (!CodeGen.compileOptimized(OSPtrs))
|
||||
// Diagnostic messages should have been printed by the handler.
|
||||
errs() << argv[0] << ": error compiling the code\n";
|
||||
return 1;
|
||||
}
|
||||
error("error compiling the code");
|
||||
|
||||
for (tool_output_file &OS : OSs)
|
||||
OS.keep();
|
||||
} else {
|
||||
if (Parallelism != 1) {
|
||||
errs() << argv[0] << ": -j must be specified together with -o\n";
|
||||
return 1;
|
||||
}
|
||||
if (Parallelism != 1)
|
||||
error("-j must be specified together with -o");
|
||||
|
||||
if (SaveModuleFile) {
|
||||
errs() << argv[0] << ": -save-merged-module must be specified with -o\n";
|
||||
return 1;
|
||||
}
|
||||
if (SaveModuleFile)
|
||||
error(": -save-merged-module must be specified with -o");
|
||||
|
||||
const char *OutputName = nullptr;
|
||||
if (!CodeGen.compile_to_file(&OutputName, DisableVerify, DisableInline,
|
||||
DisableGVNLoadPRE, DisableLTOVectorization)) {
|
||||
DisableGVNLoadPRE, DisableLTOVectorization))
|
||||
error("error compiling the code");
|
||||
// Diagnostic messages should have been printed by the handler.
|
||||
errs() << argv[0] << ": error compiling the code\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
outs() << "Wrote native object file '" << OutputName << "'\n";
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user