[PATCH] D115014: [clang] RFC: NFC: simplify macro tokens assignment

zhouyizhou via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 3 04:28:23 PST 2021


zhouyizhou added a comment.

In D115014#3169444 <https://reviews.llvm.org/D115014#3169444>, @simon_tatham wrote:

> Ah, now I see what you mean – I didn't look far enough!
>
> I don't know this code well (in fact I'm not sure why you picked me as a reviewer), but off the top of my head: the question is not just whether `tokens_iterator` happens to be the same thing as `const Token *` //now//. It's whether it's guaranteed to stay that way in the future.
>
> One of the purposes of these iterator types is that they form an opaque abstraction layer: the client uses the type in only the ways that are guaranteed to work by the iterator specification, and then the implementation can completely change without breaking any client.
>
> If you make a change like this, and later `SmallVector::iterator` changes to some other legal implementation, or `tokens_iterator` changes to be something other than a `SmallVector::iterator`, then this change will have to be reverted.

Thank Simon for resolve my confusion

I am crystal clear about the use of &* pair now. I did benefit a lot.

I pick you as a reviewer because you have committed to TokenLexer.cpp recently (I use git log along with git blame );-)

Thanks again
Zhouyi


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115014



More information about the cfe-commits mailing list