@@ -723,6 +723,7 @@ AnalysisConsumer::getModeForDecl(Decl *D, AnalysisMode Mode) {
723723}
724724
725725static UnsignedEPStat PathRunningTime (" PathRunningTime" );
726+ static UnsignedEPStat SyntaxRunningTime (" SyntaxRunningTime" );
726727
727728void AnalysisConsumer::HandleCode (Decl *D, AnalysisMode Mode,
728729 ExprEngine::InliningModes IMode,
@@ -761,6 +762,8 @@ void AnalysisConsumer::HandleCode(Decl *D, AnalysisMode Mode,
761762 SyntaxCheckTimer->stopTimer ();
762763 llvm::TimeRecord CheckerEndTime = SyntaxCheckTimer->getTotalTime ();
763764 CheckerEndTime -= CheckerStartTime;
765+ FunctionSummaries.findOrInsertSummary (D)->second .SyntaxRunningTime =
766+ std::lround (CheckerEndTime.getWallTime () * 1000 );
764767 DisplayTime (CheckerEndTime);
765768 if (AnalyzerTimers && ShouldClearTimersToPreventDisplayingThem) {
766769 AnalyzerTimers->clear ();
@@ -792,11 +795,23 @@ void AnalysisConsumer::RunPathSensitiveChecks(Decl *D,
792795 if (!CFG)
793796 return ;
794797
798+ CFGSize.set (CFG->size ());
799+
800+ auto *DeclContext = Mgr->getAnalysisDeclContext (D);
795801 // See if the LiveVariables analysis scales.
796- if (!Mgr-> getAnalysisDeclContext (D) ->getAnalysis <RelaxedLiveVariables>())
802+ if (!DeclContext ->getAnalysis <RelaxedLiveVariables>())
797803 return ;
798804
799- CFGSize.set (CFG->size ());
805+ // DeclContext declaration is the redeclaration of D that has a body.
806+ const Decl *DefDecl = DeclContext->getDecl ();
807+
808+ // Get the SyntaxRunningTime from the function summary, because it is computed
809+ // during the AM_Syntax analysis, which is done at a different point in time
810+ // and in different order, but always before AM_Path.
811+ if (const auto *Summary = FunctionSummaries.findSummary (DefDecl);
812+ Summary && Summary->SyntaxRunningTime .has_value ()) {
813+ SyntaxRunningTime.set (*Summary->SyntaxRunningTime );
814+ }
800815
801816 ExprEngine Eng (CTU, *Mgr, VisitedCallees, &FunctionSummaries, IMode);
802817
0 commit comments