Skip to content
This repository was archived by the owner on Mar 28, 2020. It is now read-only.

Commit d665e95

Browse files
committed
[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
1 parent 7503060 commit d665e95

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

lib/StaticAnalyzer/Core/BugReporter.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3448,14 +3448,12 @@ void BugReporter::FlushReport(BugReport *exampleReport,
34483448
// the BugReporterVisitors may mark this bug as a false positive.
34493449
assert(!bugReports.empty());
34503450

3451-
MaxBugClassSize =
3452-
std::max(bugReports.size(), static_cast<size_t>(MaxBugClassSize));
3451+
MaxBugClassSize.updateMax(bugReports.size());
34533452

34543453
if (!generatePathDiagnostic(*D.get(), PD, bugReports))
34553454
return;
34563455

3457-
MaxValidBugClassSize =
3458-
std::max(bugReports.size(), static_cast<size_t>(MaxValidBugClassSize));
3456+
MaxValidBugClassSize.updateMax(bugReports.size());
34593457

34603458
// Examine the report and see if the last piece is in a header. Reset the
34613459
// report location to the last piece in the main source file.

lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -674,10 +674,8 @@ void AnalysisConsumer::HandleCode(Decl *D, AnalysisMode Mode,
674674

675675
DisplayFunction(D, Mode, IMode);
676676
CFG *DeclCFG = Mgr->getCFG(D);
677-
if (DeclCFG) {
678-
unsigned CFGSize = DeclCFG->size();
679-
MaxCFGSize = MaxCFGSize < CFGSize ? CFGSize : MaxCFGSize;
680-
}
677+
if (DeclCFG)
678+
MaxCFGSize.updateMax(DeclCFG->size());
681679

682680
BugReporter BR(*Mgr);
683681

0 commit comments

Comments
 (0)