Commit Graph

40755 Commits

Author SHA1 Message Date
John McCall
b51a69f29f Count tail-padding in the size of imported C types.
This allows us to freely pass the address of a variable of such
types to a C function without worrying about it overwriting other
things if e.g. it memcpy's sizeof(T) bytes and thus clobbers the
otherwise-non-existent tail padding.

There are ways to get this optimization back, but they require
things like materializing to a temporary instead of passing the
address directly.  We haven't done that work yet, so we don't
get to take advantage of it.

rdar://26828018
2016-08-02 13:26:11 -07:00
Doug Gregor
212ffadf5e Improve diagnostic for Error compositions not being representable in Objective-C.
Thanks, Jordan!
2016-08-02 10:21:01 -07:00
Doug Gregor
6575877124 [@objc checking] Only 'Error' is representable in Objective-C (as 'NSError').
Don't allow types conforming to 'Error' or protocol compositions
involving 'Error' to be reflected in Objective-C. We still allow
bridging conversions, but they are not statically bridged. Fixes
SR-2249/rdar://problem/27658940.
2016-08-02 10:13:54 -07:00
Arnold Schwaighofer
b43e1e745e Merge pull request #3928 from aschwaighofer/fix_abi_v7k_test_cases
Fix abi_v7k IR,asm test cases
2016-08-02 09:51:38 -07:00
Arnold Schwaighofer
8c67c202df Fix abi_v7k IR,asm test cases
We pass an optional float as a pair of i32,i1 on armv7k.

rdar://27341290
2016-08-02 08:58:45 -07:00
John McCall
29ccaafc81 Merge pull request #3882 from apple/WIP-SE-0117
Implement SE-0117 (DON'T MERGE)
2016-08-02 08:56:02 -07:00
Chris Lattner
300462ea45 fix <rdar://problem/27650521> Fixits for escaping closure parameters are inserted into wrong location 2016-08-02 08:48:57 -07:00
John McCall
afdda3d107 Implement SE-0117.
One minor revision: this lifts the proposed restriction against
overriding a non-open method with an open one.  On reflection,
that was inconsistent with the existing rule permitting non-public
methods to be overridden with public ones.  The restriction on
subclassing a non-open class with an open class remains, and is
in fact consistent with the existing access rule.
2016-08-02 07:46:38 -07:00
swift-ci
328866ace9 Merge pull request #3855 from slavapestov/fix-bad-diagnostic 2016-08-01 21:51:43 -07:00
Doug Gregor
6d2f11a305 [Type checker] Synthesize Error._code witnesses as 'final' within a class.
When synthesizing the witness for Error._code, synthesize it as
final. This isn't meant to be user-visible (and, therefore, isn't
meant to be user-overridable), so it's a minor efficiency
win. Moreover, we weren't making sure this member got synthesized in
in cross-module situations, leading to runtime crashes. Fixes
rdar://problem/27335637.
2016-08-01 21:27:51 -07:00
Slava Pestov
9a1fa52ff2 Sema: Fix bogus 'parameters may not have the 'var' specifier' diagnostic
If an inout parameter has an invalid type, we were unable to
distinguish it from a 'var' parameter, resulting in an invalid
diagnostic.

Fix this by adding a VarDecl::isInOut() flag, instead of
introspecting the type.
2016-08-01 23:56:11 -04:00
Jordan Rose
b5aca663bc [ClangImporter] Remove importer-based NS stripping. (#3880)
* [ClangImporter] Remove importer-based NS stripping.

As Tony puts it, in the end we wound up with more Foundation
declarations imported as members or keeping "NS" than those that
dropped it, and any further decisions will be made on a case-by-case
basis. Move all of the existing cases of prefix-stripping into
Foundation's API notes and drop the logic from the compiler.

Tested by dumping the generated interface for Foundation and its
submodules for both macOS and the iOS simulator, and comparing the
results. A few cases did slip through here because of the interaction
between "SwiftName" and "Availability: nonswift".

The next commit will re-add "NS" to some stragglers that we missed.

rdar://problem/26880017

* APINotes: Add "NS" back to a few types.

NSKeyedUnarchiverDelegate
NSKeyedArchiverDelegate
NSTextCheckingTypes
NSBinarySearchingOptions
NSEnumerationOptions
NSSortOptions

More rdar://problem/26880017

* Remove now-redundant SwiftNames from API notes.

No change observed in the generated interface of Foundation and its
submodules.

Finishes rdar://problem/26880017.
2016-08-01 20:54:26 -07:00
Michael Ilseman
654c5235fe [CoreGraphics] fix up a few inconsistent names (#3912)
* [CoreGraphics] fix up a few inconsistent names

* [test] Remove LLVM value names to pass no-assert builds
2016-08-01 20:53:10 -07:00
Jordan Rose
f42158b12e Revert "[Sema] ban multi-arguments to tuple coercion" (#3922)
It breaks cases where there really is a single unlabeled argument of tuple type, like this:

  let pairs = [(1, "A"), (2, "B")]
  print(pairs.map { $0.0 })
2016-08-01 19:22:19 -07:00
swift-ci
d709ebeab9 Merge pull request #3924 from swiftix/master 2016-08-01 19:15:54 -07:00
Arnold Schwaighofer
6158b3a5e9 Merge pull request #3915 from aschwaighofer/fix_implicit_dynamic_for_extension
TypeChecker: Fix implicit dynamic inference for extensions methods
2016-08-01 18:43:29 -07:00
Dmitri Gribenko
4c671e94a4 Merge pull request #3921 from apple/stdlib-remove-cxx-from-SwiftShims
SwiftShims: remove C++ code and unprefixed names from RuntimeShims.h
2016-08-01 18:42:12 -07:00
Dmitri Gribenko
40ca51e202 Merge pull request #3917 from apple/remove-format-spec-checks
[stdlib] Remove incorrect format specifier checks
2016-08-01 18:19:56 -07:00
Roman Levenstein
e155caedd3 Boolean || and && operators should be declared as @_transparent.
This recovers the performance reported in [SR-2247](https://bugs.swift.org/browse/SR-2247) and rdar://27645751
2016-08-01 18:10:34 -07:00
eeckstein
1f2b626b8a Merge pull request #3913 from eeckstein/benchmarks2
benchmarks: add missing autoreleasepool in DictionaryBridge benchmark
2016-08-01 17:15:59 -07:00
Dmitri Gribenko
4e7cc0d938 SwiftShims: remove C++ code and unprefixed names from RuntimeShims.h 2016-08-01 16:53:11 -07:00
Andrew Trick
8ea1ebe0ed Update CHANGELOG for SE-0107: UnsafeRawPointer. (#3920) 2016-08-01 16:52:16 -07:00
swift-ci
22e1cfdc03 Merge pull request #3911 from gottesmm/add_tsan_support 2016-08-01 16:10:12 -07:00
Dave Abrahams
43652bebf7 [stdlib] Remove incorrect format specifier checks
String.init(format:locale:arguments:) contained a check to make sure
that the format string didn't try to format more arguments than were
actually passed.  However, the check didn't guarantee safety (since the
format specifiers didn't have to match the *type* of the passed
argument) and contained bugs such as
https://bugs.swift.org/browse/SR-1378.  Since the check was not a
guarantor of safety and was wrong, it is hereby removed.

If checks are to be reintroduced, they should both be correct and
guarantee complete safety.  Doing this check correctly is a nontrivial
job (the code in Clang to parse such specifiers is well over 500 lines),
and should be taken on as a distinct project.
2016-08-01 15:43:50 -07:00
Arnold Schwaighofer
723e2f912f TypeChecker: Fix implicit dynamic inference for extensions methods
Even if the method is marked override we need to emit an objective C method
call.

There is no v-table guarantee because of the override keyword. The base class
method might be in an objective c class.

rdar://27389992
2016-08-01 15:32:57 -07:00
Erik Eckstein
b8d4cf6036 benchmarks: add missing autoreleasepool in DictionaryBridge benchmark
Fixes a leak
rdar://problem/27601057
2016-08-01 15:21:32 -07:00
Michael Gottesman
7611e12bf5 [build-script] Add support for compiling swift with tsan enabled. 2016-08-01 15:11:09 -07:00
Michael Gottesman
07b463ba3e [gardening] Fix some python lint errors so this change is python lint clean. 2016-08-01 15:11:09 -07:00
Michael Gottesman
b16c2b2a7d [build-script-impl] Remove enable-ubsan flag. This is handled via swift_build_support. 2016-08-01 15:11:09 -07:00
Dmitri Gribenko
35a8c00c5c Merge pull request #3909 from eeckstein/benchmarks
benchmarks: Don't crash on overflow in IterateData
2016-08-01 15:08:57 -07:00
swift-ci
4f3832047c Merge pull request #3908 from adrian-prantl/27621373 2016-08-01 14:39:19 -07:00
swift-ci
1f5301f0ec Merge pull request #3869 from adrian-prantl/25427596 2016-08-01 14:32:25 -07:00
Nicole Jacque
65f933ea27 Disabling test until <rdar://problem/27541751> is resolved 2016-08-01 14:24:11 -07:00
Dmitri Gribenko
f98b02376a Merge pull request #3897 from moiseev/gameplaykit-apinotes
[overlay] GameplayKit apinotes
2016-08-01 14:21:56 -07:00
Argyrios Kyrtzidis
16e4294a02 Merge pull request #3907 from akyrtzi/tuple-arg-annotation-assertion-27611931
[IDE] Fix assertion hit when a function call has no argument labels.
2016-08-01 14:11:54 -07:00
Erik Eckstein
304095fd7d benchmarks: Don't crash on overflow in IterateData 2016-08-01 13:50:02 -07:00
Adrian Prantl
7940718c5e Rewrite tests to minimize dependence on the Swift stdlib. (NFC)
<rdar://problem/27621373>
2016-08-01 13:46:34 -07:00
Adrian Prantl
50589fd2b8 Debug Info: Use artificial locations for emitting aggregate shadow copies.
<rdar://problem/25427596>
2016-08-01 12:58:01 -07:00
Doug Gregor
6b1210ed52 [Omit needless words] Add "unload" as a verb, to go with "load".
Fixes rdar://problem/26866251.
2016-08-01 11:25:23 -07:00
Dmitri Gribenko
fc89bb1ac6 Merge pull request #3772 from practicalswift/swiftc-28379-swift-constraints-constraintsystem-diagnosefailureforexpr
[swiftc (35 vs. 5154)] Add crasher in swift::constraints::ConstraintSystem::diagnoseFailureForExpr(...)
2016-08-01 11:17:09 -07:00
Jordan Rose
802a0b9074 [stdlib] Mark public classes as 'open'. (#3876)
Part of SE-0117.
2016-08-01 11:01:51 -07:00
Argyrios Kyrtzidis
5c46ed06c6 [IDE] Fix assertion hit when a function call has no argument labels.
rdar://27611931.
2016-08-01 10:20:07 -07:00
Argyrios Kyrtzidis
05d495116d [IDE/test] Distinguish a call argument name appropriately for testing. 2016-08-01 10:20:07 -07:00
Kevin Ballard
0473e99988 [PrintAsObjC] Add unavailable attribute to unavailable obj-c initializers (#3852)
* [PrintAsObjC] Add unavailable attribute to non-inherited initializers

Initializers that aren't inherited by subclasses cannot be called, so we
should make this visible to Obj-C.

Due to SR-2211, non-inherited convenience initializers do not get this
same treatment.

* [PrintAsObjC] Add unavailable initializers for private overrides

When a public initializer is overridden with a private one, we need to
mark these as unavailable to Obj-C as they're not supposed to be
callable even though they do exist.
2016-08-01 10:06:51 -07:00
Michael Gottesman
acc5fd5443 Merge pull request #3898 from natecook1000/nc-revise-fp
[stdlib] Revise and expand floating-point documentation
2016-08-01 09:15:27 -07:00
Dmitri Gribenko
e3d8448bbd Merge pull request #3902 from hfossli/patch-2
GenericsManifesto.md – fixed a formatting problem
2016-08-01 09:13:06 -07:00
Dmitri Gribenko
39675b1981 Merge pull request #3905 from BasThomas/patch-4
[Gardening] Infer a Bool
2016-08-01 09:12:44 -07:00
swift-ci
baee2e2dd5 Merge pull request #3867 from adrian-prantl/27348117 2016-08-01 09:10:56 -07:00
Bas Broek
aac62823ec [Gardening] Infer a Bool 2016-08-01 15:28:06 +02:00
Håvard Fossli
88c875e581 GenericsManifesto.md – fixed a formatting problem 2016-08-01 13:46:19 +02:00