Skip to content

[ownership-verifier] Teach the ownership verifier how to handle unreachable code. #7443

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
merged 2 commits into from
Feb 14, 2017

Conversation

gottesmm
Copy link
Contributor

[ownership-verifier] Teach the ownership verifier how to handle unreachable code.

There are a few different use cases here:

  1. In Raw SIL, no return folding may not have been run yet implying that a call
    to a no-return function /can/ have arbitrary control flow after it (consider
    mandatory inlined functions). We need to recognize that the region of code that
    is strictly post dominated by the no-return function is "transitively
    unreachable" and thus leaking is ok from that point. Footnote 1.

  2. In Canonical and Raw SIL, we must recognize that unreachables and no-return
    functions constitute places where we are allowed to leak.

rdar://29791263


Footnote 1: The reason why this is done is since we want to emit unreachable
code diagnostics when we run no-return folding. By leaving in the relevant code,
we have preserved all of the SILLocations on that code allowing us to create
really nice diagnostics.

…chable code.

There are a few different use cases here:

1. In Raw SIL, no return folding may not have been run yet implying that a call
to a no-return function /can/ have arbitrary control flow after it (consider
mandatory inlined functions). We need to recognize that the region of code that
is strictly post dominated by the no-return function is "transitively
unreachable" and thus leaking is ok from that point. *Footnote 1*.

2. In Canonical and Raw SIL, we must recognize that unreachables and no-return
functions constitute places where we are allowed to leak.

rdar://29791263

----

*Footnote 1*: The reason why this is done is since we want to emit unreachable
code diagnostics when we run no-return folding. By leaving in the relevant code,
we have preserved all of the SILLocations on that code allowing us to create
really nice diagnostics.
@gottesmm
Copy link
Contributor Author

@swift-ci Please smoke test and merge

@swift-ci swift-ci merged commit b454c78 into swiftlang:master Feb 14, 2017
@gottesmm gottesmm deleted the ownership_unreachable_code branch February 14, 2017 01:10
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.

2 participants