[PATCH] D134942: [Lex] Simplify and cleanup the updateConsecutiveMacroArgTokens implementation.
Nick Desaulniers via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 30 15:18:52 PDT 2022
nickdesaulniers added inline comments.
================
Comment at: clang/lib/Lex/TokenLexer.cpp:1008-1013
+ assert(!Partition.empty() &&
+ llvm::all_of(Partition.drop_front(),
+ [&SM](const Token &T) {
+ return SM.getFileID((&T - 1)->getLocation()) ==
+ SM.getFileID(T.getLocation());
+ }) &&
----------------
Could you just check that all of the tokens in the partition have the same fileID as the first token?
```
FileID FirstFID = SM.getFileID(Partition[0]->getLocation());
llvm::all_of(Partition, [&SM, &FirstID](const Token &T) { return SM.getFileID(T.getLocation() == FID; });
```
or move the assertion into the take_while above so we iterate less?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D134942/new/
https://reviews.llvm.org/D134942
More information about the cfe-commits
mailing list