[PATCH] D25660: [Analyzer] Checker for iterators dereferenced beyond their range.

Balogh, Ádám via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 27 03:16:56 PDT 2016


baloghadamsoftware added inline comments.


================
Comment at: test/Analysis/iterator-past-end.cpp:3
+
+template <typename T, typename Ptr, typename Ref> struct __iterator {
+  typedef __iterator<T, T *, T &> iterator;
----------------
NoQ wrote:
> baloghadamsoftware wrote:
> > NoQ wrote:
> > > We should probably separate this into an #include-able header in `test/Analysis/Inputs/`.
> > > 
> > > Also, there's always a bit of concern that it wasn't copy-pasted from a standard library implementation with an incompatible license such as (L)GPL. Which often happens when you do your best to emulate the normal way of defining things as closely as possible.
> > I did it now, but first one of my tests failed. I fixed the bug, but it turned out that if I include these types and functions, no method or function is checked, just conjured symbols are generated. Should including not behave the same as copying the contents? This happened even if I removed the pragma.
> Aha, i guess that's because we don't inline STL headers. See `mayInlineCXXStandardLibrary()` / `-analyzer-config c++-stdlib-inlining`.
> 
> The lesson to learn here is that it's a good idea to make tests as similar to real code as possible. Because on real code, it would probably also not be inlined.
Actually, I always test first on real code, and it seemed to be inlined. But now, even if I removed the pragma it was not inlined.


https://reviews.llvm.org/D25660





More information about the cfe-commits mailing list