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

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to