Commit Graph

2951 Commits

Author SHA1 Message Date
Doug Gregor
64a8619ba5 [Clang importer] Mark call to Builtin.zeroInitializer as non-throwing.
Found while investigating SR-8079.
2018-06-28 14:01:13 -07:00
swift-ci
93582cf46c Merge remote-tracking branch 'origin/master' into master-next 2018-06-27 08:49:23 -07:00
Christopher Rogers
b68ae2e230 Preserve availability on ObjC subscript getters and setters (#17105)
This resolves SR-7398.
2018-06-27 08:35:06 -07:00
swift-ci
a36b6407f4 Merge remote-tracking branch 'origin/master' into master-next 2018-06-22 13:29:27 -07:00
Jordan Rose
2107bdf392 [ClangImporter] Defend against ObjC properties without getters (#17429)
Objective-C provides no way to declare such a thing, so for this to
occur something else must have gone wrong. Unfortunately all we have
is a SourceKit crash log, so I couldn't write a test case. Hopefully
some day the assert will fire and we can handle this properly.

rdar://problem/41305904
2018-06-22 13:27:48 -07:00
swift-ci
5194aa4d14 Merge remote-tracking branch 'origin/master' into master-next 2018-06-22 11:49:54 -07:00
Jordan Rose
426d27c479 [ClangImporter] Hardcode NSString being bridged to String (#17412)
...so that we don't have to depend on the ObjectiveC module having API
notes for a class it doesn't actually define.

Support for rdar://problem/40278479.
2018-06-22 11:38:19 -07:00
swift-ci
4a1824018d Merge remote-tracking branch 'origin/master' into master-next 2018-06-21 11:49:28 -07:00
Jordan Rose
26325e8301 [ClangImporter] Put the Swift compiler version into the module hash (#17344)
This is overkill when we could just be better about updating the
lookup table version, but it's hard to remember to do that when
changing something in ImportName.cpp or whatever.
2018-06-21 11:40:16 -07:00
swift-ci
2a0e83dc0d Merge remote-tracking branch 'origin/master' into master-next 2018-06-18 11:00:19 -07:00
Jordan Rose
05d0a2dfef [Serialization] Mark decls that can never be cross-referenced (#17223)
This allows us to filter them out in cases that would otherwise be
ambiguous. The particular prompting situation looks a lot like the
test case: a protocol, plus a forward-declared class with the same
name. (Normally we ignore forward-declared classes, but SourceKit's
module interface generation feature makes dummy ClassDecls for them
instead.)

https://bugs.swift.org/browse/SR-4851
2018-06-18 10:50:35 -07:00
Jordan Rose
864bf89f69 [ClangImporter] Handle lookup tables with many entries (#17265)
In particular, there are frameworks with more than 65536 entries for
'init' as a base name.

I can't think of a test case for this besides actually adding such a
massive framework, but the assertions that were added here should
catch the issue in Debug builds if it ever comes up again. I'm going
to go harden everything else that uses this API next.

rdar://problem/40828315
2018-06-18 08:39:55 -07:00
swift-ci
4538ce9818 Merge remote-tracking branch 'origin/master' into master-next 2018-06-17 15:38:24 -07:00
John McCall
69f4dd1ec9 Generalize accessor storage to preserve the original accessor list.
Only not NFC because it's detectable by source tools.
2018-06-16 18:16:31 -04:00
swift-ci
bfe796b93e Merge remote-tracking branch 'origin/master' into master-next 2018-06-16 01:32:31 -07:00
Bob Wilson
351bbe8a66 [master-next] Add new fixed-point builtin types from Clang r334718
These types are not mapped into Swift but this adds them to the switches
so that the build does not fail due to unhandled enumeration values.
2018-06-15 23:09:00 -07:00
Doug Gregor
18569e5f77 Merge pull request #16963 from DougGregor/evaluator-type-checker
[Type checker] Use the request-evaluator in the type checker.
2018-06-15 22:41:31 -07:00
Bob Wilson
d933b5d60c Merge remote-tracking branch 'origin/master' into master-next 2018-06-15 20:20:25 -07:00
Jordan Rose
570ed72ea5 Add assertions to prevent truncation when using llvm::endian::Writer (#17266)
Also, stop serializing a few constant values, saving a tiny bit of
space in swiftmodule files.
2018-06-15 19:26:35 -07:00
swift-ci
0bb30339e0 Merge remote-tracking branch 'origin/master' into master-next 2018-06-15 15:09:09 -07:00
Doug Gregor
1dab41c489 [Clang importer] Improve a comment about block types and bridging. 2018-06-15 14:42:03 -07:00
Doug Gregor
f595ca7afd [Clang importer] Rename ImportTypeKind::ObjCGenericArgument -> ObjCCollectionElement.
This better describes what we're importing. Also note why we need to
reset to the block representation.
2018-06-15 13:48:36 -07:00
Doug Gregor
d529002009 [Clang importer] Don't bridge blocks to Swift functions in ObjC generic args.
While the compiler can bridge C block types to Swift function types,
the Swift runtime cannot. Don't bridge block types to Swift function
types in Objective-C generic arguments, so

  NSArray<some-block-type>

will get imported as

  [@convention(block) (...) -> Whatever]

rather than

  [(...) -> Whatever]

Fixes rdar://problem/40879067 in a fairly narrow way; the Clang
importer's approach to adjusting types based on context needs a
cleanup, but this is the safe, localized fix suitable for 4.2.
2018-06-15 13:04:30 -07:00
Bob Wilson
5df3d1f100 Merge remote-tracking branch 'origin/master' into master-next 2018-06-14 20:51:48 -07:00
Doug Gregor
2b2e143f59 [Request-Evaluator] Introduce a request for getting an "inherited type". 2018-06-14 15:29:57 -07:00
John McCall
9022b5152f Rename accessor kinds from IsGetter -> IsGet, etc.
Introduce some metaprogramming of accessors and generally prepare
for storing less-structured accessor lists.

NFC except for a change to the serialization format.
2018-06-14 17:08:55 -04:00
swift-ci
526de1f08d Merge remote-tracking branch 'origin/master' into master-next 2018-06-14 00:28:56 -07:00
Pavel Yaskevich
2be766dd35 Merge pull request #17164 from xedin/rdar-39849926
[ClangImporter] Forward generic parameters while importing generic @c…
2018-06-14 00:10:35 -07:00
swift-ci
09ffbea54b Merge remote-tracking branch 'origin/master' into master-next 2018-06-13 21:28:57 -07:00
Slava Pestov
cd5d7386d1 Merge pull request #17043 from slavapestov/small-progress-on-killing-inout-type
Remove some usages of InOutType
2018-06-13 21:22:41 -07:00
swift-ci
504aa0a25a Merge remote-tracking branch 'origin/master' into master-next 2018-06-13 20:29:10 -07:00
Kuba (Brecka) Mracek
6c33cfa2b2 When loading Obj-C methods via a selector and the method is an accessor, import the property as well. (#17150) 2018-06-13 20:19:14 -07:00
Slava Pestov
296ce3f312 AST: Remove hack-around for getInterfaceType() on ParamDecl returning InOutType
Most callers did not want the InOutType here, and checked
the ParamDecl's flags instead.
2018-06-13 15:38:52 -07:00
Pavel Yaskevich
1f3714f264 [ClangImporter] Forward generic parameters to renamed typealias
While trying to import declaration which requires renaming forward
generic parameters (if any) to newly created typealias.
2018-06-13 14:59:47 -07:00
Pavel Yaskevich
094949a461 [ClangImporter] Forward generic parameters while importing generic @compatibility_alias
When importing @compatibility_alias declarations check if underlying declaration
is generic and if so, forward generic environment and generic parameters (if any)
to newly created typealias declaration, otherwise there is going to be a mismatch
between type associated with typealias and its declaration which leads to crashes.

Resolves: rdar://problem/39849926
2018-06-13 14:59:34 -07:00
swift-ci
aabdb29b50 Merge remote-tracking branch 'origin/master' into master-next 2018-06-12 17:29:28 -07:00
swift-ci
39cd2f93be Merge pull request #17127 from CodaFi/liliput 2018-06-12 17:20:07 -07:00
Bob Wilson
c3e02955bb [master-next] Adjust for VersionTuple moving from clang to llvm.
LLVM r334399 (and related Clang changes) moved clang::VersionTuple to
llvm::VersionTuple. Update Swift to match.

Patch by Jason Molenda.
rdar://problem/41025046
2018-06-12 16:44:11 -07:00
Bob Wilson
796122fa45 Merge remote-tracking branch 'origin/master' into master-next 2018-06-12 15:06:47 -07:00
Jordan Rose
a6ae2d7742 Hack: Force UIEdgeInsets.zero to always come from the SDK (#17122)
...instead of relying on the one in the overlay in pre-4.2 versions of
Swift. This caused crashes in deserialization, which (deliberately)
doesn't respect availability.

There are three changes here:

- Remove UIEdgeInsets.zero and UIOffset.zero from the UIKit overlay.
- Always use the 4.2 name for UIEdgeInsetsZero and UIOffsetZero from
  the underlying UIKit framework. (This is the nested name.)
- Ignore the unavailability messages for those two constants in
  pre-4.2 Swift, since we're now relying on them being present.

The latter two, the compiler changes, can go away once UIKit's API
notes no longer specify different pre-4.2 behavior, but meanwhile we
need to keep compatibility with the SDKs released in Xcode 10b1.

https://bugs.swift.org/browse/SR-7879
2018-06-12 13:40:23 -07:00
Robert Widmann
26d2795efc Excise simpler uses of getInput 2018-06-11 17:29:29 -07:00
swift-ci
9b3cec17d6 Merge remote-tracking branch 'origin/master' into master-next 2018-06-07 00:09:42 -07:00
Slava Pestov
c968a2014a Fix a couple of nits 2018-06-06 22:55:01 -07:00
swift-ci
ce158d0650 Merge remote-tracking branch 'origin/master' into master-next 2018-06-06 13:29:09 -07:00
Doug Gregor
bc0445d1f7 Narrow a few LazyResolver::resolveDeclSignature() calls to what they really need.
Specifically, introduce entrypoints for "resolve overridden decl" and "is @objc". These can
be computed cheaply in many more cases.
2018-06-04 18:15:39 -07:00
Doug Gregor
1b7c4917ba [Clang importer] Fix weird indentation 2018-06-04 17:36:24 -07:00
Bob Wilson
06132c21e1 [master-next] Add new builtin fixed-point types from Clang r333923
These new types are not yet imported for Swift but they need to be
included in the switch cases to avoid -Wswitch warnings that get promoted
to errors when building with -Werror.
2018-06-04 17:31:23 -07:00
Doug Gregor
e1ce0a9f56 [AST/ClangImporter] Eliminate layering violation with isInOverlayModuleForImportedModule.
https://github.com/apple/swift/pull/16951 introduced a layering violation between the
AST and ClangImporter libraries; break the layering violation by moving the function
isInOverlayModuleForImportedModule() to ClangModuleLoader.
2018-06-04 16:40:45 -07:00
Vedant Kumar
105a61e50d Use LLVM_DEBUG() instead of DEBUG()
Upstream has renamed the DEBUG() macro to LLVM_DEBUG. This updates swift
accordingly:

$ find . -name \*.cpp -print -exec sed -i "" -E "s/ DEBUG\(/ LLVM_DEBUG(/g" {} \;
2018-05-24 13:10:45 -07:00
swift-ci
ae74f69539 Merge remote-tracking branch 'origin/master' into master-next 2018-05-23 19:29:19 -07:00