Some cases of using isSuperset can cause crashes, this was caused by improper subclassing callouts; this pr resolves those failures (and provides unit tests for that case)
The cases where the bridge was traversed too much now only causes a single bridge out call (without needing to reallocate or thrash retain/release)
String.components(separatedBy: CharacterSet) should be considerably faster now not only for more apporpriate bridging calls but also no longer needing to bridge arrays back and forth.
Resolves the following issues:
rdar://problem/17281998
rdar://problem/26611771
rdar://problem/29738989
This avoids indirection by making calls directly to the C implementations which prevents potentials of mismatched intent or changes of calling convention of @_silgen. The added benefit is that all of the shims in this case are no longer visible symbols (anyone using them was not authorized out side of the Foundation overlay). Also the callout methods in the headers now all share similar naming shcemes for easier refactoring and searching in the style of __NS<class><action> style. The previous compiled C/Objective-C source files were built with MRR the new headers MUST be ARC by Swift import rules.
The one caveat is that certain functions MUST avoid the bridge case (since they are part of the bridging code-paths and that would incur a recursive potential) which have the types erased up to NSObject * via the macro NS_NON_BRIDGED.
The remaining @_silgen declarations are either swift functions exposed externally to the rest of Swift’s runtime or are included in NSNumber.gyb which the Foundation team has other plans for removing those @_silgen functions at a later date and Data.swift has one external function left with @_silgen which is blocked by a bug in the compiler which seems to improperly import that particular method as an inline c function.
By returning `nil` instead of an empty dictionary in the common case where
no exception is encountered, we skip any dictionary-bridging work which
can become expensive if making assertions in a tight loop.
* Mark libc math shims with always_inline attribute
We want these to always be inlined, so mark them with ... always_inline.
The compiler happened to do the right thing with them previously, but we
shouldn't depend on that.
<rdar://problem/30043258> master-next: IRGen/builtin_math.swift failing because sqrt(4) is not constant folded
* Go back to using static inline implementations of sqrt and remainder now that SR-2089 is resolved.
* Fix typo: sqrt -> squareRoot.
* Added test for constant-folding sqrt with -O.
* Added test case requested by jrose.
We still have a bunch of redeclarations of Dispatch functions to avoid
the automatic bridging of dispatch_data_t and dispatch_block_t, but
mostly this is a vast reduction in complexity (and increase in safety).
Loading a Clang module eagerly brings in overlays for anything it re-exports,
but this is a problem for these new "shim header" modules, which generally
import the underlying module for an overlay and are in turn imported by the
overlay. That means that when we try to import an overlay, we'll end up with
a circular reference before it's done loading all its dependencies. Break the
cycle by not exporting anything from these modules, which are mostly just an
implementation detail anyway.
The problem here is a bit complicated. The symlink_clang_headers target creates two symlinks to clang's headers, one under the build directory at lib/swift/clang, and the other under a temporary path.
The one under the temporary path is a bad symlink, and it is only created during the build so that it can be installed. It isn't actually used by the build. Ninja treats the bad symlink as a non-existing file, and since the build rule that creates it has the restat property on it this results in the commands to symlink the clang headers directory running over and over and over again during the build.
This patch prevents that by not generating the bad symlink during the build. Instead we generate it at install time using the LLVMInstallSymlink script that is vended as part of LLVM's distribution.