[clang] [clang] Remove dead incremental Parser code (PR #102450)

Jonas Hahnfeld via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 8 03:53:31 PDT 2024


https://github.com/hahnjo created https://github.com/llvm/llvm-project/pull/102450

When incremental processing is enabled, the Parser will never report `tok::eof` but `tok::annot_repl_input_end`. However, that case is already taken care of in `IncrementalParser::ParseOrWrapTopLevelDecl()` so this check was never executing.

>From dfe3a8c8b9cbb86a382aab6f447c6a88327627ab Mon Sep 17 00:00:00 2001
From: Jonas Hahnfeld <jonas.hahnfeld at cern.ch>
Date: Thu, 8 Aug 2024 12:02:09 +0200
Subject: [PATCH] [clang] Remove dead incremental Parser code

When incremental processing is enabled, the Parser will never report
tok::eof but tok::annot_repl_input_end. However, that case is already
taken care of in IncrementalParser::ParseOrWrapTopLevelDecl() so this
check was never executing.
---
 clang/lib/Parse/Parser.cpp | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/clang/lib/Parse/Parser.cpp b/clang/lib/Parse/Parser.cpp
index 5ebe71e496a2e..04c2f1d380bc4 100644
--- a/clang/lib/Parse/Parser.cpp
+++ b/clang/lib/Parse/Parser.cpp
@@ -629,11 +629,6 @@ bool Parser::ParseTopLevelDecl(DeclGroupPtrTy &Result,
                                Sema::ModuleImportState &ImportState) {
   DestroyTemplateIdAnnotationsRAIIObj CleanupRAII(*this);
 
-  // Skip over the EOF token, flagging end of previous input for incremental
-  // processing
-  if (PP.isIncrementalProcessingEnabled() && Tok.is(tok::eof))
-    ConsumeToken();
-
   Result = nullptr;
   switch (Tok.getKind()) {
   case tok::annot_pragma_unused:



More information about the cfe-commits mailing list