Commit Graph

794 Commits

Author SHA1 Message Date
Kuba (Brecka) Mracek
ab6533a40f Merge branch 'master' into mracek/arm64e 2020-03-06 15:07:01 -08:00
lhames
1d5c008f97 Merge pull request #29863 from lhames/switch-imm-to-lljit
[Immediate] Switch immediate mode from MCJIT to LLJIT.
2020-03-06 09:12:27 -08:00
Mike Ash
614f4becef [Runtime] Reject suffixes on ObjC mangled class names.
The demangler tolerates arbitrary suffixes on mangled names, and parses them as a Suffix node. When looking up a class by an ObjC mangled name, we don't want such demanglings to succeed, because this will result in false positives. It's expected that NSClassFromString(someClassName + "some suffix") will fail, unless something has actually created a class with that suffix.

rdar://problem/60012296
2020-03-04 12:05:35 -05:00
Kuba Mracek
1bd425da67 [arm64e] Test changes to support arm64e 2020-02-27 16:10:48 -08:00
Lang Hames
7a0754b127 [Immediate] Switch immediate mode from MCJIT to LLJIT.
LLJIT is a simple LLVM IR JIT. Its interface is similar to MCJIT, but its
implementation is based on LLVM's newer ORC APIs. This initial patch does not
make use of any of LLJIT/ORC's advanced features, but will provide better
diagnostics when JIT'd code fails to link. Once LLJIT has proven usable in
this basic configuration we can start experimenting with more advanced
features, including lazy compilation.
2020-02-14 17:59:23 -08:00
Pavel Yaskevich
ec3b783380 [Diagnostics] Improve diagnostic for invalid conversion to AnyObject 2020-01-29 00:37:39 -08:00
David Smith
8e09cd2119 Merge pull request #25864 from Catfish-Man/no-objc-complications-once-more-into-the-breach
Update fast dealloc to use new-style interposing and support objc weak refs
2020-01-22 17:21:34 -08:00
David Smith
f36a4db856 Update fast dealloc to use new-style interposing and support objc weak refs 2020-01-22 13:55:27 -08:00
Doug Gregor
def86ce402 Revert "[irgen] Force emission of objc class refs for non-foreign clang objc classes whose metadata we use."
This reverts commit 8247525471. While
correct, it has uncovered several issues in existing code bases that
need to be sorted out before we can land it again.
Fixes rdar://problem/57846390.
2020-01-11 21:46:42 -08:00
Mishal Shah
7e2c2452ad Disable objc_mangling.swift and SwiftObjectNSObject.swift test on tvOS 2019-12-12 08:32:16 -08:00
Pavel Yaskevich
ebdb5c7776 [ConstraintSystem] Improve handling of ambiguities related to fixes
Solutions passed to `diagnoseAmbiguityWithFixes` aren't filtered
so we need to remove all of the solutions with the score worse
than overall "best". Also logic has to account for some fixes being
"warnings".
2019-12-03 12:07:16 -08:00
Slava Pestov
6d5ff209d0 IRGen: Implement support for __attribute__((ns_consumed)) block parameters
Fixes <rdar://problem/48792177>.
2019-12-02 18:41:27 -05:00
Michael Gottesman
8247525471 [irgen] Force emission of objc class refs for non-foreign clang objc classes whose metadata we use.
Today in far more cases we are using mangled strings to look up metadata at
runtime. If we do this for an objc class but for whatever reason we do not have
any other references to the class, the static linker will fail to link in the
relevant framework. The reason why this happens is that autolinking is treated
by the static linker as a hint that a framework may be needed rather than as a
"one must link against the framework". If there aren't any undefined symbols
needed by the app from that framework, the linker just will ignore the hint. Of
course this then causes the class lookup to fail at runtime when we use our
mangled name to try to lookup the class.

I included an Interpreter test as well as IRGen tests to make sure that we do
not regress here in the future.

NOTE: The test modifications here are due to my moving the ObjCClasses framework
out of ./test/Interpreters/Inputs => test/Inputs since I am using it in the
IRGen test along side the interpreter test.

rdar://56136123
2019-11-21 16:03:54 -08:00
Mishal Shah
c2c8cf5903 Disable objc_mangling and SwiftObjectNSObject test for watchOS (56959761) 2019-11-06 16:43:54 -08:00
Pavel Yaskevich
58329e0c27 Revert "[Diagnostics][Qol] SR-11295 Emit diagnostics for same type coercion. " 2019-10-25 01:05:07 -07:00
Luciano Almeida
86ca3454d6 Fixing warning UnnecessaryCoercion tests 2019-10-21 23:11:21 -03:00
David Smith
1efa946caf Remove stdlib and runtime dependencies on Foundation and CF 2019-09-12 18:03:14 -07:00
Joe Groff
427ed9c79d Compatibility50: Fix for high-bit characters. 2019-09-06 18:19:19 -04:00
Erik Eckstein
5f01b0d1b3 tests: make two tests more resilient to destroy hoisting 2019-08-29 10:49:54 +02:00
Joe Groff
a49e0d5a2e Runtime: Hook the ObjC runtime with an untrusted demangler.
We don't want objc_getClass and NSClassFromString to be able to feed arbitrary symbolic reference
pointers into the Swift runtime. Fixes rdar://problem/54724618.
2019-08-28 11:56:45 -07:00
Pavel Yaskevich
9bd06af328 [Tests] NFC: Disable GLKit_parse tests due to unexpected warnings on tvOS 2019-08-07 10:51:33 -07:00
Stephen Canon
ca1e808bde Replace all 9999 availability in non-stdlib tests. (#26109)
Replace all 9999 availability in non-stdlib tests with the appropriate platform availability.
2019-07-12 14:48:37 -04:00
Slava Pestov
e1e0984cc7 Revert "Frontend: Remove -enable-resilience flag"
This reverts commit 566e9dfea0.
2019-06-24 14:33:45 -04:00
Slava Pestov
566e9dfea0 Frontend: Remove -enable-resilience flag 2019-06-22 21:37:04 -04:00
Arnold Schwaighofer
b31b7a9d8e Remove some UNSUPPORTED swift_test_mode_optimize_none_with_implicit_dynamic
rdar://51228899
2019-05-31 08:45:37 -07:00
Mike Ash
6746911dde [Test] Add availability to the GenericMangled test in objc_getClass.swift
This is a new test in Swift 5.1 that is not expected to pass when running
with the Swift 5.0 runtime library.

rdar://problem/50175915
2019-05-21 10:26:02 -04:00
Slava Pestov
ddf6492d63 Remove -target from test/Interpreter/SDK/archive_attributes.swift
It was broken on 10.9, again...

Fixes <rdar://problem/50897660>.
2019-05-17 15:28:06 -04:00
Slava Pestov
1ca80f93f4 test/Interpreter/SDK/archive_attributes.swift only work on the host or simulator
Fixes <rdar://problem/50897246>.
2019-05-17 15:07:39 -04:00
Slava Pestov
49b19f5205 Merge pull request #24833 from slavapestov/cross-platform-stable-abi-tests
Run stable ABI tests on all Apple platforms
2019-05-16 21:09:49 -04:00
Bob Wilson
a579af3d07 Merge pull request #24832 from bob-wilson/rdar50175915
[Test] Add availability to the ResilientNSObject test in objc_getClass.swift
2019-05-16 15:11:27 -07:00
Slava Pestov
5d66bb810a Run stable ABI tests on all Apple platforms
A number of tests exercise features only available in Apple OSes that
shipped with Swift 5.0 in the OS; this includes the following versions:

- macOS 10.14.4
- iOS 12.2
- tvOS 12.2
- watchOS 5.2

Previously these tests were restricted to running on macOS only, with
an explicit -target x86_64-apple-macosx10.14.4. To get better test
coverage, add a new %target-stable-abi-triple substitution which
expands to a triple with the correct OS version on all Apple platforms.

On non-Apple platforms, this is the same as %target-variant-triple,
but for now any test that uses this exercises Apple platform features
anyway.

One caveat is that since iOS 12.2 does not have a 32-bit slice, we
have to skip any tests that use -target %target-stable-abi-triple
on this platform. A new swift_stable_abi feature flag can be tested
with 'REQUIRES: swift_stable_abi'. To get maximum test coverage,
I split off a 'stable_abi' version of a few tests that build with both
an old and new deployment target. This allows the old deployment
target case to still be tested on 32-bit iOS.
2019-05-16 17:02:06 -04:00
Bob Wilson
dbde6aa65e [Test] Add availability to the ResilientNSObject test in objc_getClass.swift
This is a new test in Swift 5.1 that is not expected to pass when running
with the Swift 5.0 runtime library.

rdar://problem/50175915
2019-05-16 09:43:53 -07:00
Erik Eckstein
3e30d43e10 tests: disable check_class_for_archiving checks for older OSes
rdar://problem/50504765
2019-05-15 16:44:09 -07:00
Mike Ash
0a3b722bf9 Merge pull request #24688 from mikeash/swift-nativensxxxcoding-test-availability
[Test] Guard SwiftNativeNSXXXCoding tests behind #available(9999).
2019-05-13 12:06:18 -04:00
Slava Pestov
cc53fd9518 Fix archive_attributes test to work on macOS 10.9
That OS doesn't have objc_readClassPair(). This test uses -target to
explicitly select a newer deployment target and then runs the binary
on an old OS to test the behavior. However this means arclite won't
get linked in unless we also pass in -link-objc-runtime.

Fixes <rdar://problem/50610877>.
2019-05-10 14:54:34 -04:00
Mike Ash
5a8a0a816e [Test] Guard SwiftNativeNSXXXCoding tests behind #available(9999).
These tests fail when run against older runtimes since they don't have the fix.

rdar://problem/50504800
2019-05-10 14:51:05 -04:00
Mike Ash
3ad6e46930 [Stdlib] Fix warnings about designated initializers in SwiftNativeXXX classes. 2019-05-06 17:15:53 -04:00
Jordan Rose
517f5d6b6a [ClangImporter] Retire the term "adapter" in favor of "overlay" (#24427)
Way back in Swift 1 I was trying to draw a distinction between
"overlays", separate libraries that added Swift content to an existing
Objective-C framework, and "the Swift part of a mixed-source
framework", even though they're implemented in almost exactly the same
way. "Adapter module" was the term that covered both of those. In
practice, however, no one knew what "adapter" meant. Bring an end to
this confusion by just using "overlay" within the compiler even for
the mixed-source framework case.

No intended functionality change.
2019-05-03 11:11:58 -07:00
Mike Ash
8d2b1bbf7b Merge pull request #24394 from mikeash/decode-the-undecodable
[Stdlib] Make the SwiftNativeNSXXXBase classes gracefully handle being decoded with NSKeyedUnarchiver.
2019-05-02 10:06:06 -04:00
Slava Pestov
6d7d13fceb IRGen: Disable eager initialization of NSCoding adopters on newer targets
If a class does not have a custom @objc name, objc_getClass() can find
it at runtime by calling the Swift runtime's metadata demangler hook.

This avoids the static initializer on startup. If the class has a
custom runtime name we still need the static initializer unfortunately.

Fixes <rdar://problem/49660515>.
2019-05-01 17:43:58 -04:00
Mike Ash
7506e9c4f8 [Stdlib] Make the SwiftNativeNSXXXBase classes gracefully handle being decoded with NSKeyedUnarchiver.
These would never be decoded in normal use, but it's possible to construct an archive that will attempt to decode them. Without this override, that throws an exception or worse.

rdar://problem/48429185
2019-05-01 10:04:14 -04:00
Slava Pestov
7c8641c497 Fix formatting nit in objc_getClass test 2019-04-19 17:39:51 -04:00
Harlan Haskins
150ad99457 [ModuleInterfaces] Replace 'module file' with 'compiled module'
...only in diagnostics. And make the tests pass.

rdar://49359734
2019-04-11 18:05:09 -07:00
Brent Royal-Gordon
7ae331dbca [NFC] Pick a few nits for Jordan 2019-04-10 23:17:04 -07:00
Arnold Schwaighofer
252738af5b Fix test case 2019-03-21 13:50:53 -07:00
Arnold Schwaighofer
e113ef8c93 Add a mode to test implicit dynamic with private imports 2019-03-20 14:34:01 -07:00
Harlan Haskins
e8d474aa11 Merge pull request #23343 from harlanhaskins/mangled-lassi
[Demangle] Check for old-style mangling in getObjCClassByMangledName
2019-03-17 22:24:34 -07:00
Harlan Haskins
09bdaa35c5 [test] Test looking up resilient NSObject subclasses
Add tests to make sure we can look up resilient NSObject subclasses in the ObjC runtime.
2019-03-17 17:29:36 -07:00
swift-ci
497e94e89d Merge pull request #23235 from mikeash/remove-stable-abi-bit-configuration 2019-03-15 15:31:58 -07:00
Slava Pestov
1159af50d9 Rename -enable-resilience to -enable-library-evolution and make it a driver flag
Fixes <rdar://problem/47679085>.
2019-03-14 22:24:26 -04:00