[Driver] Main compiler tells frontend to -emit-loaded-module-trace.

This commit is contained in:
Huon Wilson
2017-04-20 15:46:41 -07:00
parent 87aa3e6935
commit 7e8568d03d
4 changed files with 76 additions and 28 deletions

View File

@@ -146,6 +146,10 @@ private:
/// detail than ShowIncrementalBuildDecisions.
bool ShowJobLifecycle = false;
/// When true, some frontend job has requested permission to pass
/// -emit-loaded-module-trace, so no other job needs to do it.
bool PassedEmitLoadedModuleTraceToFrontendJob = false;
static const Job *unwrap(const std::unique_ptr<const Job> &p) {
return p.get();
}
@@ -232,6 +236,22 @@ public:
/// -2 indicates that one of the Compilation's Jobs crashed during execution
int performJobs();
/// Returns whether the callee is permitted to pass -emit-loaded-module-trace
/// to a frontend job.
///
/// This only returns true once, because only one job should pass that
/// argument.
bool requestPermissionForFrontendToEmitLoadedModuleTrace() {
if (PassedEmitLoadedModuleTraceToFrontendJob)
// Someone else has already done it!
return false;
else {
// We're the first and only (to execute this path).
PassedEmitLoadedModuleTraceToFrontendJob = true;
return true;
}
}
private:
/// \brief Perform all jobs.
///