-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[AST] don't skip walking VarDecls from parent clang nodes #38394
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
rdar://80235766
@swift-ci Please test |
@swift-ci Please build toolchain macOS platform |
lib/AST/ASTWalker.cpp
Outdated
@@ -1251,7 +1251,7 @@ class Traversal : public ASTVisitor<Traversal, Expr*, Stmt*, | |||
D->getDeclContext()->getParentSourceFile()) | |||
return true; | |||
if (Decl *ParentD = Walker.Parent.getAsDecl()) | |||
return (isa<NominalTypeDecl>(ParentD) || isa<ExtensionDecl>(ParentD)); | |||
return (!D->hasClangNode() && (isa<NominalTypeDecl>(ParentD) || isa<ExtensionDecl>(ParentD))); |
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.
Did checking D->getParentPatternBinding()
not work here? I'm concerned we'll still visit some VarDecls twice because the ClangImporter does seem to create PBDs for some VarDecls.
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.
Casting to a VarDecl and checking for VD->getParentPatternBinding()
caused availability checking to start erroneously failing, preventing the standard library from building (and failing a bunch of tests as well).
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.
Should it only check for the parent pattern binding if the parent is a decl, i.e. in the branch i edited?
Unrelated CI error. @swift-ci Please test |
@swift-ci Please build toolchain macOS platform |
macOS Toolchain Install command |
@swift-ci Please test |
@swift-ci Please build toolchain macOS platform |
macOS Toolchain Install command |
Resolves rdar://80235766
The ASTWalker skips VarDecl nodes that it thinks have PatternBindingDecls that can be walked later. However, this excludes decls that came from Clang modules, which includes Objective-C properties. This causes some of these properties to be missing when rendered into a symbol graph. This PR prevents the ASTWalker from skipping VarDecls whose parent Decls have Clang nodes.