[all-commits] [llvm/llvm-project] da95d9: [clang][lex] Always pass suggested module to `Incl...
Jan Svoboda via All-commits
all-commits at lists.llvm.org
Thu Feb 8 10:19:31 PST 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: da95d926f6fce4ed9707c77908ad96624268f134
https://github.com/llvm/llvm-project/commit/da95d926f6fce4ed9707c77908ad96624268f134
Author: Jan Svoboda <jan_svoboda at apple.com>
Date: 2024-02-08 (Thu, 08 Feb 2024)
Changed paths:
M clang-tools-extra/clang-move/Move.cpp
M clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.cpp
M clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.h
M clang-tools-extra/clang-tidy/altera/KernelNameRestrictionCheck.cpp
M clang-tools-extra/clang-tidy/bugprone/SuspiciousIncludeCheck.cpp
M clang-tools-extra/clang-tidy/llvm/IncludeOrderCheck.cpp
M clang-tools-extra/clang-tidy/llvmlibc/RestrictSystemLibcHeadersCheck.cpp
M clang-tools-extra/clang-tidy/misc/HeaderIncludeCycleCheck.cpp
M clang-tools-extra/clang-tidy/modernize/DeprecatedHeadersCheck.cpp
M clang-tools-extra/clang-tidy/modernize/MacroToEnumCheck.cpp
M clang-tools-extra/clang-tidy/portability/RestrictSystemIncludesCheck.cpp
M clang-tools-extra/clang-tidy/portability/RestrictSystemIncludesCheck.h
M clang-tools-extra/clang-tidy/readability/DuplicateIncludeCheck.cpp
M clang-tools-extra/clang-tidy/utils/IncludeInserter.cpp
M clang-tools-extra/clangd/Headers.cpp
M clang-tools-extra/clangd/ParsedAST.cpp
M clang-tools-extra/clangd/index/IndexAction.cpp
M clang-tools-extra/clangd/unittests/ReplayPeambleTests.cpp
M clang-tools-extra/include-cleaner/lib/Record.cpp
M clang-tools-extra/modularize/CoverageChecker.cpp
M clang-tools-extra/modularize/PreprocessorTracker.cpp
M clang-tools-extra/pp-trace/PPCallbacksTracker.cpp
M clang-tools-extra/pp-trace/PPCallbacksTracker.h
M clang-tools-extra/test/pp-trace/pp-trace-include.cpp
M clang/include/clang/Lex/PPCallbacks.h
M clang/include/clang/Lex/PreprocessingRecord.h
M clang/include/clang/Tooling/DependencyScanning/ModuleDepCollector.h
M clang/lib/CodeGen/MacroPPCallbacks.cpp
M clang/lib/CodeGen/MacroPPCallbacks.h
M clang/lib/Frontend/DependencyFile.cpp
M clang/lib/Frontend/DependencyGraph.cpp
M clang/lib/Frontend/ModuleDependencyCollector.cpp
M clang/lib/Frontend/PrecompiledPreamble.cpp
M clang/lib/Frontend/PrintPreprocessedOutput.cpp
M clang/lib/Frontend/Rewrite/InclusionRewriter.cpp
M clang/lib/Lex/PPDirectives.cpp
M clang/lib/Lex/PreprocessingRecord.cpp
M clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
M clang/tools/libclang/Indexing.cpp
M clang/unittests/Lex/PPCallbacksTest.cpp
Log Message:
-----------
[clang][lex] Always pass suggested module to `InclusionDirective()` callback (#81061)
This patch provides more information to the
`PPCallbacks::InclusionDirective()` hook. We now always pass the
suggested module, regardless of whether it was actually imported or not.
The extra `bool ModuleImported` parameter then denotes whether the
header `#include` will be automatically translated into import the the
module.
The main change is in `clang/lib/Lex/PPDirectives.cpp`, where we take
care to not modify `SuggestedModule` after it's been populated by
`LookupHeaderIncludeOrImport()`. We now exclusively use the `SM`
(`ModuleToImport`) variable instead, which has been equivalent to
`SuggestedModule` until now. This allows us to use the original
non-modified `SuggestedModule` for the callback itself.
(This patch turns out to be necessary for
https://github.com/apple/llvm-project/pull/8011).
More information about the All-commits
mailing list