Author: ctopper Date: Wed May 17 20:11:52 2017 New Revision: 303320 URL: http://llvm.org/viewvc/llvm-project?rev=303320&view=rev Log: [Statistics] Use the new Statistic::updateMax to atomically calculate a maximum value statistic.
Modified: cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp Modified: cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp?rev=303320&r1=303319&r2=303320&view=diff ============================================================================== --- cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp (original) +++ cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp Wed May 17 20:11:52 2017 @@ -3448,14 +3448,12 @@ void BugReporter::FlushReport(BugReport // the BugReporterVisitors may mark this bug as a false positive. assert(!bugReports.empty()); - MaxBugClassSize = - std::max(bugReports.size(), static_cast<size_t>(MaxBugClassSize)); + MaxBugClassSize.updateMax(bugReports.size()); if (!generatePathDiagnostic(*D.get(), PD, bugReports)) return; - MaxValidBugClassSize = - std::max(bugReports.size(), static_cast<size_t>(MaxValidBugClassSize)); + MaxValidBugClassSize.updateMax(bugReports.size()); // Examine the report and see if the last piece is in a header. Reset the // report location to the last piece in the main source file. Modified: cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp?rev=303320&r1=303319&r2=303320&view=diff ============================================================================== --- cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp (original) +++ cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp Wed May 17 20:11:52 2017 @@ -674,10 +674,8 @@ void AnalysisConsumer::HandleCode(Decl * DisplayFunction(D, Mode, IMode); CFG *DeclCFG = Mgr->getCFG(D); - if (DeclCFG) { - unsigned CFGSize = DeclCFG->size(); - MaxCFGSize = MaxCFGSize < CFGSize ? CFGSize : MaxCFGSize; - } + if (DeclCFG) + MaxCFGSize.updateMax(DeclCFG->size()); BugReporter BR(*Mgr); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits