[PATCH] D67024: [analyzer] NFC: Replace intrusive list of bug reports with a vector of pointers.

Dmitri Gribenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 2 03:05:32 PDT 2019


gribozavr added inline comments.


================
Comment at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h:460
+  using iterator = ReportList::iterator;
+  using const_iterator = ReportList::const_iterator;
+
----------------
gribozavr wrote:
> gribozavr wrote:
> > I don't think we intend users to use `ReportList`, so it would be better to not expose it. Instead:
> > 
> > ```
> > using iterator = SmallVectorImpl<std::unique_ptr<BugReport>>::iterator;
> > using const_iterator = SmallVectorImpl<std::unique_ptr<BugReport>>::const_iterator;
> > ```
> > 
> > ... and move it closer to the usage point, right above `begin()` / `end()`. WDYT?
> Could even do away with all these typedefs, and four begin/end overloads, and replace everything with:
> 
> ```
> ArrayRef<std::unique_ptr<BugReport>> Reports() const;
> ```
> 
> I believe we don't even need a non-const overload since `unique_ptr` allows mutations regardless.
`BugReports` would be a better name.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67024/new/

https://reviews.llvm.org/D67024





More information about the cfe-commits mailing list