Commit Graph

775 Commits

Author SHA1 Message Date
Michael Gottesman
8437819b5a [CMake] Revert recent changes.
These changes caused a number of issues:

1. No debug info is emitted when a release-debug info compiler is built.
2. OS X deployment target specification is broken.
3. Swift options were broken without any attempt any recreating that
functionality. The specific option in question is --force-optimized-typechecker.

Such refactorings should be done in a fashion that does not break existing
users and use cases.

This reverts commit e6ce2ff388.
This reverts commit e8645f3750.
This reverts commit 89b038ea7e.
This reverts commit 497cac64d9.
This reverts commit 953ad094da.
This reverts commit e096d1c033.

rdar://30549345
2017-02-15 22:26:06 -08:00
Greg Parker
0d8818583b [stdlib] Retry after EINTR in posixWaitpid(). 2017-02-14 20:44:16 -08:00
Slava Pestov
13d6b183c0 Merge pull request #7370 from llvm-beanz/simplify-add_swift_library
[CMake] Simplify add_swift_library
2017-02-14 19:16:59 -08:00
Chris Bieneman
e096d1c033 [CMake] Simplify add_swift_library
This patch splits add_swift_library into two functions one which handles
the simple case of adding a library that is part of the compiler being
built and the second handling the more complicated case of "target"
libraries, which may need to build for one or more targets.

The new add_swift_library is built using llvm_add_library, which re-uses
LLVM's CMake modules. In adapting to use LLVM's modules some of
add_swift_library's named parameters have been removed and
LINK_LIBRARIES has changed to LINK_LIBS, and LLVM_LINK_COMPONENTS
changed to LINK_COMPONENTS.

This patch also cleans up libswiftBasic's handling of UUID library and
headers, and how it interfaces with gyb sources.

add_swift_library also no longer has the FILE_DEPENDS parameter, which
doesn't matter because llvm_add_library's DEPENDS parameter has the same
behavior.
2017-02-14 14:28:10 -08:00
Arnold Schwaighofer
39fa2f0228 Use the swift calling convention for swift functions
Use the generic type lowering algorithm described in
"docs/CallingConvention.rst#physical-lowering" to map from IRGen's explosion
type to the type expected by the ABI.

Change IRGen to use the swift calling convention (swiftcc) for native swift
functions.

Use the 'swiftself' attribute on self parameters and for closures contexts.

Use the 'swifterror' parameter for swift error parameters.

Change functions in the runtime that are called as native swift functions to use
the swift calling convention.

rdar://19978563
2017-02-14 12:17:57 -08:00
Syo Ikeda
e2b03a98dd [gardening] Prefer Array(seq) over seq.map { $0 } 2017-02-04 10:37:22 +09:00
Max Moiseev
ab1422b8ef [tests] Fixing mixed-type arithmetics warnings in the test suite 2017-02-03 15:50:31 -08:00
Max Moiseev
644ee19b60 [stdlibunittest] Correctly handling the case when no output is captured for a crash.
If we expect to see an empty string in the output after the crash, it
would fail in case output is empty.
2017-02-02 09:44:28 -08:00
Han Sangjin
a8dec7fa43 [stdlib] Fixed for Cygwin
- CYGWIN symbol is used to distinguish Cygwin environment from other OS
  and other environment in Windows.
- Added windows and windowsCygnus to OSVersion in StdlibUnittest
2017-01-17 02:31:16 +09:00
Michael Gottesman
2b98e46718 Merge pull request #6711 from moiseev/unsafebitcast
[stdlib] Eliminating some 'unsafeBitcast' related warnings
2017-01-11 22:41:39 -08:00
Matthew Carroll
0e09bbbb83 [DiagnosticsQoI] SR-3359: Add a fix-it to remove @discardableResult on functions that return Void or Never (#6681)
This commit adds a fix-it to remove @discardableResult on functions that return Void or Never. The fix-it is at the warning level. A test was added to verify that the fix-it removes the @discardableResult. This issue was reported in SR-3359:
https://bugs.swift.org/browse/SR-3359

Changes:
TypeCheckAttr.cpp: implemented AttributeChecker::visitDiscardableResultAttr to add a fix-it to remove @discardableResult on functions returning Void or Never.

DiagnosticsSema.def: Added a warning with a diagnostic message.

LoggingWrappers.swift.gyb, HashedCollections.swift.gyb: Removed @discardableResult on functions returning Void.

fixits-apply-all.swift, fixits-apply-all.swift.result: Added tests to verify that @discardableResult is removed from functions returning Void or Never.
2017-01-11 15:12:36 -08:00
Max Moiseev
44f0cb9daf Fix the force unwrapping of a nil pointer 2017-01-11 10:22:01 -08:00
Max Moiseev
195691523f [stdlib] Eliminating some 'unsafeBitcast' related warnings 2017-01-10 12:36:22 -08:00
swift-ci
294359bd69 Merge pull request #4804 from kstaring/master 2017-01-10 00:01:46 -08:00
Ben Cohen
578a52627a Merge branch 'master' into se-147 2017-01-07 13:19:15 -08:00
Ben Cohen
3bdada1773 Merge pull request #6506 from airspeedswift/im-not-warning-you-again
[stdlib] Squash various warnings
2017-01-06 16:51:06 -08:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
Ben Cohen
465f243943 Move += operator for append(contentsOf:) up to RangeReplaceableCollection 2017-01-05 11:59:49 -08:00
Ben Cohen
fefc2e40df Migrate _copyContents to be called from UnsafeMutableBufferPointer with checks for overrun. 2017-01-05 11:59:49 -08:00
Ben Cohen
4dc5eacef5 Merge branch 'master' into im-not-warning-you-again 2017-01-05 10:11:48 -08:00
JP Simard
65688bdc39 [gardening] replace unused closure parameters with '_' in stdlib source (#6522)
* replace unused closure parameters with '_' in stdlib source

* fold some _ closure arguments into line above

* fold more _ closure arguments into line above
2017-01-03 20:10:41 -07:00
Robert Widmann
fca7b66b7c Merge pull request #6521 from jpsim/jp-void-return
[gardening] prefer '-> Void' over '-> ()' in stdlib source
2017-01-03 20:10:13 -07:00
JP Simard
7301b79342 remove superfluous parentheses in control statements in stdlib source
since this appears to be the convention followed elsewhere in the code base.
2016-12-31 18:40:15 -08:00
JP Simard
ea5b665afa prefer '-> Void' over '-> ()'
Apple and the Swift community has settled on this style:
https://devforums.apple.com/message/1133616#1133616

> FWIW, we've recently decided to standardize on () -> Void
> (generally, () for parameters and Void for return types) across all of our
> documentation.
2016-12-31 17:55:19 -08:00
ben-cohen
c7785533a1 add FIXME for default: warning 2016-12-29 13:20:59 -08:00
ben-cohen
adf56d1435 supress function-arg-before-defaulted-arg warning 2016-12-29 10:49:14 -08:00
ben-cohen
ce0d713cd6 fixed where clauses, Optional-as-Any and unused vars 2016-12-29 07:58:12 -08:00
Saleem Abdulrasool
a367034193 stdlib: use _pipe on windows instead of pipe
Use the ucrt.io module's `_pipe` to provide a wrapper over the unix
pipe(2) function.  Based on the work of Hugh Bellamy!
2016-12-17 16:39:08 -08:00
Saleem Abdulrasool
15a24c1117 stdlib: include Glibc on cygwin
cygwin uses glibc, so we should use the glibc module when working with
cygwin.
2016-12-17 16:38:34 -08:00
practicalswift
5bc293cc09 [gardening] Add missing licensing headers. 2016-11-28 21:40:06 +01:00
Dave Abrahams
1f19884c01 Assertion failures from StdlibUnittest dump their descriptions 2016-11-23 02:14:39 -08:00
practicalswift
797b80765f [gardening] Use the correct base URL (https://swift.org) in references to the Swift website
Remove all references to the old non-TLS enabled base URL (http://swift.org)
2016-11-20 17:36:03 +01:00
K Staring
6a121fb6e3 Merge branch 'master' of https://github.com/apple/swift 2016-11-17 21:13:04 +01:00
practicalswift
17503b0d85 [gardening] Use American English. 2016-11-06 10:12:04 +01:00
K Staring
536c1ac6ce Merge branch 'master' of https://github.com/apple/swift 2016-10-31 07:10:16 +01:00
practicalswift
cc852042c9 [gardening] Fix accidental trailing whitespace. 2016-10-29 10:22:58 +02:00
K Staring
197b64ff70 re-instate newline? 2016-10-25 21:09:30 +02:00
K Staring
07166c0008 revert outcommented code-- the code was outcommented due to the pthread wrappers not compiling, but the wrappers compile now thanks to @tinysun212's suggestions 2016-10-21 22:19:54 +02:00
K Staring
8bda672c70 Merge branch 'master' of https://github.com/apple/swift 2016-10-15 18:36:36 +02:00
Brian Gesiak
c42d0d29b6 [stdlib] Only add Apple reflection test targets
When building on a macOS host, and when `SWIFT_INCLUDE_TESTS` is specified,
the `swiftSwiftReflectionTest` target is added to all platforms.
However, this target has a dependency upon Foundation, which is not
available on non-Apple platforms.

Use `add_swift_library`'s `TARGET_SDKS` parameter and other gating
logic to ensure the target is only added for platforms that actually
have Darwin available.
2016-10-07 15:41:31 -04:00
Ben Cohen
fe4186b0b9 Supress various warnings in StdlibUnittest.swift.gyb 2016-10-06 16:14:26 -07:00
Ben Cohen
24dc2af4a9 supress unused loop counter warning (#5134) 2016-10-05 17:02:34 -07:00
K Staring
69085ae4eb Merge branch 'master' of https://github.com/apple/swift 2016-09-29 07:24:25 +02:00
K Staring
47b4c7ee78 fixed the pthread compilation errors by following Sangjin Han's advice,
see also Han's PR:  https://github.com/apple/swift/pull/3886/files#diff-99fd89ad44c4466de8ad6b8aab9c207d
2016-09-29 07:12:15 +02:00
Joe Groff
9b1f238e5b SE-0139: Bridge all standard number types to NSNumber.
Extend NSNumber bridging to cover not only `Int`, `UInt`, `Double`, and `Bool`, but all of the standard types as well. Extend the `TypePreservingNSNumber` subclass to accommodate all of these types, so that we preserve type identity for `AnyHashable` and dynamic casting of Swift-bridged NSNumbers. If a pure Cocoa NSNumber is cast, just trust that the user knows what they're doing.

This XFAILs a couple of serialization tests that attempt to build the Foundation overlay, but which don't properly handle `gyb` files.
2016-09-23 10:34:22 -07:00
Joe Groff
b0e3c0be59 Merge pull request #4865 from jckarter/nsvalue-bridging
SE-0139: NSValue bridging
2016-09-22 09:13:47 -07:00
Joe Groff
86fbeee285 SE-0139: Bridge Cocoa framework structs to NSValue.
For every struct type for which the frameworks provides an NSValue category for boxing and unboxing values of that type, provide an _ObjectiveCBridgeable conformance in the Swift overlay that bridges that struct to NSValue, allowing the structs to be used naturally with id-as-Any APIs and Cocoa container classes. This is mostly a matter of gyb-ing out boilerplate using `NSValue.init(bytes:objCType:)` to construct the instance, `NSValue.objCType` to check its type when casting, and `NSValue.getValue(_:)` to extract the unboxed value, though there are a number of special snowflake cases that need special accommodation:

- To maintain proper layering, CoreGraphics structs need to be bridged in the Foundation overlay.
- AVFoundation provides the NSValue boxing categories for structs owned by CoreMedia, but it does so using its own internal subclasses of NSValue, and these subclasses do not interop properly with the standard `NSValue` subclasses instantiated by Foundation. To do the right thing, we therefore have to let AVFoundation provide the bridging implementation for the CoreMedia types, and we have to use its category methods to do so.
- SceneKit provides NSValue categories to box and unbox SCNVector3, SCNVector4, and SCNMatrix4; however, the methods it provides do so in an unusual way. SCNVector3 and SCNVector4 are packaged into `CGRect`s and then the CGRect is boxed using `valueWithCGRect:`. SCNMatrix4 is copied into a CATransform3D, which is then boxed using `valueWithCATransform3D:` from CoreAnimation. To be consistent with what SceneKit does, use its category methods for these types as well, and when casting, check the type against the type encoding SceneKit uses rather than the type encoding of the expected type.
2016-09-21 19:26:10 -07:00
Greg Parker
9666d8d39a [test] Add a timeout to runRaceTest(). Use it to limit test AtomicInt.swift. (#4815)
[test] Add a timeout to runRaceTest(). Use it to limit test AtomicInt.swift.

This cuts AtomicInt.swift's execution time from several hours to
about ten minutes on slow hardware and slow build configurations.
2016-09-19 21:46:25 -07:00
K Staring
98a8b58957 add //FIXME for FreeBSD outcommented code, add sys/event.h for kqueue (untested) 2016-09-20 03:46:35 +02:00
airspeedswift
ed5231b47c Numbered all FIXME(ABI) entries for tracking purposes. (#4868) 2016-09-19 16:41:41 -07:00