[9.3.0] Allow the include scanner to resolve generated (output-directory) toolchain headers. - #30879
Merged
Conversation
…ory) toolchain headers. RELNOTES: The C++ include scanner now properly resolves headers that are generated at build time and included as part of the toolchain. PiperOrigin-RevId: 970080035 Change-Id: I267fcd63fae455c793a81c4cfde6c9f9c8c9449b (cherry picked from commit 3a9b19c)
keith
referenced
this pull request
Aug 26, 2026
…lchain headers.
Currently, we can't use a generated directory for the C++ toolchain sysroot because the include scanner will discard all of its headers. The problem is that the scanner only resolves headers located under the output directory when they are a "declared" header (tracked in IncludeScanningHeaderData).
This CL teaches the scanner to treat the toolchain's own compiler_files as resolvable.
- CppCompileActionBuilder folds ccToolchain.getCompilerFiles() into the action's
prunable headers when include scanning is on, so the generated headers are
legitimate discoverable inputs.
- IncludeScanningHeaderData.Builder.addDeclaredHeaders() registers those
artifacts as declared headers, but only the generated (non-source) ones;
source-file sysroots already resolve via source-artifact lookup, so those
toolchains see no change to their declared-header map.
- CppCompileAction registers the prunable headers at both header-data build
sites.
Regression tests added:
- CppCompileActionTest.discoverInputs_generatedPrunableHeader_isDeclaredAndDiscovered:
a generated prunable header is registered as a declared header on the action's
IncludeScanningHeaderData and is discovered (verifies the CppCompileAction wiring).
- IncludeScannerTest.addDeclaredHeaders_registersOnlyGeneratedHeaders:
addDeclaredHeaders registers generated headers but skips source headers.
- IncludeScannerTest.addDeclaredHeaders_generatedHeaderIsResolvedByScanner:
end-to-end -- the real include scanner prunes an undeclared generated header
but resolves it once addDeclaredHeaders registers it.
RELNOTES: The C++ include scanner now properly resolves headers that are generated at build time and included as part of the toolchain.
PiperOrigin-RevId: 970080035
Change-Id: I267fcd63fae455c793a81c4cfde6c9f9c8c9449b
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
iancha1992
enabled auto-merge
August 26, 2026 17:35
pzembrod
approved these changes
Sep 2, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to no response for status checks
Sep 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
RELNOTES: The C++ include scanner now properly resolves headers that are generated at build time and included as part of the toolchain.
PiperOrigin-RevId: 970080035
Change-Id: I267fcd63fae455c793a81c4cfde6c9f9c8c9449b
(cherry picked from commit 3a9b19c)