[all-commits] [llvm/llvm-project] 0d3a2b: [Lex] Introduce `PPCallbacks::LexedFileChanged()` ...

Argyrios Kyrtzidis via All-commits all-commits at lists.llvm.org
Fri Jul 1 14:22:49 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0d3a2b4c6601d4ff341119aa537db184197d83de
      https://github.com/llvm/llvm-project/commit/0d3a2b4c6601d4ff341119aa537db184197d83de
  Author: Argyrios Kyrtzidis <kyrtzidis at apple.com>
  Date:   2022-07-01 (Fri, 01 Jul 2022)

  Changed paths:
    M clang-tools-extra/test/pp-trace/pp-trace-include.cpp
    M clang/include/clang/Lex/PPCallbacks.h
    M clang/lib/Frontend/DependencyFile.cpp
    M clang/lib/Lex/PPLexerChange.cpp

  Log Message:
  -----------
  [Lex] Introduce `PPCallbacks::LexedFileChanged()` preprocessor callback

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




More information about the All-commits mailing list