Index: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h =================================================================== --- clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h +++ clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h @@ -72,7 +72,7 @@ /// This class provides an interface through which checkers can create /// individual bug reports. -class BugReport : public llvm::ilist_node { +class BugReport { public: using ranges_iterator = const SourceRange *; using NoteList = SmallVector, 4>; @@ -454,11 +454,18 @@ class BugReportEquivClass : public llvm::FoldingSetNode { friend class BugReporter; +public: + typedef llvm::SmallVector, 4> ReportList; + using iterator = ReportList::iterator; + using const_iterator = ReportList::const_iterator; + + +private: /// List of *owned* BugReport objects. - llvm::ilist Reports; + ReportList Reports; - void AddReport(std::unique_ptr R) { - Reports.push_back(R.release()); + void AddReport(std::unique_ptr &&R) { + Reports.push_back(std::move(R)); } public: @@ -466,12 +473,9 @@ void Profile(llvm::FoldingSetNodeID& ID) const { assert(!Reports.empty()); - Reports.front().Profile(ID); + Reports.front()->Profile(ID); } - using iterator = llvm::ilist::iterator; - using const_iterator = llvm::ilist::const_iterator; - iterator begin() { return Reports.begin(); } iterator end() { return Reports.end(); } @@ -563,7 +567,7 @@ virtual BugReport * findReportInEquivalenceClass(BugReportEquivClass &eqClass, SmallVectorImpl &bugReports) { - return &*eqClass.begin(); + return eqClass.begin()->get(); } protected: Index: clang/lib/StaticAnalyzer/Core/BugReporter.cpp =================================================================== --- clang/lib/StaticAnalyzer/Core/BugReporter.cpp +++ clang/lib/StaticAnalyzer/Core/BugReporter.cpp @@ -2800,17 +2800,17 @@ BugReport *PathSensitiveBugReporter::findReportInEquivalenceClass( BugReportEquivClass &EQ, SmallVectorImpl &bugReports) { - BugReportEquivClass::iterator I = EQ.begin(), E = EQ.end(); + auto I = EQ.begin(), E = EQ.end(); assert(I != E); - const BugType& BT = I->getBugType(); + 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. if (!BT.isSuppressOnSink()) { - BugReport *R = &*I; - for (auto &I : EQ) { - if (auto *PR = dyn_cast(&I)) { + BugReport *R = I->get(); + for (auto &J : EQ) { + if (auto *PR = dyn_cast(J.get())) { R = PR; bugReports.push_back(PR); } @@ -2827,7 +2827,7 @@ BugReport *exampleReport = nullptr; for (; I != E; ++I) { - auto *R = dyn_cast(&*I); + auto *R = dyn_cast(I->get()); if (!R) continue; Index: clang/lib/StaticAnalyzer/Core/ExprEngine.cpp =================================================================== --- clang/lib/StaticAnalyzer/Core/ExprEngine.cpp +++ clang/lib/StaticAnalyzer/Core/ExprEngine.cpp @@ -3004,8 +3004,8 @@ llvm::make_range(BR.EQClasses_begin(), BR.EQClasses_end()); for (const auto &EQ : EQClasses) { - for (const BugReport &R : EQ) { - const auto *PR = dyn_cast(&R); + for (const auto &I : EQ) { + const auto *PR = dyn_cast(I.get()); if (!PR) continue; const ExplodedNode *EN = PR->getErrorNode(); @@ -3135,7 +3135,7 @@ // 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(&*EI->begin()); + const auto *R = dyn_cast(EI->begin()->get()); if (!R) continue; const auto *N = const_cast(R->getErrorNode());