[PATCH] D48136: [Polly] Implement an iterator for isl maps, basic_maps, sets, basic_sets

Philip Pfaffe via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 18 03:24:14 PDT 2018


philip.pfaffe marked an inline comment as done.
philip.pfaffe added inline comments.


================
Comment at: include/polly/Support/ISLTools.h:50
+protected:
+  ListT *List;
+  int Position = 0;
----------------
Meinersbur wrote:
> philip.pfaffe wrote:
> > Meinersbur wrote:
> > >  Should this hold a reference to the list? That is, the underlying object is not freed until all iterators are destroyed.
> > It needs a reference to do the iteration.
> What I mean is that the iterator could increase isl's ref counter to ensure that it is not free'd as long as one iterator exists. That is, is the following code valid?
> ```
> basic_set_iterator I, E;
> {
>   auto List = S.get_basic_set_list();
>   I = begin(List); E = end(List);
> } // List out-of-scope here
> for (; I != E; ++I) { ... }
> ```
Well, if you destroy the container you obtained iterators for and then use the iterators, that's on you ;)


Repository:
  rPLO Polly

https://reviews.llvm.org/D48136





More information about the llvm-commits mailing list