Silence Orc missing symbols message:

IncrementalExecutor has its own, showing what is requesting the
symbols, which is more useful than the diagnostic of Orc. OTOH
Orc might emit more errors than just missing symbols, and if
there are multiple missing symbols, IncrementalExecutor only
shows the first.

So enable `Verbose` also for IncrementalJIT, showing the original
missing symbols as diagnosed by Orc.

This fixes roottest_cling_other_checkMissingSymbolExitCode which
fails due to the extra diagnostic error line.
This commit is contained in:
Axel Naumann 2022-07-06 12:58:56 +02:00 committed by jenkins
parent c28fc71858
commit 619f5e83a2
5 changed files with 26 additions and 6 deletions

View File

@ -108,7 +108,8 @@ CreateHostTargetMachine(const clang::CompilerInstance& CI) {
} // anonymous namespace
IncrementalExecutor::IncrementalExecutor(clang::DiagnosticsEngine& /*diags*/,
const clang::CompilerInstance& CI):
const clang::CompilerInstance& CI,
bool Verbose):
m_Callbacks(nullptr), m_externalIncrementalExecutor(nullptr)
#if 0
: m_Diags(diags)
@ -123,7 +124,8 @@ IncrementalExecutor::IncrementalExecutor(clang::DiagnosticsEngine& /*diags*/,
auto &TMRef = *TM;
llvm::Error Err = llvm::Error::success();
auto EPC = llvm::cantFail(llvm::orc::SelfExecutorProcessControl::Create());
m_JIT.reset(new IncrementalJIT(*this, std::move(TM), std::move(EPC), Err));
m_JIT.reset(new IncrementalJIT(*this, std::move(TM), std::move(EPC), Err,
Verbose));
if (Err) {
llvm::logAllUnhandledErrors(std::move(Err), llvm::errs(), "Fatal: ");
llvm_unreachable("Propagate this error and exit gracefully");

View File

@ -158,7 +158,8 @@ namespace cling {
};
IncrementalExecutor(clang::DiagnosticsEngine& diags,
const clang::CompilerInstance& CI);
const clang::CompilerInstance& CI,
bool Verbose);
~IncrementalExecutor();

View File

@ -83,9 +83,22 @@ public:
}
};
namespace {
// This replaces llvm::orc::ExecutionSession::logErrorsToStdErr:
// IncrementalExecutor has its own diagnostics (for now); these
// diagnostics here might be superior as they show *all* unresolved
// symbols, so show them in case of "verbose" nonetheless.
static void silenceJITErrors(Error Err) {
if (!Err || Err.isA<SymbolsNotFound>())
return;
logAllUnhandledErrors(std::move(Err), errs(), "cling JIT session error: ");
}
}
IncrementalJIT::IncrementalJIT(
IncrementalExecutor& Executor, std::unique_ptr<TargetMachine> TM,
std::unique_ptr<llvm::orc::ExecutorProcessControl> EPC, Error& Err)
std::unique_ptr<llvm::orc::ExecutorProcessControl> EPC, Error& Err,
bool Verbose)
: SkipHostProcessLookup(false),
TM(std::move(TM)),
SingleThreadedContext(std::make_unique<LLVMContext>()) {
@ -154,6 +167,9 @@ IncrementalJIT::IncrementalJIT(
return;
}
Jit->getMainJITDylib().addGenerator(std::move(*HostProcessLookup));
if (!Verbose)
Jit->getExecutionSession().setErrorReporter(silenceJITErrors);
}
void IncrementalJIT::addModule(Transaction& T) {

View File

@ -52,7 +52,7 @@ public:
IncrementalJIT(IncrementalExecutor& Executor,
std::unique_ptr<llvm::TargetMachine> TM,
std::unique_ptr<llvm::orc::ExecutorProcessControl> EPC,
llvm::Error &Err);
llvm::Error &Err, bool Verbose = false);
// FIXME: Accept a LLVMContext as well, e.g. the one that was used for the
// particular module in Interpreter, CIFactory or BackendPasses (would be

View File

@ -257,7 +257,8 @@ namespace cling {
return;
if (!isInSyntaxOnlyMode()) {
m_Executor.reset(new IncrementalExecutor(SemaRef.Diags, *getCI()));
m_Executor.reset(new IncrementalExecutor(SemaRef.Diags, *getCI(),
m_Opts.Verbose()));
if (!m_Executor)
return;