[PATCH] D128947: [Lex] Introduce `PPCallbacks::LexedFileChanged()` preprocessor callback
Argyrios Kyrtzidis via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 30 14:29:22 PDT 2022
akyrtzi created this revision.
Herald added subscribers: shchenz, kbarton, nemanjai.
Herald added a project: All.
akyrtzi requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
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.
For `LexedFileChanged()` take the opportunity to also provide information about the prior `FileID` the `Lexer` moved from, even when
entering a new file.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D128947
Files:
clang/include/clang/Basic/SourceManager.h
clang/include/clang/Lex/PPCallbacks.h
clang/lib/Basic/SourceManager.cpp
clang/lib/Frontend/DependencyFile.cpp
clang/lib/Lex/PPLexerChange.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D128947.441524.patch
Type: text/x-patch
Size: 8131 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220630/b98f2b5b/attachment.bin>
More information about the cfe-commits
mailing list