-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[silgenpattern] Change catch emission to not be conditional on owners… #19986
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
[silgenpattern] Change catch emission to not be conditional on owners… #19986
Conversation
@swift-ci 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.
LGTM
// | ||
// CHECK: [[SWITCH_MATCH_FAIL_BB]]([[SUBERROR:%.*]] : @owned $HomeworkError): | ||
// CHECK: destroy_value [[SUBERROR]] | ||
// CHECK: br [[RETHROW_BB:bb[0-9]+]]([[ERROR]] : $Error) |
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.
Does there need to be an end_borrow
in SWITCH_MATCH_FAIL_BB1
.
// CHECK: br [[RETHROW_BB:bb[0-9]+]]([[ERROR]] : $Error) | ||
// | ||
// CHECK: [[CAST_NO_BB]]: | ||
// CHECK: br [[RETHROW_BB]]([[ERROR]] : $Error) |
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.
Does there need to be an end_borrow
in CAST_NO_BB
.
// CHECK: switch_enum [[SUBERROR]] : $HomeworkError, case #HomeworkError.TooHard!enumelt: {{bb[0-9]+}}, case #HomeworkError.TooMuch!enumelt: {{bb[0-9]+}}, default [[SWITCH_MATCH_FAIL_BB:bb[0-9]+]], | ||
// | ||
// CHECK: [[SWITCH_MATCH_FAIL_BB]]([[SUBERROR:%.*]] : @owned $HomeworkError): | ||
// CHECK: destroy_value [[SUBERROR]] |
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.
Same question about the end_borrow
here.
test/SILGen/errors.swift
Outdated
@@ -176,6 +176,79 @@ func all_together_now(_ flag: Bool) -> Cat { | |||
} | |||
} | |||
|
|||
// Make sure that if we catch an error in a throwing function we borrow the | |||
// error and only consume the error by the rethrow block. |
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.
only consume the error in the rethrow block.
I'll fix the comment and add in the end_borrows (they are there I just didn't add the filecheck pattern). |
…hip verification being enabled. We were missing the code-coverage needed to show this so I added some examples to test/SILGen/errors.swift. rdar://29791263
b34247a
to
447a11a
Compare
@atrick made the changes. Merging! |
@swift-ci smoke test and merge |
…hip verification being enabled.
We were missing the code-coverage needed to show this so I added some examples
to test/SILGen/errors.swift.
rdar://29791263