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

Simon Tatham via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 3 03:23:07 PST 2021


simon_tatham added a comment.

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.


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