-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[IDE] Visit auxiliary declarations if walking expansions #66421
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
@swift-ci please test |
132fc92
to
4909e6b
Compare
lib/AST/ASTWalker.cpp
Outdated
if (!doIt(expr)) | ||
alreadyFailed = true; | ||
alreadyFailed = doIt(expr); |
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.
@hamishknight do you have the refactoring itch again by any chance :)?
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.
Heh, maybe one day, also need to do SourceEntityWalker :)
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.
So. Fun story. These were actually correct. They were checking for nullptr
, not for bool. doIt(Decl*)
returns true on failure. The others return nullptr
. Yay implicit conversions.
@swift-ci please test |
if (shouldWalkMacroArgumentsAndExpansion().second) { | ||
D->visitAuxiliaryDecls([&](Decl *auxDecl) { | ||
if (Action.Action == PostWalkAction::Stop) |
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.
Out of curiosity, I wonder how bad it would be if the ASTWalker did this by default when visiting a Decl? Does seem kind of weird that it will visit some expansions but not others when you ask it to walk expansions
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.
I originally put it in Decl::walk (#66399). That's incorrect since doIt
is called directly in the walk and thus we'd miss visiting auxiliary decls on members (note the test I added since then).
I could have moved to eg. doIt(Decl *) but there's callers that really expect to just walk the given node (eg. TypeCheckFunctionBodyRequest calls performAbstractFuncDeclDiagnostics), so that also doesn't work. So I went with the easier change of only impacting SourceEntityWalker, which only has a couple uses that walk expansions.
Also odd is that we walk into the extension while possible within a type, rather than at the top level.
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.
Hrm yeah, that's fair
4909e6b
to
d281c7e
Compare
After visiting declarations, also walk into their auxiliary decls if expansions are being walked. Resolves rdar://109548265.
d281c7e
to
b3af130
Compare
@swift-ci please test |
After visiting declarations, also walk into their auxiliary decls if expansions are being walked.
Resolves rdar://109548265.