[all-commits] [llvm/llvm-project] 7a124f: [clang][lex] Remove `PPCallbacks::FileNotFound()`

Jan Svoboda via All-commits all-commits at lists.llvm.org
Tue Feb 15 00:48:46 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7a124f4859d5c4093467abc2e734f8ab15e78cc6
      https://github.com/llvm/llvm-project/commit/7a124f4859d5c4093467abc2e734f8ab15e78cc6
  Author: Jan Svoboda <jan_svoboda at apple.com>
  Date:   2022-02-15 (Tue, 15 Feb 2022)

  Changed paths:
    M clang-tools-extra/clangd/ParsedAST.cpp
    M clang-tools-extra/pp-trace/PPCallbacksTracker.cpp
    M clang-tools-extra/pp-trace/PPCallbacksTracker.h
    M clang/include/clang/Lex/PPCallbacks.h
    M clang/lib/Lex/PPDirectives.cpp

  Log Message:
  -----------
  [clang][lex] Remove `PPCallbacks::FileNotFound()`

The purpose of the `FileNotFound` preprocessor callback was to add the ability to recover from failed header lookups. This was to support downstream project.

However, injecting additional search path while performing header search can invalidate currently used iterators/references to `DirectoryLookup` in `Preprocessor` and `HeaderSearch`.

The downstream project ended up maintaining a separate patch to further tweak the functionality. Since we don't have any upstream users nor open source downstream users, I'd like to remove this callback for good to prevent future misuse. I doubt there are any actual downstream users, since the functionality is definitely broken at the moment.

Reviewed By: ahoppen

Differential Revision: https://reviews.llvm.org/D119708


  Commit: edd09bb5a49c6a5dac29714af661d1ddffe50a72
      https://github.com/llvm/llvm-project/commit/edd09bb5a49c6a5dac29714af661d1ddffe50a72
  Author: Jan Svoboda <jan_svoboda at apple.com>
  Date:   2022-02-15 (Tue, 15 Feb 2022)

  Changed paths:
    M clang/include/clang/Lex/Preprocessor.h
    M clang/lib/Lex/PPMacroExpansion.cpp

  Log Message:
  -----------
  [clang][lex] Remove `Preprocessor::GetCurDirLookup()`

`Preprocessor` exposes the search directory iterator via `GetCurDirLookup()` getter, which is only used in two static functions.

To simplify reasoning about search directory iterators/references and to simplify the `Preprocessor` API, this patch makes the two static functions private member functions and removes the getter entirely.

Depends D119708.

Reviewed By: ahoppen, dexonsmith

Differential Revision: https://reviews.llvm.org/D119714


Compare: https://github.com/llvm/llvm-project/compare/8f55cd0178c1...edd09bb5a49c


More information about the All-commits mailing list