Commit Graph

464 Commits

Author SHA1 Message Date
Azoy
9ed732f0ab Introduce isDecl and getDeclType
fix enum logic issue

fix tests

guard against null types
2021-04-20 02:22:16 -04:00
Ben Barham
ab5a42160c [Frontend] Always emit generated ObjectiveC header when allowing errors
Resolves rdar://75754282
2021-03-25 16:19:09 +10:00
Minhyuk Kim
53d1fc481e Replace usages of .find(Key) != .end() to .contains(Key) in llvm sets 2021-02-06 18:24:20 +09:00
swift_jenkins
f2f39ea23d Merge remote-tracking branch 'origin/main' into next 2020-11-10 12:13:53 -08:00
Saleem Abdulrasool
7c968c6ccf AST: support availability on Windows
Enable Windows specific availability annotations in Swift.
2020-11-09 20:03:52 -08:00
Erik Eckstein
69edd5020a Merge remote-tracking branch 'origin/main' into next 2020-10-03 21:10:11 +02:00
John McCall
0fb407943f [NFC] Rename swift_runtime_unreachable to swift_unreachable and make it use LLVM's support when available. 2020-10-03 02:54:56 -04:00
Nathan Hawes
40b6798d35 Update usages of 'SwiftNewtypeAttr' for the new spelling 'SwiftNewTypeAttr' 2020-09-29 10:46:13 -07:00
Karoy Lorentey
a084d04500 Merge pull request #31686 from 3405691582/ManagedBuffer_WithoutMallocSize
[stdlib] ManagedBuffer independent of malloc_size.
2020-09-10 11:32:07 -07:00
3405691582
b59910ef5b Add OpenBSD to PlatformKinds.def.
In #31686 changes were introduced to ensure that capacity was stored in
the ManagedBuffer allocation, and @lorentey sugested that as a stopgap
measure for addressing the lack of platform malloc introspection on
OpenBSD, we use Swift availability attributes instead on the relevant
parts of ManagedBuffer and friends.

Since platform availability symbols must be specifically set up to be
used, this commit does so in advance of the above change.
2020-09-09 18:57:26 -04:00
Doug Gregor
daf9e2df7e [Concurrency] Print @objc async declarations as Objective-C declarations.
@objc async declarations are mapping into completion-handler-based
methods in Objective-C, so ensure that the result type, parameters,
and attributes reflect that.
2020-09-08 10:15:24 -07:00
swift_jenkins
3134f7e170 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-08-24 20:25:48 -07:00
Slava Pestov
b0208a134f AST: Move getSugaredType() from GenericEnvironment to GenericSignature
None of this actually involves archetypes, so it can just be an
operation on the GenericSignature itself.
2020-08-24 19:16:36 -04:00
Nathan Hawes
280d4c995a Merge remote-tracking branch 'upstream/master' into HEAD 2020-08-21 22:23:58 -07:00
Brent Royal-Gordon
9d4281b46b Support generic @compatibility_alias in PrintAsObjC
When @compatibility_alias is used with an ObjC generic class, this ends up importing as a generic typealias. PrintAsObjC previously didn’t handle declarations involving these types correctly; it would fail an assertion in asserts compilers, and potentially print an incorrect compatibility header in non-asserts compilers.

This PR makes it so that PrintAsObjC can now correctly use generic typealiases imported from Objective-C modules. It is, of course, still not possible to declare a generic typealias in Swift that will be printed into the Objective-C header.

Fixes rdar://67256866.
2020-08-20 16:21:50 -07:00
swift_jenkins
10d7479b62 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-08-20 15:35:35 -07:00
Brent Royal-Gordon
a60aad89a7 [PrintAsObjC] Forward-declare bridged types
The initial pass through a type’s members to forward-declare or import anything needed by them did not account for _ObjectiveCBridgeable conformances; instead, it would examine the Swift type being bridged from, either tripping an assertion or just failing to do anything. Treat these as references to the bridged type instead.

Fixes rdar://67263753.
2020-08-19 13:53:06 -07:00
Brent Royal-Gordon
a90d63df49 [NFC] Add PrettyStackTraces to ObjC forward decls
Helps identify the cause of some crashes.
2020-08-19 13:53:05 -07:00
Nathan Hawes
9d4ed5f39c Manually merge remote-tracking branch 'upstream/master' into manually-merge-master-to-master-rebranch 2020-07-20 16:09:55 -07:00
Nathan Hawes
244dc4a768 [AST] Rename PlatformKind::OSX to PlatformKind::macOS
Because the names are coming from a .def file used for printing too, this
simplifies the printing logic as well.
2020-07-08 16:29:31 -07:00
Karoy Lorentey
68351d2110 Revert "Merge remote-tracking branch 'origin/master-next'"
This reverts commit 1c9b0908e6, reversing
changes made to 3eb82c1836.
2020-06-08 16:48:38 -07:00
swift_jenkins
f17041933f Merge remote-tracking branch 'origin/master' into master-next 2020-05-21 18:38:49 -07:00
Slava Pestov
14cc7dd9bd PrintAsObjC: Fix crash when printing typedef that was imported inside an Objective-C generic class
The assertion here is too strict. The TypeAliasDecl will inherit a
generic signature from the outer context even if it does not have
generic parameters of its own. Instead, let's just assert that the
TypeAliasDecl does not have its own generic parameters.

Fixes <rdar://problem/63188938>.
2020-05-21 17:35:49 -04:00
Erik Eckstein
bdd337cd17 Merge remote-tracking branch 'origin/master' into master-next 2020-05-15 20:13:50 +02:00
Anthony Latsis
44a92a926c [NFC] GenericSignatureImpl: Spell conformsToProtocol & getConformsTo in terms of requirements 2020-05-14 22:51:44 +03:00
swift_jenkins
71686f9984 Merge remote-tracking branch 'origin/master' into master-next 2020-04-24 12:58:09 -07:00
Anthony Latsis
74252028ca AST: Rename getFullName -> getName on ValueDecl & MissingMemberDecl 2020-04-23 05:16:55 +03:00
swift_jenkins
69248bf426 Merge remote-tracking branch 'origin/master' into master-next 2020-04-21 14:17:19 -07:00
Alexis Laferrière
fa5924407d [PrintAsObjC] Don't include the module for empty extensions
rdar://problem/57133517
2020-04-20 16:36:59 -07:00
swift_jenkins
991f679164 Merge remote-tracking branch 'origin/master' into master-next 2020-04-13 21:21:23 -07:00
Doug Gregor
72ade27956 Revert "[PrintAsObjC] Don't include the module for empty extensions"
This reverts commit 8f01b2c8f8.
2020-04-10 00:08:46 -07:00
swift_jenkins
14a14a232b Merge remote-tracking branch 'origin/master' into master-next 2020-04-01 09:00:36 -07:00
Robert Widmann
630d0f631a Merge pull request #30606 from AnthonyLatsis/rename-getfullname
[NFC] Preparations to address the «Rename to getName?» TODO on ValueDecl::getFullName
2020-04-01 09:00:04 -07:00
swift_jenkins
53094cd3bf Merge remote-tracking branch 'origin/master' into master-next 2020-03-30 10:41:00 -07:00
Anthony Latsis
d0ae3ee580 [AST] Replace FuncDecl::getName & EnumElementDecl::getName with ValueDecl::getBaseIdentifier 2020-03-29 00:35:51 +03:00
Doug Gregor
bf99f31d75 Revert "PrintAsObjc: expand module @imports to header #imports if modules are not supported"
This reverts commit a2534fa234.
2020-03-27 21:02:44 -07:00
Doug Gregor
6a7a7ff781 Revert "PrintAsObjc: strip Headers and PrivateHeaders component in header paths explicitly"
This reverts commit 411833d931.
2020-03-27 21:02:32 -07:00
Doug Gregor
ab97d50b0f Revert "PrintAsObjC: use header path relative to usr/include when importing non-framework headers"
This reverts commit ebe0a45583.
2020-03-27 21:00:51 -07:00
swift_jenkins
e2fe2aeaed Merge remote-tracking branch 'origin/master' into master-next 2020-03-26 08:00:06 -07:00
Xi Ge
ebe0a45583 PrintAsObjC: use header path relative to usr/include when importing non-framework headers
We could assume usr/include belongs to header search paths. If a header
is located in a deeper location inside this directory, we need to print
the additional path components.

rdar://60857172
2020-03-25 23:30:28 -07:00
Adrian Prantl
1bd6a0a371 Adapt to upstream header file reshuffling in c915cb957dc37275ce1ca1a0b993239c82f12692. 2020-03-11 15:46:37 -07:00
swift_jenkins
91e5023f1e Merge remote-tracking branch 'origin/master' into master-next 2020-03-11 12:39:41 -07:00
Xi Ge
411833d931 PrintAsObjc: strip Headers and PrivateHeaders component in header paths explicitly
We use Header::NameAsWritten to collect the path of a header belongs to a module. Due
to an unclear clang-side issue, the path may contain "Headers/" and "PrivateHeaders/". To
walk-around this potential issue, we explicit check and remove these path components
from the Swift side.

rdar://problem/60249751
2020-03-10 14:30:09 -07:00
Rintaro Ishizaki
a7cb72fe55 Merge remote-tracking branch 'origin/master' into master-next
Conflicts:
	stdlib/public/Reflection/TypeRefBuilder.cpp
2020-03-10 12:46:49 -07:00
Alexis Laferrière
8f01b2c8f8 [PrintAsObjC] Don't include the module for empty extensions
rdar://problem/57133517
2020-03-09 14:10:44 -07:00
Alexis Laferrière
d11232b96e [PrintAsObjC] NFC Document and make isEmptyExtensionDecl public 2020-03-09 14:09:21 -07:00
Raphael Isemann
efd7163adc Merge pull request #30186 from xiaobai/fix-master-next
Fix master-next
2020-03-03 14:05:31 -08:00
Alex Langford
17b25bad5d Include clang SourceManager header where needed
These files were using clang::SourceManager with only a forward declaration.
Most likely another header was previously including the SourceManager header so
that these files got the header included transitively.
2020-03-03 12:36:11 -08:00
Xi Ge
a2534fa234 PrintAsObjc: expand module @imports to header #imports if modules are not supported
rdar://58284119
2020-03-03 11:54:14 -08:00
Xi Ge
fa659ede76 [PrintAsObjc] add macro guard against potential recursive definitions 2020-02-05 12:37:01 -08:00