#include "llvm/Support/Program.h"
#include "llvm/Support/SourceMgr.h"
#include "llvm/Support/TargetSelect.h"
+#include "llvm/Support/WithColor.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Transforms/Instrumentation.h"
#include <cerrno>
CodeGenOpt::Level getOptLevel() {
switch (OptLevel) {
default:
- errs() << "lli: Invalid optimization level.\n";
+ WithColor::error(errs(), "lli") << "invalid optimization level.\n";
exit(1);
case '0': return CodeGenOpt::None;
case '1': return CodeGenOpt::Less;
builder.setMCJITMemoryManager(
std::unique_ptr<RTDyldMemoryManager>(RTDyldMM));
} else if (RemoteMCJIT) {
- errs() << "error: Remote process execution does not work with the "
- "interpreter.\n";
+ WithColor::error(errs(), argv[0])
+ << "remote process execution does not work with the interpreter.\n";
exit(1);
}
std::unique_ptr<ExecutionEngine> EE(builder.create());
if (!EE) {
if (!ErrorMsg.empty())
- errs() << argv[0] << ": error creating EE: " << ErrorMsg << "\n";
+ WithColor::error(errs(), argv[0])
+ << "error creating EE: " << ErrorMsg << "\n";
else
- errs() << argv[0] << ": unknown error creating EE!\n";
+ WithColor::error(errs(), argv[0]) << "unknown error creating EE!\n";
exit(1);
}
JITEventListener::createIntelJITEventListener());
if (!NoLazyCompilation && RemoteMCJIT) {
- errs() << "warning: remote mcjit does not support lazy compilation\n";
+ WithColor::warning(errs(), argv[0])
+ << "remote mcjit does not support lazy compilation\n";
NoLazyCompilation = true;
}
EE->DisableLazyCompilation(NoLazyCompilation);
//
Function *EntryFn = Mod->getFunction(EntryFunc);
if (!EntryFn) {
- errs() << '\'' << EntryFunc << "\' function not found in module.\n";
+ WithColor::error(errs(), argv[0])
+ << '\'' << EntryFunc << "\' function not found in module.\n";
return -1;
}
// remote JIT on Unix platforms.
if (RemoteMCJIT) {
#ifndef LLVM_ON_UNIX
- errs() << "Warning: host does not support external remote targets.\n"
- << " Defaulting to local execution\n";
+ WithColor::warning(errs(), argv[0])
+ << "host does not support external remote targets.\n" WithColor::note()
+ << "defaulting to local execution\n";
return -1;
#else
if (ChildExecPath.empty()) {
- errs() << "-remote-mcjit requires -mcjit-remote-process.\n";
+ WithColor::error(errs(), argv[0])
+ << "-remote-mcjit requires -mcjit-remote-process.\n";
exit(1);
} else if (!sys::fs::can_execute(ChildExecPath)) {
- errs() << "Unable to find usable child executable: '" << ChildExecPath
- << "'\n";
+ WithColor::error(errs(), argv[0])
+ << "unable to find usable child executable: '" << ChildExecPath
+ << "'\n";
return -1;
}
#endif
ResultGV.IntVal = APInt(32, Result);
Args.push_back(ResultGV);
EE->runFunction(ExitF, Args);
- errs() << "ERROR: exit(" << Result << ") returned!\n";
+ WithColor::error(errs(), argv[0]) << "exit(" << Result << ") returned!\n";
abort();
} else {
- errs() << "ERROR: exit defined with wrong prototype!\n";
+ WithColor::error(errs(), argv[0])
+ << "exit defined with wrong prototype!\n";
abort();
}
} else {
// Lanch the remote process and get a channel to it.
std::unique_ptr<FDRawChannel> C = launchRemote();
if (!C) {
- errs() << "Failed to launch remote JIT.\n";
+ WithColor::error(errs(), argv[0]) << "failed to launch remote JIT.\n";
exit(1);
}