Commit Graph

2520 Commits

Author SHA1 Message Date
Saleem Abdulrasool
63c8c005d7 test: add a ODR violation check for the static standard library
The static version of the standard library was leaking symbols in the
`llvm::` namespace which would result in ODR violations were the
artifact linking against `LLVMSupport` (via another dependency).  In
particular, `llvm::SmallVector` and `llvm::StringSwitch` symbols were
being leaked.  This adds a test case specifically for the static variant
of the library.  The dynamic variant of the library is already tested in
a separate test.
2020-05-29 14:02:25 -07:00
Mishal Shah
d5c40bf231 Revert "Disable objc_mangling.swift and SwiftObjectNSObject.swift test on tvOS"
This reverts commit 7e2c2452ad.
2020-05-28 14:10:40 -07:00
NevinBR
4bb855be4a Created unit tests for DefaultIndices 2020-05-27 09:50:57 -04:00
Mike Ash
28a61eaa19 [Test] Have llvm-support-odr-violation.sh use platform-dylib-dir.
platform-module-dir isn't quite right, since we're looking for libswiftCore.dylib.

rdar://problem/63437032
2020-05-20 11:01:08 -04:00
Robert Widmann
6379387e1d Merge pull request #31883 from gribozavr/enable-unicodescalar-test
Reenable a test for UnicodeScalar
2020-05-19 13:40:03 -07:00
Saleem Abdulrasool
bfb65ecfdb Merge pull request #31870 from compnerd/stdlib-insurance
test: ensure that we do not regress the standard library isolation
2020-05-19 07:54:30 -07:00
Dmitri Gribenko
3f5c53a6b8 Reenable a test for UnicodeScalar
This test was disabled back in 2017 when the new integer protocols were
landing due to regressions in error messages. It is better to have a
working test that verifies the desired behavior (UnicodeScalar not
supporting arithmetic and the type checker producing somewhat readable
messages), rather than a disabled test because the error messages are
not perfect.
2020-05-19 11:53:11 +02:00
Dmitri Gribenko
e055b4bbe3 Merge pull request #31859 from gribozavr/merge-coregraphics
Consolidated four CoreGraphics execution tests
2020-05-19 08:53:59 +02:00
Saleem Abdulrasool
f42a62b9fc Update llvm-support-odr-violation.test-sh
Allow empty input as PE/COFF does not provide a symbol table which results in no visible symbols.
2020-05-18 14:52:00 -07:00
Dmitri Gribenko
30afc6c406 Consolidated four CoreGraphics execution tests
I don't see any reason to split the tests like this. I merged the tests
into the biggest and best-organized test file.

I also removed the `REQUIRES: OS=macosx` line and made some small
adjustments to the test to make it cross-platform.
2020-05-18 23:13:12 +02:00
Saleem Abdulrasool
a92894c530 test: ensure that we do not regress the standard library isolation
Add a test to ensure that the standard library does not accidentally end
up with symbols in the `llvm::` namespace.  The LLVMSupport symbols for
now are namespaced to `__swift::__runtime` with the desire that they
will move into `swift::` and become vended in the swift namespace.
2020-05-18 21:08:16 +00:00
Robert Widmann
7e00f7e6c6 Merge pull request #31853 from 3405691582/Semaphore_Typealias_OpenBSD
[stdlib] sem_t is a nullable pointer on OpenBSD.
2020-05-18 13:05:37 -07:00
3405691582
f1ca2e97cf [stdlib] sem_t is a nullable pointer on OpenBSD.
Platform defines sem_open in Swift that calls through to the underlying
platform functions because sem_open is variadic. However, the
definitions here assume sem_t is non-nullable, but this assumption only
holds when the platform has nullability annotations on the semaphore
type, or the semaphore type on the platform is not an opaque pointer.

On OpenBSD specifically, the semaphore type is an opaque pointer without
any nullability annotations. This means that the type gets inferred as
UnsafeMutablePointer<sem_t?>? instead of UnsafeMutablePointer<sem_t>?.
To make sure the pointer values returned and their types match, we
introduce a conditional typealias.

The other option is to coerce everything to UnsafeMutablePointer<sem_t>?
but this would be a rather blunt instrument. While sem_open is public in
stdlib, it is not so much codified stdlib API, so this is a slightly
nicer approach.
2020-05-17 22:24:06 -04:00
Owen Voorhees
6c646ec1fd Merge pull request #31649 from owenv/ephemeral-edu-notes
[Diagnostics] Add an edu note explaining @_nonEphemeral diags
2020-05-11 23:54:42 -05:00
Owen Voorhees
792fb87da5 [Diagnostics] Add an edu note explaining @_nonEphemeral diags 2020-05-11 13:05:12 -07:00
Robert Widmann
f2b3f8ffb6 Merge pull request #31621 from davezarzycki/pr31621
Remove all uses of -force-single-frontend-invocation
2020-05-08 09:48:48 -07:00
David Zarzycki
5dcc32f98f Remove all uses of -force-single-frontend-invocation
The `-force-single-frontend-invocation` flag predates WMO and is now an
alias for `-whole-module-optimization`. We should use the latter and let
the former fade into history.
2020-05-08 06:37:41 -04:00
Karoy Lorentey
926cc3f9ca Revert "Disable test that is known to fail in asan" 2020-05-07 10:51:43 -07:00
Karoy Lorentey
091a6d877f Merge pull request #31601 from lorentey/data-append
[Foundation] Data.append: Switch to using resetBytes
2020-05-07 10:46:14 -07:00
Arnold Schwaighofer
8ca7b4986e Disable test that is known to fail in asan
rdar://62866069
2020-05-06 06:40:24 -07:00
Karoy Lorentey
658effd928 [test] Data: Add tests exercising Sequence-based init and append 2020-05-05 18:29:25 -07:00
Karoy Lorentey
6537df068a Revert "test: disable several tests failing in CI" 2020-04-29 19:00:17 -07:00
Michael Ilseman
249d2eeb2c [string] Add _deconstructUTF8 for internal usage
Add string deconstruction into contiguous UTF-8 (allocating if
needed).

Comments and docs to come soon, for now doing early testing.
2020-04-24 12:13:41 -07:00
Joe Groff
948372b87c Merge pull request #31087 from jckarter/compatibility-51
Start a Compatibility51 library for backporting fixes to Swift 5.1 runtimes
2020-04-17 15:06:50 -07:00
Joe Groff
42514f42e0 Start a Compatibility51 library for backporting fixes to Swift 5.1 runtimes 2020-04-17 10:41:48 -07:00
Hamish Knight
f2564d5126 [stdlib] Add a couple of missing @_nonEphemeral attributes 2020-04-16 10:17:16 -07:00
simon gladman
d142faba5b Accelerate deprecate split complex inits (#29221)
* Update FFT Tests

I removed SinglePrecisionComplexConversions and DoublePrecisionComplexConversions - they weren't testing any new API.

2DSinglePrecision, 2DDoublePrecision, 1DSinglePrecision, and 1DDoublePrecision have all been updated to no longer use the deprecated initializer and avoid the temporary pointer warnings.

* Deprecate Split Complex inits

Deprecate init(fromInputArray:realParts:imaginaryParts:) for DSPSplitComplex and DSPDoubleSplitComplex

* Fix Availability
2020-04-15 09:30:41 -04:00
Erik Eckstein
f83bd2885d tests: fix the timeout.py script and move it to a more central place
A string->float conversion for the command line argument was missing
2020-04-10 20:10:24 +02:00
tbkka
110e5136c1 Float16 optimal formatting (#30862)
Extend SwiftDtoa to provide optimal formatting for Float16 and use that for `Float16.description` and `Float16.debugDescription`.

Notes on signaling NaNs: LLVM's Float16 support passes Float16s on x86
by legalizing to Float32.  This works well for most purposes but incidentally
loses the signaling marker from any NaN (because it's a conversion as far
as the hardware is concerned), with a side effect that the print code never
actually sees a true sNaN.  This is similar to what happens with Float and
Double on i386 backends.  The earlier code here tried to detect sNaN in a
different way, but that approach isn't guaranteed to work so we decided to
make this code use the correct detection logic -- sNaN printing will just be
broken until we can get a better argument passing convention.

Resolves rdar://61414101
2020-04-09 09:37:38 -04:00
Saleem Abdulrasool
1471d52662 test: mark stdlib/StringSwitch as executable_test
This is a runtime test, ensure that is marked as an execution test.
2020-04-07 20:36:59 -07:00
Stephen Canon
248c554524 Add Float16 to stdlib (#30130)
Add Float16 (IEEE 754 binary16) to the standard library, plus assorted runtime support operations.

Swift Evolution thread: https://forums.swift.org/t/se-0277-float16/33546
2020-04-06 17:57:44 -04:00
Xi Ge
faf91d5cf6 test: disable stdlib/TestData.swift due to rdar://61347106 2020-04-06 10:13:37 -07:00
Michael Ilseman
5815468ebb Merge pull request #30719 from milseman/tilde_equality
[String] Concrete String/Substring overloads for ~=
2020-04-03 11:12:32 -07:00
Michael Ilseman
30c92574ed [String] Concrete String/Substring overloads for ~=
Add concrete overloads for ~= for String/Substring
combinations. SR-12457 tracks making this generic after we understand
the expression type checker impact.
2020-04-02 10:37:30 -07:00
Ben Rimmington
682c1672b6 [stdlib] Update file headers of de-gybbed files 2020-04-01 22:14:03 +01:00
swift-ci
e5110d7953 Merge pull request #30146 from benrimmington/static-string-documentation 2020-03-27 16:36:13 -07:00
Ravi Kandhadai
b7e8f76108 [stdlib/private][os log] Simplify the OSLogPrototype stdlib-private
module to contain only code necessary for testing the compiler
optimizations and diagnostics. This commit comprises the following changes:

1. Rename the OSLogPrototype module to OSLogTestHelper and rename the files.
2. Make the private module: OSLogTestHelper independent of os overlay.
3. Simplify the os log test suites and make them not perform logging.
4. Enable the os log test suites on all platforms.

<rdar://problem/60542172>
2020-03-27 01:18:04 -07:00
Mishal Shah
88b093e9d7 Merge pull request #30615 from apple/post-back-master-xcode-11.4
Update master to build with Xcode 11.4
2020-03-24 17:19:37 -07:00
Mishal Shah
e7cd5ab17f Update master to build with Xcode 11.4 2020-03-24 11:30:45 -07:00
3405691582
4a36a4b6c5 [test] Setup testing for OpenBSD.
This commit focuses the basics: setting up the relevant stanzas in
lit.cfg and adding platform conditionals for importing Glibc. Future
commits will deal with other portability fixes.
2020-03-23 20:47:31 -04:00
Hamish Knight
b62c9b6b01 [CS] Use getParameterType for KeyPath as function
Previously we were using `getPlainType` to match
the parameter type against the key path's base
type. This gave us the external parameter type,
which would be the element type for a variadic
parameter.  However the code we generate expects
the internal parameter type, which is provided by
`getParameterType`.

Resolves rdar://problem/59445486.
2020-03-11 17:21:28 -07:00
Kuba (Brecka) Mracek
b2edf20a81 Merge pull request #30112 from apple/mracek/arm64e
Add arm64e and pointer authentication support for Swift
2020-03-07 20:38:36 -08:00
John McCall
ceff414820 Distinguish invocation and pattern substitutions on SILFunctionType.
In order to allow this, I've had to rework the syntax of substituted function types; what was previously spelled `<T> in () -> T for <X>` is now spelled `@substituted <T> () -> T for <X>`.  I think this is a nice improvement for readability, but it did require me to churn a lot of test cases.

Distinguishing the substitutions has two chief advantages over the existing representation.  First, the semantics seem quite a bit clearer at use points; the `implicit` bit was very subtle and not always obvious how to use.  More importantly, it allows the expression of generic function types that must satisfy a particular generic abstraction pattern, which was otherwise impossible to express.

As an example of the latter, consider the following protocol conformance:

```
protocol P { func foo() }
struct A<T> : P { func foo() {} }
```

The lowered signature of `P.foo` is `<Self: P> (@in_guaranteed Self) -> ()`.  Without this change, the lowered signature of `A.foo`'s witness would be `<T> (@in_guaranteed A<T>) -> ()`, which does not preserve information about the conformance substitution in any useful way.  With this change, the lowered signature of this witness could be `<T> @substituted <Self: P> (@in_guaranteed Self) -> () for <A<T>>`, which nicely preserves the exact substitutions which relate the witness to the requirement.

When we adopt this, it will both obviate the need for the special witness-table conformance field in SILFunctionType and make it far simpler for the SILOptimizer to devirtualize witness methods.  This patch does not actually take that step, however; it merely makes it possible to do so.

As another piece of unfinished business, while `SILFunctionType::substGenericArgs()` conceptually ought to simply set the given substitutions as the invocation substitutions, that would disturb a number of places that expect that method to produce an unsubstituted type.  This patch only set invocation arguments when the generic type is a substituted type, which we currently never produce in type-lowering.

My plan is to start by producing substituted function types for accessors.  Accessors are an important case because the coroutine continuation function is essentially an implicit component of the function type which the current substitution rules simply erase the intended abstraction of.  They're also used in narrower ways that should exercise less of the optimizer.
2020-03-07 16:25:59 -05:00
Kuba (Brecka) Mracek
ab6533a40f Merge branch 'master' into mracek/arm64e 2020-03-06 15:07:01 -08:00
Michael Ilseman
9cabe077f4 Merge pull request #30263 from milseman/malloc_san
[test] Disable allocator-specific test portion
2020-03-06 11:47:27 -08:00
Michael Ilseman
5236224eb1 [test] Disable allocator-specific test portion
Disagble a portion of a test with hard-coded assumptions about the
result of malloc_size.
2020-03-06 09:37:55 -08:00
Michael Ilseman
c4f1b83a5a Merge pull request #30259 from milseman/backspective
[test] Disable introspective test in back deployment
2020-03-06 09:16:56 -08:00
Michael Ilseman
8d5d3815a1 Merge pull request #30180 from benrimmington/se-0263-test
[SE-0263] Add test, rename API, update docs
2020-03-06 08:54:24 -08:00
Michael Ilseman
633d46ff26 [test] Disable introspective test in back deployment 2020-03-06 07:19:08 -08:00
Michael Ilseman
79bac4e6a3 Merge pull request #30244 from milseman/string_shrink
[string] Shrink storage class sizes
2020-03-05 19:57:40 -08:00