Skip to content

[4.0] Collected fixes #8970

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 5 commits into from
Apr 24, 2017
Merged

Conversation

DougGregor
Copy link
Member

A collection of varied fixes for the 4.0 branch:

  • Mark conformances as "used" when the GenericSignatureBuilder needs them. Fixes rdar://problem/31759258
  • Don't transfer ibaction attributes from Objective-C methods to their Swift counterparts if it doesn't make sense for Swift. Fixes rdar://problem/31776315
  • Fix a stack-use-after-scope error in protocol conformance formation. Fixes rdar://problem/31708629
  • Tolerate partially-type-checked ASTs, for general sanity with +Asserts builds

When the type checker forms a GenericSignatureBuilder to process
requirements, the GSB may look up concrete conformances. Route such
requests through TypeChecker::conformsToProtocol() so they can be
marked as used. This fixes multi-file scenarios where conformances
from another file might be used only in a generic signature in the
primary file, e.g., rdar://problem/31759258.

(cherry picked from commit 449aa2f)
…ense.

Fixes an error emitted on declarations imported from Objective-C,
rdar://problem/31776315.

(cherry picked from commit facf199)
…tribute.

No part of the compiler, including the Clang importer, should
synthesize an attribute that would fail early attribute
validation. When it happens, it would emit diagnostics with no
location information, which is really annoyingly hard to debug.

Instead, assert that this doesn't happen, i.e., both that the Clang
importer doesn't synthesize bogus attributes (as in the previous
commit) and that nothing synthesizes such attributes with empty source
location informations.

In non-asserting builds, just suppress the diagnostic.

(cherry picked from commit 25ce6fa)
ASan found this amusing stack-use-after-scope problem in the AST
that's been around for a long while. It was introduced when
`ModuleDecl::lookupConformance()` changed from returning an

    llvm::PointerIntPair<ProtocolConformance *, 2>

to an

    Optional<ProtocolConformanceRef>

In the former, `getPointer()` grabbed the `ProtocolConformance*`, which
was fine. In the latter, it produced a `ProtocolConformanceRef*`
pointing into a temporary value.

Fixes rdar://problem/31708629.

(cherry picked from commit 47987cb)
We can get partially-validated ASTs when they are created by the Clang
importer, but not otherwise needed or after new code can be
introduced. Avoid doing the "checked" verification on such ASTs, to
make assertions-enabled builds more useful for testing.

This is the wrong long-term solution: the AST verifier should tolerate
partially-type-checked ASTs at a finer granularity, but doing so is a
larger project than I can take on at the moment.

(cherry picked from commit 2c32f72)
@DougGregor
Copy link
Member Author

@swift-ci please test and merge

@DougGregor DougGregor merged commit aa14bb4 into swiftlang:swift-4.0-branch Apr 24, 2017
@DougGregor DougGregor deleted the misc-fixes-4.0 branch April 24, 2017 22:35
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.

1 participant