Frontend: Fix crash when -stats-output-dir used with -typecheck-module-from-interface

There's no ASTContext in this case, so we just skip initializing stats if
the driver passes this flag down to us.
This commit is contained in:
Slava Pestov
2024-10-25 16:24:10 -04:00
parent ffaee52eb4
commit 9cd5b03466
2 changed files with 6 additions and 1 deletions

View File

@@ -563,7 +563,9 @@ bool CompilerInstance::setup(const CompilerInvocation &Invoke,
return true;
}
setupStatsReporter();
if (hasASTContext()) {
setupStatsReporter();
}
if (setupDiagnosticVerifierIfNeeded()) {
Error = "Setting up diagnostics verifier failed";