-
Notifications
You must be signed in to change notification settings - Fork 10.5k
add support to getTopLevelDecls for clang submodules #76401
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
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
2052534
add support to getTopLevelDecls for clang submodules
QuietMisdreavus f0a94ef
auto-reexport inferred exported submodules
QuietMisdreavus f6cab92
remove the now-unneeded shouldCollectDisplayDecls method
QuietMisdreavus 85b4785
gate UmbrellaSubmodules test on objc_interop
QuietMisdreavus 537ab83
handle clang module export statements in SymbolGraphGen
QuietMisdreavus 6cba9ff
review: replace loop in isSubmoduleOf with call to clang version
QuietMisdreavus 05041cd
review: add 'visited' set to collectExportedImports
QuietMisdreavus e0192f7
update test to handle nondeterminism
QuietMisdreavus 9daa5a5
crawl underlying clang modules for re-exports
QuietMisdreavus 10818f5
collect submodule symbols into the parent module if it has an umbrell…
QuietMisdreavus b7925b6
sort namespace redecls before printing them
QuietMisdreavus 0e4daad
use full module name for filenames and metadata
QuietMisdreavus 1c46b14
when there's no export or umbrella, export all submodules
QuietMisdreavus File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
If the import graph is not a tree, you will push the same node multiple times on the stack and repeat the work of visiting its successors. Eg, suppose we're asked to collectExportedImports() of
A
with the import graph below, where A re-exports B and C, B and C both re-export D, etc:We're going to visit D twice, G four times, J eight times, etc, so this algorithm has a worst case running time of
O(2^n)
. You can fix this by adding avisited
set alongsidestack
. Before pushing something on the stack, check if it's already been visited, and skip it if so.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.
Nice catch! I've just pushed a commit that adds a
visited
set to counteract this.