Commit Graph

2477 Commits

Author SHA1 Message Date
swift-ci
0302515cf0 Merge remote-tracking branch 'origin/master' into master-next 2017-12-18 12:48:55 -08:00
Jordan Rose
e1f46b5a26 [ClangImporter] Handle subscript getters redeclared in subclasses (#13470)
Objective-C subscripts don't have special declarations like
properties; they're just specially-named methods (or method pairs),
and we have to make an independent SubscriptDecl in Swift. This means
that when a subclass wants to make a subscript settable, they just add
the appropriately-named setter method.

Swift handled this by detecting when the getter and setter weren't
declared in the same type, and assuming this meant it was a subclass
adding a setter. Unfortunately, the same condition /also/ picked up
the case where the getter (and only the getter) is /redeclared/ in a
subclass (perhaps to add an attribute), and the new subscript was
getting added to the base class instead of the subclass.

The fix relies on the fact that the original decl we provide is what
we use to look up the other accessor. If the getter and setter are in
different types, whichever one we started with must be the
more-derived one. So the final change is just "did we start with the
setter?" rather than "is there a setter at all?".

I'm not sure why this is only just now causing problems, given that we
seem to have been getting this wrong for years, but it definitely
/was/ wrong and now it's not.

rdar://problem/36033356
2017-12-18 11:01:34 -08:00
swift-ci
152201f5b9 Merge remote-tracking branch 'origin/master' into master-next 2017-12-16 00:49:29 -08:00
Doug Gregor
8c05278ef3 [Clang importer] Lazily load all named members with a matching base name.
When loading the named members for a given name, we want to load all
of the members with that base name... not only the ones that match the
full name, because the lookup table is indexed by base name and
filtering too early drops candidates.

Fixes rdar://problem/36085994.
2017-12-15 23:54:36 -08:00
swift-ci
b3c06162ae Merge remote-tracking branch 'origin/master' into master-next 2017-12-12 17:49:40 -08:00
Slava Pestov
1f1fa3b91d AST: Remove NominalTypeDecl::hasDelayedMembers() 2017-12-12 14:01:55 -08:00
Slava Pestov
db7aa52c5c ClangImporter: Simplify finishPendingActions() 2017-12-12 14:01:54 -08:00
swift-ci
6ff2742a29 Merge remote-tracking branch 'origin/master' into master-next 2017-12-06 16:50:13 -08:00
Zac Bowling
f71456eb1b Define _GNU_SOURCE when importing glibc on Fuchsia (#13105)
Some functions and types are hidden behind feature flags.

_GNU_SOURCE exposes the most symbols and methods in glibc
and musl. Currently only turning it on for the Fuchsia triple.
2017-12-06 16:48:52 -08:00
swift-ci
1b077eb1eb Merge remote-tracking branch 'origin/master' into master-next 2017-12-06 10:31:02 -08:00
swift-ci
68a4b439e2 Merge pull request #13293 from adrian-prantl/35714074 2017-12-06 10:24:00 -08:00
Adrian Prantl
97f9e4e367 Don't pass -Werror to ClangImporter's clang when Swift is used from within LLDB.
This works a around search path problems caused by a module existing
in both the build/install directory and the source directory.

<rdar://problem/35714074>
2017-12-06 09:22:29 -08:00
swift-ci
d4c18c28c0 Merge remote-tracking branch 'origin/master' into master-next 2017-12-05 16:30:13 -08:00
Rintaro Ishizaki
08ef4e324f [CMake] Add swift-syntax-generated-headers to the global dependencies 2017-12-05 17:03:12 +09:00
swift-ci
31d959475d Merge remote-tracking branch 'origin/master' into master-next 2017-12-04 01:10:39 -08:00
Graydon Hoare
f937e33c9b [NamedLazyMemberLoading] Bail on nominals with globals-as-members. 2017-12-02 02:14:48 -08:00
Graydon Hoare
3e76aebee1 [NamedLazyMemberLoading] Support named loading from ObjC categories. 2017-12-01 16:52:25 -08:00
Graydon Hoare
8813935638 [NamedLazyMemberLoading] Bail on cases that interact with protocol member mirroring. 2017-12-01 16:52:25 -08:00
Graydon Hoare
eba924b1c2 [ClangImporter] call addImplicitDestructor() on imported CF types. 2017-12-01 16:52:25 -08:00
swift-ci
bc7f24c672 Merge remote-tracking branch 'origin/master' into master-next 2017-12-01 11:50:24 -08:00
Jordan Rose
5edbefcc69 [ClangImporter] Break circularity when importing macros (#13099)
Rather than being smart about this, just record an import failure when
we start importing a particular macro and update it at the end. Also
add a PrettyStackTrace to make this a little easier to track down in
the future.

The old logic for importing macros that just aliased other macros
managed to handle this in a clever way, but that was never tested for
the newer logic that evaluates expressions (fa834e2f80). Macro
importing in general probably deserves some cleanup, but meanwhile we
should make sure not to crash!

rdar://problem/34986930
2017-12-01 11:42:49 -08:00
swift-ci
75e5e6e1bd Merge remote-tracking branch 'origin/master' into master-next 2017-12-01 07:30:21 -08:00
Arnold Schwaighofer
eba12a7c3e Revert "Finish and default-enable named lazy member loading" 2017-12-01 07:25:54 -08:00
swift-ci
77e50e08da Merge remote-tracking branch 'origin/master' into master-next 2017-12-01 02:32:31 -08:00
swift-ci
7e6f7e1c04 Merge pull request #12843 from graydon/force-on-named-lazy-member-loading 2017-12-01 02:32:10 -08:00
Graydon Hoare
a967f8c6ea [NamedLazyMemberLoading] Support named loading from ObjC categories. 2017-11-30 22:27:58 -08:00
Graydon Hoare
b32f4f4185 [NamedLazyMemberLoading] Bail on cases that interact with protocol member mirroring. 2017-11-30 22:01:06 -08:00
Graydon Hoare
0e3bde6744 [ClangImporter] call addImplicitDestructor() on imported CF types. 2017-11-30 22:01:06 -08:00
swift-ci
d6d1c99fc1 Merge remote-tracking branch 'origin/master' into master-next 2017-11-28 09:09:11 -08:00
Jordan Rose
f5989d2f6f [ClangImporter] Don't use instance methods to suppress class methods (#13100)
(and vice versa)

Inadvertant fallout from 7725e38d96, which concerned accidental ambiguity
when mirroring protocol methods onto an implementing class.

https://bugs.swift.org/browse/SR-5959
2017-11-28 08:53:08 -08:00
swift-ci
bbf1f193ef Merge remote-tracking branch 'origin/master' into master-next 2017-11-17 08:09:00 -08:00
Doug Gregor
7ec8512b11 Merge pull request #12970 from DougGregor/conformance-interface-type
[AST] Store only interface types in NormalProtocolConformances.
2017-11-17 07:52:59 -08:00
swift-ci
d676aafe85 Merge remote-tracking branch 'origin/master' into master-next 2017-11-16 21:49:01 -08:00
Slava Pestov
ca1586d667 ClangImporter: Don't synthesize zero initializer body if we finished type checking 2017-11-16 21:11:41 -08:00
Huon Wilson
5f70f68c0d [AST] Store only interface types in NormalProtocolConformances.
Rather than storing contextual types in the type witnesses and associated
conformances of NormalProtocolConformance, store only interface types.

@huonw did most of the work here, and @DougGregor patched things up to
complete the change.
2017-11-16 11:45:18 -08:00
swift-ci
29c42a4633 Merge remote-tracking branch 'origin/master' into master-next 2017-11-16 00:09:16 -08:00
Slava Pestov
2920b4fd1c AST: Remove DeclContext::mapTypeOutOfContext() 2017-11-15 22:52:28 -08:00
swift-ci
15926d17de Merge remote-tracking branch 'origin/master' into master-next 2017-11-15 16:29:21 -08:00
Slava Pestov
29279afd9b Merge pull request #12940 from slavapestov/clang-importer-type-checked-ast
ClangImporter: Synthesize fully-type checked AST for common functions
2017-11-15 16:23:20 -08:00
swift-ci
b81e409fd5 Merge remote-tracking branch 'origin/master' into master-next 2017-11-15 11:49:16 -08:00
Francis Ricci
71477f0dda Merge pull request #12702 from fjricci/objc_interop
Objc interop
2017-11-15 14:45:22 -05:00
swift-ci
7afa5a5701 Merge remote-tracking branch 'origin/master' into master-next 2017-11-15 00:29:28 -08:00
Graydon Hoare
97ac580384 Merge pull request #12782 from graydon/fix-35198678-a-little-better
Fix 35198678 a little better
2017-11-15 00:21:47 -08:00
Slava Pestov
415fce274b ClangImporter: Synthesize fully-type checked AST for common functions
These kinds of synthesized declarations no longer need to go
through the constraint solver, since they have simple enough
bodies that we can construct type checked AST directly:

- rawValue getter and init(rawValue:)
- memberwise struct initializer
- zero struct initializer
2017-11-14 21:52:29 -08:00
swift-ci
358f5181bf Merge remote-tracking branch 'origin/master' into master-next 2017-11-08 16:09:33 -08:00
Doug Gregor
a49455e3b2 [Clang importer] Move the "all properties" lists into the name importer.
Swift's ASTContext contained all of the logic to find the complete list
of properties for an Objective-C class, which is used by the Clang importer
to influence the mapping of Objective-C names into Swift. Swift's
ASTContext also included a *cache* for this information, indexed by
the Clang `ObjCInterfaceDecl *`. However, this cache was getting
populated/queried from the Clang importer's name importer, such that
the keys would be Clang declarations used to build modules and then
deallocated. If that memory eventually gets reused for a different
`ObjCInterfaceDecl *`, we would get incorrect/stale all-properties
information.

Almost Surely fixes rdar://problem/35347167, which is a
nondeterministic failure where UIView's `addGestureRecognizer(_:)` gets
occasionally imported as `add(_:)`.
2017-11-08 15:25:15 -08:00
Graydon Hoare
c179431724 [ClangImporter] Use ClassDecl::addImplicitDestructor more thoroughly. 2017-11-06 14:59:51 -08:00
Francis Ricci
3d1889c015 ClangImporter: default to ios objc runtime on non-darwin platforms
This allows objc interop to be tested on non-darwin platforms. The iOS
runtime is used because the abi is the same as the macOS abi, but without
fragility concerns.
2017-11-06 13:30:37 -08:00
Saleem Abdulrasool
4dba0a33c3 ClangImporter: allow control over ObjCInterop
Select the language for the clang importer based on the
`-enable-objc-interop` flag rather than target.  This paves the road to
enabling ObjC tests on non-Darwin targets as well as building on Darwin
without ObjC interop.
2017-11-06 13:30:36 -08:00
Saleem Abdulrasool
67fae0356c ClangImporter: minor clang-format fixing (NFC) 2017-11-06 13:30:36 -08:00