-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[clang] Remove dead incremental Parser code #102450
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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.
@llvm/pr-subscribers-clang Author: Jonas Hahnfeld (hahnjo) ChangesWhen incremental processing is enabled, the Parser will never report Full diff: https://github.com/llvm/llvm-project/pull/102450.diff 1 Files Affected:
diff --git a/clang/lib/Parse/Parser.cpp b/clang/lib/Parse/Parser.cpp
index 5ebe71e496a2e8..04c2f1d380bc48 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:
|
Your reasoning sounds right to me. Can we make sure we are not breaking |
As far as I can tell, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm!
It is true that it is the default, but it's possible for clients to have one without the other. This is the case in Swift in particular (see #65683).
I couldn't think of a great way to test this at the time. If anyone has any ideas though... 😅. Otherwise we could add a comment here to explain why it's needed? |
This reverts commit 67cb040. When importing headers, the Swift ClangImporter library depends on `clang::Parser::ParseTopLevelDecl` consuming an EOF token when `IncrementalProcessing` is set.
Revert "[clang] Remove dead incremental Parser code (llvm#102450)"
If I understand correctly, you are manually calling |
When incremental processing is enabled, the Parser will never report
tok::eof
buttok::annot_repl_input_end
. However, that case is already taken care of inIncrementalParser::ParseOrWrapTopLevelDecl()
so this check was never executing.