[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 02:40:13 PST 2021


simon_tatham added a comment.

I don't think so, I'm afraid. If you look at the definition of `MacroInfo::tokens_begin()` in `clang/include/clang/Lex/MacroInfo.h`, you see that it doesn't return a raw `Token *`: it returns a C++ iterator object.

  using tokens_iterator = SmallVectorImpl<Token>::const_iterator;
  
  tokens_iterator tokens_begin() const { return ReplacementTokens.begin(); }

So you do have to dereference the iterator to get a `Token &`, and then address-take that to turn it into a `Token *`.


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