[PATCH] D148997: [clang] Add a new annotation token: annot_repl_input_end

Jun Zhang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 2 08:06:39 PDT 2023


junaire added inline comments.


================
Comment at: clang/lib/Interpreter/IncrementalParser.cpp:162
+  if (P->getCurToken().is(tok::annot_repl_input_end)) {
+    P->ConsumeAnyToken();
     // FIXME: Clang does not call ExitScope on finalizing the regular TU, we
----------------
rsmith wrote:
> 
Sorry but that's a private member function so I can't do that. Should I make it public?


================
Comment at: clang/lib/Parse/Parser.cpp:620-621
   // processing
-  if (PP.isIncrementalProcessingEnabled() && Tok.is(tok::eof))
-    ConsumeToken();
+  if (PP.isIncrementalProcessingEnabled() && Tok.is(tok::annot_repl_input_end))
+    ConsumeAnnotationToken();
 
----------------
rsmith wrote:
> Do we need to do this here? `IncrementalParser` already seems to take care of this, and the logic here would be easier to reason about if `Parser` never steps past an `annot_repl_input_end` token, and such tokens instead are only ever consumed by the REPL.
> 
> Are there other users of incremental processing mode, other than the REPL / `IncrementalParser`?
Make sense to me, I'll remove it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D148997



More information about the cfe-commits mailing list