Skip to content

[Dependency Scanning] Restrict Swift overlay lookup to "visible" Clang modules only #83050

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

artemcm
Copy link
Contributor

@artemcm artemcm commented Jul 14, 2025

llvm/llvm-project#147969 added support to the Clang dependency scanner to query the set of "visible" modules for a given TU or named query. Swift must utilize this data to driver lookup of Swift module overlays. Previously, the scanner implementation queried Swift module overlay dependencies for a Swift module by checking all of its imported Clang modules, direct and transitive - even when not re-exported. With this change, the scanner's overlay lookup is only done for a Swift module's "visible" set of Clang module dependencies as reported by the scanner, matching the behavior expected to occur in the subsequent compilation task.

@artemcm
Copy link
Contributor Author

artemcm commented Jul 14, 2025

@swift-ci test

@artemcm
Copy link
Contributor Author

artemcm commented Jul 14, 2025

@artemcm
Copy link
Contributor Author

artemcm commented Jul 16, 2025

Copy link
Contributor

@cyndyishida cyndyishida left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@artemcm
Copy link
Contributor Author

artemcm commented Jul 16, 2025

1 similar comment
@artemcm
Copy link
Contributor Author

artemcm commented Jul 16, 2025

@artemcm artemcm force-pushed the AdoptVisibleClangModulesForOverlayDiscovery branch from 1c73538 to 5600184 Compare July 16, 2025 20:00
@artemcm
Copy link
Contributor Author

artemcm commented Jul 16, 2025

@artemcm artemcm force-pushed the AdoptVisibleClangModulesForOverlayDiscovery branch from 5600184 to b38ca14 Compare July 16, 2025 22:00
@artemcm
Copy link
Contributor Author

artemcm commented Jul 16, 2025

@artemcm
Copy link
Contributor Author

artemcm commented Jul 18, 2025

swiftlang/llvm-project#10987
@swift-ci test macOS platform

@artemcm
Copy link
Contributor Author

artemcm commented Jul 18, 2025

swiftlang/llvm-project#10987
@swift-ci test Linux platform

@artemcm
Copy link
Contributor Author

artemcm commented Jul 18, 2025

I am seeing CI hit failures in:

Swift(linux-x86_64) :: CAS/macro_plugin_external.swift

and

Swift(macosx-x86_64) :: ScanDependencies/compiled_swift_modules.swift

Intermittently. I haven't been able to reproduce them locally yet but I suspect there's a memory bug here somewhere.

artemcm added 3 commits July 23, 2025 09:25
…g modules only

Previously Swift overlay lookup was performed for every directly and transitively-imported Clang module.

llvm/llvm-project#147969 introduced the concept of "visible" Clang modules from a given named Clang dependency scanner query which closely maps to the set of modules for which Swift will attempt to load a Swift overlay. This change switches overlay querying to apply only to the set of such visible modules.

Resolves rdar://144797648
…ft modules are always queried by-name to the Clang dependency scanner

This is required in order to always have computed the set of visible Clang modules for each Swift module in the graph. Otherwise when some Clang module gets cached as a transitive dependency from a query and is later looked up as a direct dependency, there will not be any computed visible modules set.
@artemcm
Copy link
Contributor Author

artemcm commented Jul 23, 2025

@artemcm artemcm force-pushed the AdoptVisibleClangModulesForOverlayDiscovery branch from b38ca14 to 27305d6 Compare July 23, 2025 17:43
@artemcm
Copy link
Contributor Author

artemcm commented Jul 23, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants