-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
Fixes crash instrumenting generic func body nested in another func #78564
Fixes crash instrumenting generic func body nested in another func #78564
Conversation
@swift-ci Please smoke test |
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.
This fix looks good to me!
lib/Sema/InstrumenterSupport.cpp
Outdated
|
||
BraceStmt *InstrumenterBase::transformBraceStmtWithLocalDeclContext( | ||
BraceStmt *BS, DeclContext *localDC, const ParameterList *PL, | ||
bool TopLevel) { |
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.
Instead of doing this you can use RAII llvm::SaveAndRestore
in a few spots were you need it.
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.
Oh cool, that looks simpler, thanks! Will take a look.
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.
Updated to use llvm::SaveAndRestore
, which simplified the changes. Thanks!
… func. The crash was caused by attempting to add logging expressions that capture generic variables while using the outer func decl context that was not the generic decl context of the inner (generic) func. The fix "pushes" the current func decl context while instrumenting the body. Rather than always using the top-level func decl context for all nested func bodies.
4629e85
to
f2846ce
Compare
@swift-ci Please smoke test |
@swift-ci Please smoke test |
The crash was caused by attempting to add logging expressions that capture generic variables while using the outer func decl context that was not the generic decl context of the inner (generic) func.
The fix "pushes" the current func decl context while instrumenting the body. Rather than always using the top-level func decl context for all nested func bodies.
rdar://127009854
rdar://127009134