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

2021-12-03 Thread zhouyizhou via Phabricator via cfe-commits
zhouyizhou added a comment. In 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 que

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

2021-12-03 Thread Simon Tatham via Phabricator via cfe-commits
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 *

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

2021-12-03 Thread zhouyizhou via Phabricator via cfe-commits
zhouyizhou added a comment. In D115014#3169400 , @simon_tatham wrote: > 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

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

2021-12-03 Thread Simon Tatham via Phabricator via cfe-commits
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::const_i

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

2021-12-02 Thread zhouyizhou via Phabricator via cfe-commits
zhouyizhou created this revision. zhouyizhou added reviewers: lattner, rnk, MaskRay, simon_tatham. zhouyizhou requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. I think we could simplify Tokens = &*Macro->tokens_begin() in clang::TokenLexer::