-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Cross import overlay tooling support fixes #30758
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
Conversation
@swift-ci please test |
Build failed |
I'm wondering whether it would be beneficial to avoid using the same term "underlying module" in relation to either cross-import overlays or Swift overlays that hide a Clang module. Would it be better if we choose a different term for cross-import overlays, like e.g. "primary"? Also consider with this PR we'll have |
To clarify, I'm suggesting to do this regardless if we keep using "underlying" for cross-import overlays or something else. |
"primary" and "secondary" were used in the pitch, but they only show up in a single doc comment from what I can tell. Most of the code and comments use "underlying" or "shadowed" for "primary" and "bystander" for "secondary". @akyrtzi What about "declaring" to match the "declared" APIs in ModuleDecl? i.e. |
SGTM. |
1d7a238
to
058ecdd
Compare
@swift-ci please test |
Build failed |
Build failed |
@swift-ci please smoke test Linux |
Yes, "declaring" is a good term to use here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few nits; otherwise, LGTM.
include/swift/AST/Module.h
Outdated
/// either directly or transitively, populates \p bystanderNames with the set | ||
/// of bystander modules that must be present alongside \p declaring for | ||
/// the overlay to be imported and returns true. Returns false otherwise. | ||
bool getRequiredByStandersIfCrossImportOverlay( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Bystanders
, not ByStanders
.
lib/AST/Module.cpp
Outdated
return declaredCrossImportsTransitive.find(overlay) != | ||
declaredCrossImportsTransitive.end(); | ||
} | ||
if (!getNameStr().startswith("_")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Should you use Decl::hasUnderscoredNaming()
here?
(I think there are a few other places you could do that, too.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh thanks! Didn't know about that one.
lib/AST/Module.cpp
Outdated
SmallVector<ModuleDecl::ImportedModule, 16> furtherImported; | ||
ModuleDecl *overlayModule = this; | ||
|
||
// FIXME: safe to assume the underlying module of an overlay is exported? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All well-formed cross-import overlays should @_exported import
their declaring module; there are some examples in the test suite that don't, but that's just to make certain tests easier to write. So you can update this comment to explain that.
…cross-import overlays Also update code completion, indexing, interface generation and doc info to use it.
… its shadowing cross-import overlays.
058ecdd
to
1a65b84
Compare
@swift-ci please test and merge |
@swift-ci test and merge |
Removes the existing SourceFile and ModuleDecl APIs to map an overlay module decl back to its underlying module and adds a simpler getUnderlyingModule() API to ModuleDecl. Updates code completion, cursor info, doc info, interface generation and indexing to use it.
Also fixes:
Resolves rdar://problem/59445352