mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Merge pull request #17391 from DougGregor/output-request-graphviz
This commit is contained in:
@@ -855,6 +855,13 @@ emitIndexData(CompilerInvocation &Invocation, CompilerInstance &Instance) {
|
||||
return hadEmitIndexDataError;
|
||||
}
|
||||
|
||||
/// Emits the request-evaluator graph to the given file in GraphViz format.
|
||||
void emitRequestEvaluatorGraphViz(ASTContext &ctx, StringRef graphVizPath) {
|
||||
std::error_code error;
|
||||
llvm::raw_fd_ostream out(graphVizPath, error, llvm::sys::fs::F_Text);
|
||||
ctx.evaluator.printDependenciesGraphviz(out);
|
||||
}
|
||||
|
||||
static bool performCompileStepsPostSILGen(
|
||||
CompilerInstance &Instance, CompilerInvocation &Invocation,
|
||||
std::unique_ptr<SILModule> SM, bool astGuaranteedToCorrespondToSIL,
|
||||
@@ -894,6 +901,17 @@ static bool performCompile(CompilerInstance &Instance,
|
||||
else
|
||||
Instance.performSema();
|
||||
|
||||
SWIFT_DEFER {
|
||||
// Emit request-evaluator graph via GraphViz, if requested.
|
||||
if (!Invocation.getFrontendOptions().RequestEvaluatorGraphVizPath.empty() &&
|
||||
Instance.hasASTContext()) {
|
||||
ASTContext &ctx = Instance.getASTContext();
|
||||
emitRequestEvaluatorGraphViz(
|
||||
ctx,
|
||||
Invocation.getFrontendOptions().RequestEvaluatorGraphVizPath);
|
||||
}
|
||||
};
|
||||
|
||||
if (Action == FrontendOptions::ActionType::Parse)
|
||||
return Instance.getASTContext().hadError();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user