Skip to content

[5.3][IDE][DocSupport] Fix DocInfo missing decls when generated for clang submodules. #31596

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

nathawes
Copy link
Contributor

@nathawes nathawes commented May 6, 2020

Cherry-pick of #31589 for 5.3.

  • Explantion
    Our handling of clang submodules was different between sourcekitd's DocInfo and InterfaceGen requests. For InterfaceGen submodules were mapped back to their top-level clang modules (or their Swift overlay if it had one) before being passed into printSubmoduleInterface, along with the dot separated name of the submodule.

    For DocInfo, they were not, and only the rightmost component of their name was passed. The call to retrieve the decls from a ModuleDecl doesn't work if the ModuleDecl wraps a clang submodule, so we were missing these decls.

    InterfaceGen for submodules also shouldn't have been mapping back to the overlays of their top-level clang modules, but instead just the top-level clang modules themselves, as that meant we ended up printing import decls from the Swift overlay in the submodule interfaces.

  • Scope of issue: User-facing generated interfaces would include imports that weren't present in the original module for clang submodule interfaces, and DocInfo for clang submodules would be missing most decls they contained.

  • Origination: Unclear. I suspect this has been an issue for a long time.

  • Risk: Low. This only impacts sourcekitd (not the compiler) and only the DocInfo and InterfaceGen requests.

  • Testing: Added a regression test for these cases and all existing tests pass. Also verified interface generation for clang submodules works in Xcode after these changes.

  • Reviewer: Argyrios Kyrtzidis (@akyrtzi) on the master branch PR.

Resolves rdar://problem/57338105

…submodules.

Out handling of clang submodules was handled differently between DocInfo and
InterfaceGen. For InterfaceGen submodules were mapped back to their top-level
clang modules (or their Swift overlay if it had one) before being passed
into printSubmoduleInterface, along with the dot separated name of the submodule.

For DocInfo, they were not, and only the rightmost component of their name was
passed. The call to retrieve the decls from a ModuleDecl doesn't work if the
ModuleDecl wraps a clang submodule, so we were missing these decls.

InterfaceGen for submodules also shouldn't have been mapping the module back to
the overlay of top-level clang module, as that meant we ended up printing
import decls from the Swift overlay in the submodule's interface.

Resolves rdar://problem/57338105
@nathawes nathawes requested a review from akyrtzi May 6, 2020 20:15
@nathawes nathawes requested a review from a team as a code owner May 6, 2020 20:15
@nathawes
Copy link
Contributor Author

nathawes commented May 6, 2020

@swift-ci please test

@nathawes
Copy link
Contributor Author

nathawes commented May 6, 2020

@swift-ci please nominate

@nathawes nathawes added the r5.3 label May 6, 2020
@nathawes nathawes merged commit 4402113 into swiftlang:release/5.3 May 6, 2020
@nathawes nathawes deleted the doc-info-missing-submodule-decls-5.3 branch May 6, 2020 23:53
@AnthonyLatsis AnthonyLatsis added swift 5.3 🍒 release cherry pick Flag: Release branch cherry picks labels Jan 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍒 release cherry pick Flag: Release branch cherry picks swift 5.3
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants