diff options
| author | Artem Dergachev <artem.dergachev@gmail.com> | 2019-09-09 20:34:44 +0000 |
|---|---|---|
| committer | Artem Dergachev <artem.dergachev@gmail.com> | 2019-09-09 20:34:44 +0000 |
| commit | 589273bebd44c3fcc09d2ad87b259dcaff30d299 (patch) | |
| tree | 88ea835ea0b51dc885ab90582826fa42aadb5adc /clang/lib/StaticAnalyzer/Core | |
| parent | 2f169e7cdd9973d2aa4cba6b0a09126a5e7268ec (diff) | |
| download | bcm5719-llvm-589273bebd44c3fcc09d2ad87b259dcaff30d299.tar.gz bcm5719-llvm-589273bebd44c3fcc09d2ad87b259dcaff30d299.zip | |
[analyzer] NFC: Simplify bug report equivalence classes to not be ilists.
Use a vector of unique pointers instead.
Differential Revision: https://reviews.llvm.org/D67024
llvm-svn: 371451
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core')
| -rw-r--r-- | clang/lib/StaticAnalyzer/Core/BugReporter.cpp | 16 | ||||
| -rw-r--r-- | clang/lib/StaticAnalyzer/Core/ExprEngine.cpp | 7 |
2 files changed, 11 insertions, 12 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/BugReporter.cpp b/clang/lib/StaticAnalyzer/Core/BugReporter.cpp index 331d7379577..d3dacc78922 100644 --- a/clang/lib/StaticAnalyzer/Core/BugReporter.cpp +++ b/clang/lib/StaticAnalyzer/Core/BugReporter.cpp @@ -2798,17 +2798,15 @@ struct FRIEC_WLItem { BugReport *PathSensitiveBugReporter::findReportInEquivalenceClass( BugReportEquivClass &EQ, SmallVectorImpl<BugReport *> &bugReports) { - BugReportEquivClass::iterator I = EQ.begin(), E = EQ.end(); - assert(I != E); - const BugType& BT = I->getBugType(); - // If we don't need to suppress any of the nodes because they are // post-dominated by a sink, simply add all the nodes in the equivalence class // to 'Nodes'. Any of the reports will serve as a "representative" report. + assert(EQ.getReports().size() > 0); + const BugType& BT = EQ.getReports()[0]->getBugType(); if (!BT.isSuppressOnSink()) { - BugReport *R = &*I; - for (auto &I : EQ) { - if (auto *PR = dyn_cast<PathSensitiveBugReport>(&I)) { + BugReport *R = EQ.getReports()[0].get(); + for (auto &J : EQ.getReports()) { + if (auto *PR = dyn_cast<PathSensitiveBugReport>(J.get())) { R = PR; bugReports.push_back(PR); } @@ -2824,8 +2822,8 @@ BugReport *PathSensitiveBugReporter::findReportInEquivalenceClass( // stack for very long paths. BugReport *exampleReport = nullptr; - for (; I != E; ++I) { - auto *R = dyn_cast<PathSensitiveBugReport>(&*I); + for (const auto &I: EQ.getReports()) { + auto *R = dyn_cast<PathSensitiveBugReport>(I.get()); if (!R) continue; diff --git a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp index de23a3ca75f..2e062564088 100644 --- a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp +++ b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp @@ -3004,8 +3004,8 @@ struct DOTGraphTraits<ExplodedGraph*> : public DefaultDOTGraphTraits { llvm::make_range(BR.EQClasses_begin(), BR.EQClasses_end()); for (const auto &EQ : EQClasses) { - for (const BugReport &R : EQ) { - const auto *PR = dyn_cast<PathSensitiveBugReport>(&R); + for (const auto &I : EQ.getReports()) { + const auto *PR = dyn_cast<PathSensitiveBugReport>(I.get()); if (!PR) continue; const ExplodedNode *EN = PR->getErrorNode(); @@ -3135,7 +3135,8 @@ std::string ExprEngine::DumpGraph(bool trim, StringRef Filename) { // Iterate through the reports and get their nodes. for (BugReporter::EQClasses_iterator EI = BR.EQClasses_begin(), EE = BR.EQClasses_end(); EI != EE; ++EI) { - const auto *R = dyn_cast<PathSensitiveBugReport>(&*EI->begin()); + const auto *R = + dyn_cast<PathSensitiveBugReport>(EI->getReports()[0].get()); if (!R) continue; const auto *N = const_cast<ExplodedNode *>(R->getErrorNode()); |

