From: Craig Topper Date: Thu, 18 May 2017 01:11:52 +0000 (+0000) Subject: [Statistics] Use the new Statistic::updateMax to atomically calculate a maximum value... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d665e952bdf8d103e4d1765d80d81e28369617d3;p=clang [Statistics] Use the new Statistic::updateMax to atomically calculate a maximum value statistic. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@303320 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/StaticAnalyzer/Core/BugReporter.cpp b/lib/StaticAnalyzer/Core/BugReporter.cpp index 2114033ba8..2c3169c0f8 100644 --- a/lib/StaticAnalyzer/Core/BugReporter.cpp +++ b/lib/StaticAnalyzer/Core/BugReporter.cpp @@ -3448,14 +3448,12 @@ void BugReporter::FlushReport(BugReport *exampleReport, // the BugReporterVisitors may mark this bug as a false positive. assert(!bugReports.empty()); - MaxBugClassSize = - std::max(bugReports.size(), static_cast(MaxBugClassSize)); + MaxBugClassSize.updateMax(bugReports.size()); if (!generatePathDiagnostic(*D.get(), PD, bugReports)) return; - MaxValidBugClassSize = - std::max(bugReports.size(), static_cast(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. diff --git a/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp b/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp index 0fe0f3a6ed..c47edc7d21 100644 --- a/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp +++ b/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp @@ -674,10 +674,8 @@ void AnalysisConsumer::HandleCode(Decl *D, AnalysisMode Mode, 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);