-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[SR 5641] Implement support for defer in the playground transform and PC macro. #13835
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
[SR 5641] Implement support for defer in the playground transform and PC macro. #13835
Conversation
Added handling of `defer` statements in the playground transform. Tests will be added in a follow-on commit. Patch by Roman Levenstein! This addresses SR-5641/<rdar://problem/33764082>.
As with the playground transform, defer statements were not supported in the PC macro. This commit addresses that oversight. This partially addresses <rdar://problem/29007242>.
@swift-ci Please test |
@jrose-apple Feel free to add alternate reviewers if someone else should look at this code too. |
lib/Sema/PCMacro.cpp
Outdated
DeferStmt *transformDeferStmt(DeferStmt *DS) { | ||
if (auto *FD = DS->getTempDecl()) { | ||
auto Implicit = FD->isImplicit(); | ||
FD->setImplicit(false); |
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 don't love this hack, but I guess it's okay. Mind commenting why we have to do it, though?
@@ -153,6 +155,17 @@ class Instrumenter : InstrumenterBase { | |||
} | |||
} | |||
|
|||
DeferStmt *transformDeferStmt(DeferStmt *DS) { |
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.
…definitely a candidate for future refactoring up into InstrumenterBase.
@swift-ci Please smoke test and merge |
1 similar comment
@swift-ci Please smoke test and merge |
Implements handling of
defer
statements in both the playground transform and PC macro.Original patch for the playground transform provided by @swiftix.
Resolves SR-5641 and <rdar://problem/33764082>.