Skip to content

add support for C++ symbol graphs and namespace symbols #766

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 4 commits into from
Dec 9, 2023

Conversation

QuietMisdreavus
Copy link
Contributor

Bug/issue #, if applicable: rdar://117904448

Summary

This PR starts adding support for C++ symbol graphs, based on Clang's initial support. For the moment, the c++ symbol language is currently lumped into "Objective-C" alongside C itself; proper standalone support for a "C++" language kind should be coordinated with Swift-DocC-Render to ensure that there is full support.

In addition, this PR also introduces support for namespace symbols, as those are new in C++ compared to Objective-C.

Dependencies

swiftlang/swift-docc-symbolkit#65

Testing

As C++ symbol graphs are in a state of preliminary support in Clang (they are currently on the main branch of llvm/llvm-project and are being integrated into apple/llvm-project), a basic symbol graph is included in this PR to test automatic curation. This can be used for testing as follows:

Steps:

  1. swift run docc preview 'Tests/SwiftDocCTests/Test Bundles/CxxNamespaces.docc'
  2. Load the preview, and ensure that the Foo namespace is properly curated and displayed, with class Bar underneath it.

Checklist

Make sure you check off the following items. If they cannot be completed, provide a reason.

  • Added tests
  • Ran the ./bin/test script and it succeeded
  • [ n/a ] Updated documentation if necessary

@QuietMisdreavus
Copy link
Contributor Author

@swift-ci Please test

@@ -230,6 +231,8 @@ extension AutomaticCuration {
/// Add a symbol kind to `KindIdentifier.noPageKinds` if it should not generate a page in the
/// documentation hierarchy.
static let groupKindOrder: [SymbolGraph.Symbol.KindIdentifier] = [
.namespace,
Copy link
Contributor

Choose a reason for hiding this comment

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

Why should this C++ symbol be ordered first? And does the whitespace imply you're going to add more C++ symbol kinds here in a new group?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added namespaces at the top in their own pseudo-grouping because they're purely an organizational construct, as opposed to classes, protocols, and other kinds of symbols, which reflect some other aspect of the project's API. Swift and plain Objective-C projects will not come across this, since they won't contain namespace symbols.

@QuietMisdreavus
Copy link
Contributor Author

@swift-ci Please test

@binamaniar binamaniar self-requested a review December 9, 2023 00:33
@QuietMisdreavus
Copy link
Contributor Author

@swift-ci Please test

@QuietMisdreavus QuietMisdreavus merged commit 3c30e2f into swiftlang:main Dec 9, 2023
@QuietMisdreavus QuietMisdreavus deleted the namespace-symbols branch December 9, 2023 03:12
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.

5 participants