[cfe-commits] [patch] TransformIterator (motivating use case in Clang)

David Blaikie dblaikie at gmail.com
Wed Jun 6 13:50:38 PDT 2012

On Tue, Jun 5, 2012 at 4:50 PM, Douglas Gregor <dgregor at apple.com> wrote:
> On May 27, 2012, at 10:29 PM, David Blaikie <dblaikie at gmail.com> wrote:
>>> "I.foo" vs. "I->foo" doesn't matter much to me, but "(*I)->foo" and "&*I" are really, really ugly.
>> I meant to mention on this point - I offered a patch that would've
>> removed much of the "&*I" usage, since many clients were tidier using
>> *I and references rather than pointers anyway.
> For me, this comes back to the "I'd rather not have to restyle the code base" thing. There's no demonstrable benefit to making this change, but it's a big sweeping change that affects a lot of code.
>>> It makes sense to factor out the filtering-iterator functionality, but I'd rather not have to restyle the code base to do it.
>> Right, certainly it's not necessary - I was just trying to tidy up
>> something that looked rather confusing (a half-pointer/half-value
>> iterator).
>> In any case, as the prevailing opinion seems to be pointers, here's a
>> patch that switches everything back to pointers. I've left the
>> reference and pointer typedefs as void rather than as either
>> inconsistent (as they were before) or complex (proxy objects). I
>> couldn't omit the typedefs entirely as some operations (std::distance)
>> seem to require their presence. They can be fixed/filled in when
>> necessary.
>> I'll check this in & then set about making the relevant
>> filtering/adapting iterators in such a way that they can handle these
>> iterators, including voiding the reference/pointer typedefs when
>> convenient, and adding -> when the value type is T*.
> This patch LGTM, thanks.

Committed as r158104. I'll work on a filtering iterator that can
handle these non-conforming iterators (as well as conforming ones)
next to refactor out the filtering functionality in the
filter/specific decl iterators (& then reuse that filter/adapting
iterator in the CFG).

- David

More information about the cfe-commits mailing list