Skip to content

[6.2][Clang] Cherry-pick changes for header and module import tracing #10582

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 30, 2025

Conversation

bob-wilson
Copy link

This cherry-picks llvm#136227 and llvm#136232 to fix crashes with the existing header tracing, and it also cherry-picks llvm#137087 to get the new -header-include-filtering=direct-per-file option.

rdar://145610537

…=json (llvm#136227)

There is no main file when building a module, so the code in
HeaderIncludesJSONCallback::EndOfMainFile() needs to check for that to
avoid crashing.
…vm#136232)

If you specify -header-include-format=json, the only filtering option
currently supported is -header-include-filtering=only-direct-system. If
you specify some other filtering option, Clang gives an error message.
But, if you do not specify the filtering option at all, Clang crashes
when producing the error message, since it tries to get the value of the
unused option.
…m#137087)

This adds a new filtering option to be used along with the
-header-include-format=json option. The existing "only-direct-system"
filtering option is missing some things:
- It does not show module imports.
- It does not show includes of non-system headers. This new
"direct-per-file" filtering has a separate entry in the JSON output for
each non-system source file, showing the direct includes and imports
from that file. You can use this to see uses of non-system headers, and
also find the paths through non-system headers that lead up to module
imports and system headers. Modules are identified here by their
modulemap files.
@bob-wilson bob-wilson requested a review from a team as a code owner April 29, 2025 21:03
@bob-wilson
Copy link
Author

@swift-ci test

@cyndyishida cyndyishida merged commit 8528c28 into swift/release/6.2 Apr 30, 2025
3 checks passed
@cyndyishida cyndyishida deleted the bwilson/new-tracing branch April 30, 2025 14:43
@cyndyishida cyndyishida restored the bwilson/new-tracing branch April 30, 2025 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants