Skip to content

[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

Merged

Conversation

cwakamo
Copy link
Contributor

@cwakamo cwakamo commented Jan 9, 2018

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>.

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>.
@cwakamo cwakamo requested a review from jrose-apple January 9, 2018 22:43
@cwakamo
Copy link
Contributor Author

cwakamo commented Jan 9, 2018

@swift-ci Please test

@cwakamo
Copy link
Contributor Author

cwakamo commented Jan 9, 2018

@jrose-apple Feel free to add alternate reviewers if someone else should look at this code too.

DeferStmt *transformDeferStmt(DeferStmt *DS) {
if (auto *FD = DS->getTempDecl()) {
auto Implicit = FD->isImplicit();
FD->setImplicit(false);
Copy link
Contributor

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) {
Copy link
Contributor

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.

@cwakamo
Copy link
Contributor Author

cwakamo commented Jan 10, 2018

@swift-ci Please smoke test and merge

1 similar comment
@cwakamo
Copy link
Contributor Author

cwakamo commented Jan 10, 2018

@swift-ci Please smoke test and merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants