Skip to content

[6.0] Symbol graph cherry picks #7659

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 2 commits into from
Jun 13, 2024
Merged

Conversation

rauhul
Copy link
Member

@rauhul rauhul commented Jun 12, 2024

Explanation: Updates swift package dump-symbol-graph to pass the correct set of include and cxx interoperability mode flags. This fixes a bug where were are unable to extract the symbol graph from swiftmodules with transitive cxx modules because we parsed cxx headers as c headers.

With these changes swift-mmio is able to generate symbol graphs and documentation using the swift package dump-symbol-graph and swift package generate-documentation commands.

Scope: Documentation generation

Issue:

Original PR: #7610, #7621

Risk: Low

Testing: CI & at desk usage directly and via SwiftPM

Reviewer: @xedin

rauhul added 2 commits June 12, 2024 13:34
In order to extract symbol graphs for modules with transitive imports on
C++ modules we need parse headers in C++ interop mode using the option:
`-cxx-interoperability-mode=default`. This commit updates
`swift-symbolgraph-extract` to pass the option when there is a C++
module in the import graph.

This option is a new addition to `swift-symbolgraph-extract` added in
swiftlang/swift#73963.

Prior to this option's introduction, extracting the symbol graph for C++
dependent modules would fail with an error similar to: "unknown type
name 'namespace'".

With this SwiftPM commit and `swift-symbolgraph-extract` _prior_ to
swiftlang/swift#73963, users will instead see an argument parsing error
like: "unknown option -cxx-interoperability-mode".

With this change and `swift-symbolgraph-extract` change in
swiftlang/swift#73963, the symbol graph is extracted properly.
Fixes an architecture and implementation bug where the include paths
for `swift-symbolgraph-extract` were being determined inside build plan
instead of by the target build description. This bug resulted in the
wrong set of paths being determined.

The new code moves the path determination logic into the proper target
build descriptions and releverages the already computed include paths.
The result of this is symbol graphs can be generated for Swift and C
targets properly now without duplicate module in the search paths and
with correct `-fmodule` usage.
@rauhul rauhul requested a review from a team as a code owner June 12, 2024 20:47
@rauhul
Copy link
Member Author

rauhul commented Jun 12, 2024

@swift-ci test

@rauhul rauhul enabled auto-merge (rebase) June 12, 2024 20:53
@rauhul rauhul merged commit 20c3e0c into release/6.0 Jun 13, 2024
5 checks passed
@rauhul rauhul deleted the symbol-graph-cherry-picks branch June 13, 2024 00:49
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