Skip to content

[Lex & PP] Cherry-picks from upstream llvm.org, related to lexer and preprocessor #5085

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

Merged
merged 5 commits into from
Aug 10, 2022

Conversation

akyrtzi
Copy link

@akyrtzi akyrtzi commented Aug 9, 2022

No description provided.

akyrtzi added 5 commits August 9, 2022 14:46
This should fix the `clang-ppc64-aix` builder.
… directly if they are revisited

This speeds up preprocessing, specifically for preprocessing the clang sources time is reduced by about -36%,
using measurements on M1Pro with a release+thinLTO build.

Differential Revision: https://reviews.llvm.org/D127379
…ng fast dependency directive lexing

Otherwise a header may be erroneously marked as having a header macro guard and won't get re-included.

Differential Revision: https://reviews.llvm.org/D128772
This is a preprocessor callback focused on the lexed file changing, without conflating effects of line number directives and other pragmas.
A client that only cares about what files the lexer processes, like dependency generation, can use this more straightforward
callback instead of `PPCallbacks::FileChanged()`. Clients that want the pragma directive effects as well can keep using `FileChanged()`.

A use case where `PPCallbacks::LexedFileChanged()` is particularly simpler to use than `FileChanged()` is in a situation
where a client wants to keep track of lexed file changes that include changes from/to the predefines buffer, where it becomes
unnecessary complicated trying to use `FileChanged()` while filtering out the pragma directives effects callbacks.

Also take the opportunity to provide information about the prior `FileID` the `Lexer` moved from, even when entering a new file.

Differential Revision: https://reviews.llvm.org/D128947
@akyrtzi
Copy link
Author

akyrtzi commented Aug 9, 2022

@swift-ci Please test

@akyrtzi
Copy link
Author

akyrtzi commented Aug 10, 2022

@swift-ci test linux platform

@akyrtzi akyrtzi merged commit 110d422 into swiftlang:stable/20220421 Aug 10, 2022
@akyrtzi akyrtzi deleted the pr/stable-picks-lex-pp branch August 10, 2022 05:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant