hans added inline comments.

================
Comment at: clang/lib/Lex/Preprocessor.cpp:973
+  if ((LexLevel == 0 || PreprocessToken) &&
+      !Result.getFlag(Token::IsReinjected)) {
+    if (LexLevel == 0)
----------------
zequanwu wrote:
> hans wrote:
> > zequanwu wrote:
> > > @hans , can you take a look on this part? I saw `TokenCount` was 
> > > introduced for a warning `-Wmax-tokens`.
> > Can you explain why things are changing here?
> > 
> > The idea of TokenCount is to simply count the preprocessor tokens. At this 
> > point I think you have more knowledge here than I did when I added it :)
> In `CodeGen::CoverageMappingModuleGen::setUpCoverageCallbacks`, I set 
> `OnToken` to a lambda to update `PrevTokLoc` after lexing a new token. But, 
> the original condition ` if (LexLevel == 0 && 
> !Result.getFlag(Token::IsReinjected)) ` will not call `OnToken` if it's  
> lexing a directive, like `#if`, `#define` etc, because the LexLevel is 
> greater than 0. In order to update `PrevTokLoc` even when lexing directive, I 
> add `PreprocessToken` which will be set to true in 
> `CodeGen::CoverageMappingModuleGen::setUpCoverageCallbacks` just to invoke 
> `OnToken` without increment `TokenCount` when lexing directives. 
Ah, I see. That sounds okay to me.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83592/new/

https://reviews.llvm.org/D83592



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

Reply via email to