Commit Graph

658 Commits

Author SHA1 Message Date
Jordan Rose
1589ca1b8d [SDK] Use an extra shims header to remove _silgen_name from the XPC overlay. 2016-10-15 14:59:29 -07:00
Jordan Rose
26e24f7bee [SDK] Use an extra shim header to remove _silgen_name from SafariServices. 2016-10-15 14:59:28 -07:00
Jordan Rose
cb59b94135 [SDK] Use an extra shim header to eliminate _silgen_name from ObjectiveC. 2016-10-15 14:59:28 -07:00
Jordan Rose
244cf50c0c [SDK] Use an extra shims header to remove _silgen_name from the os overlay. 2016-10-15 14:59:27 -07:00
Jordan Rose
2e560b0319 [SDK] Use an extra shim header to remove _silgen_name from XCTest. 2016-10-15 14:59:27 -07:00
Brian Gesiak
a6a072f38f [SwiftShims] Improve CMake Clang headers error
When Clang headers could not be found, print all the locations that
were searched.
2016-10-03 17:34:33 -04:00
Chris Bieneman
58ca217e8d [CMake] Fix bad dependency in symlink_clang_headers
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.
2016-09-27 15:29:29 -07:00
practicalswift
8d6251de66 [gardening] Fix accidental uses of \t 2016-09-17 13:15:26 +02:00
practicalswift
9185c052a9 [gardening] Fix inconsistent headers 2016-09-14 20:48:28 +02:00
Dmitri Gribenko
e8e8b35610 stdlib: use SipHash-1-3 for string hashing on non-ObjC platforms
Part of rdar://problem/24109692
2016-09-06 20:41:03 -07:00
Dmitri Gribenko
daa7bfc281 stdlib: add a secret key for hashing 2016-09-06 20:41:03 -07:00
Dmitri Gribenko
32e6f3335b stdlib: annotate AssertionReporting.h with nullability 2016-09-05 22:47:24 -07:00
Dmitri Gribenko
e4aaba9ba6 stdlib: declare functions for assertion reporting in SwiftShims instead of using @_silgen_name 2016-09-05 22:47:24 -07:00
Dmitri Gribenko
51381cf3cf stdlib: annotate LibcShims.h with nullability 2016-09-05 22:47:24 -07:00
Dmitri Gribenko
4da587b388 stdlib: annotate Unicode shims with nullability 2016-09-03 11:51:42 -07:00
Dmitri Gribenko
5faa989821 Merge pull request #3923 from kballard/fix_barrier_blocks
Fix Dispatch API's handling of block parameters
2016-08-03 11:42:27 -07:00
Kevin Ballard
2530957bc6 Use shims for all calls to Dispatch APIs that take blocks
This ensures that blocks that come from `DispatchWorkItem`s will
function correctly.

The only exception is __dispatch_barrier_sync() as the block passed to
that call is not `@convention(block)` so it doesn't matter.

Fixes SR-2246.
2016-08-01 17:08:14 -07:00
Dmitri Gribenko
4e7cc0d938 SwiftShims: remove C++ code and unprefixed names from RuntimeShims.h 2016-08-01 16:53:11 -07:00
Dmitri Gribenko
621d3b7c66 Merge pull request #3827 from mwwa/libdispatch-data-leak
[libdispatch-data-leak] DisaptchData never calls destructor
2016-07-29 14:58:37 -07:00
Andrew Trick
0b75ee975e Remove "illegal" UnsafePointer casts from the stdlib.
Update for SE-0107: UnsafeRawPointer

This adds a "mutating" initialize to UnsafePointer to make
Immutable -> Mutable conversions explicit.

These are quick fixes to stdlib, overlays, and test cases that are necessary
in order to remove arbitrary UnsafePointer conversions.

Many cases can be expressed better up by reworking the surrounding
code, but we first need a working starting point.
2016-07-28 20:42:23 -07:00
Matt Wright
a151db06cd [libdispatch-data-leak] DisaptchData never calls destructor
* _swift_dispatch_data_create should have been marked as returning a
    retained object, otherwise the object is never fully released and
    the destructor is never executed.

    Fixes: <rdar://problem/27577958>
2016-07-28 15:00:32 -07:00
Roman Levenstein
880be3be4f Remove unsafeAddress(of:)
rdar://problem/18589289
2016-07-26 19:57:26 -07:00
practicalswift
a87d170b81 [gardening] Improve consistency in header formatting. 2016-07-24 21:36:25 +02:00
Matt Wright
56a579763f [libdispatch-data-fixes] Appending UnsafeBufferPointers to data is unsafe
* The buffer-pointer based init methods were passing the dispatch
    data default destructor in such a way that the
    @convention(block)-ness was lost. This leads to a thunk being passed
    to dispatch instead of NULL. Subsequently, dispatch would reference
    rather than copy the provided data.

    Fixes:
	SR-2050 (<rdar://problem/27293973>)
2016-07-20 16:46:31 -07:00
Luke Larson
74e0498015 Revert "Update master to build with Xcode 8 beta 3, OS X 10.12, iOS 10, tvOS 10, and watchOS 3 SDKs."
This reverts commit 62d1fa760c.
2016-07-19 15:18:17 -07:00
Mishal Shah
62d1fa760c Update master to build with Xcode 8 beta 3, OS X 10.12, iOS 10, tvOS 10, and watchOS 3 SDKs. 2016-07-19 22:31:34 +02:00
swift-ci
d82483bcee Merge pull request #3584 from mwwa/libdispatch-overlay-fixes 2016-07-18 22:16:00 -07:00
Matt Wright
9e95243c7d [libdispatch] Linux build fixes
* Dispatch's shims header file was not adequately protected against
    building on Linux (which does not have the blocks runtime).
2016-07-18 14:51:21 -07:00
Matt Wright
8ac413a0b5 [libdispatch] Post-beta API changes and bug fixes
* Fix DispatchSourceSignal initialisation such that it no longer
    registers for the wrong source type.

    * Remove (group:) option from DispatchWorkItem, introduce group
    options to `.async` methods that accept DispatchWorkItem.

    * Rename `DispatchSourceType` to `DispatchSourceProtocol`

    * Rework DispatchQueue attributes and flags into a less confusing
    approach.

    * Fixes:

	SR-1817, SR-1771, SR-1770, SR-1769

	<rdar://problem/26725156> <rdar://problem/26873917>
	<rdar://problem/26918843> <rdar://problem/26810149>
	<rdar://problem/27117023> <rdar://problem/27121422>
	<rdar://problem/27236887> <rdar://problem/27337555>
2016-07-18 13:22:23 -07:00
Saleem Abdulrasool
e582465b0e stdlib: use the modern spellings for nullability
Use the portable spelling for the nullability keywords (_Nullable, _Nonnullable,
_Null_unspecified) rather than the old spelling (__nullable, __nonnullable,
__null_unspecified).  NFC.
2016-07-18 12:23:41 -07:00
Robert Widmann
cd0287d7e1 Merge pull request #3539 from CodaFi/contramap
Rename map to modulemap
2016-07-15 18:15:54 -07:00
Robert Widmann
567ea9a297 Rename map to modulemap 2016-07-15 16:07:28 -07:00
Stephen Canon
5564f94867 Intrinsics instead of shims (#3530)
* Use intrinsics instead of Libc stubs where we can.

This replaces most of the stubs used for basic operations on these
types with intrinsics, eliminating a level of indirection for fma,
ceil, floor, round, trunc.

square root and remainder still require stubs because there is no
remainder intrinsic and we can't use the square root intrinsic because
its behavior is undefined for negative inputs.  A previous commit
apparently either the compiler annotates static inline stubs wrong
or the SIL verifier can't handle them, so that change was backed out.

* Explicitly CHECK-NOT @llvm.sqrt instead of looking for @sqrt.
2016-07-15 12:08:25 -05:00
Andrew Trick
b1bf920a36 Revert "Use builtins instead of shims in FloatingPointTypes. (#3454)"
This reverts commit 999885fc8d.

This breaks the stdlib serialization tests:

Assertion failed: (!hasSharedVisibility(F->getLinkage()) && "external declaration of SILFunction with shared visibility is not " "allowed"), function visitSILFunction, file /s/sptr/swift/lib/SIL/SILVerifier.cpp, line 3267.
2016-07-15 08:58:53 -07:00
Stephen Canon
999885fc8d Use builtins instead of shims in FloatingPointTypes. (#3454)
* Map .round, .squareRoot, .addProduct, and .formRemainder onto builtins instead of shims where possible.
2016-07-14 17:50:30 -04:00
Robert Widmann
dc88e51321 Nuke entry-point-based process args
Provides a new fallback for Process arguments for those instances where we do
not own main (e.g. Frameworks, Objective-C owns main.m or main.c, etc.). This
includes a number of platform-specific specializations of argument grabbing
logic and a new thread-safe interface to Process.unsafeArgv.

main()  | _NSGetArgc/_NSGetArgv    | /proc/self/cmdline     | __argc/__argv
--------|--------------------------|------------------------|---------------
Scripts | OS X, iOS, tvOS, watchOS | Linux, FreeBSD, Cygwin | Windows

For interpreted Swift where we must filter out the arguments we now do so by
loading the standard library and calling into new SPI to override the arguments
that would have been grabbed by the runtime. This implementation completely
subsumes the use of the entry point  '_stdlib_didEnterMain' and it will be
removed in a future commit.
2016-07-14 01:06:19 -07:00
Stephen Canon
9c08fbf4ed SE-0113 + residual SE-0067 work (#3443)
Implemented SE-0113 + residual SE-0067 operations.

- adds `rounded` and `round` to `FloatingPoint`, from SE-0113.
- adds `remainder`, `squareRoot`, and `addingProduct`, from SE-0067.
- adds basic test coverage for all of the above.
- provides a default implementation of `nextDown` on `FloatingPoint`.
2016-07-11 09:38:25 -04:00
Saleem Abdulrasool
3d174c372a stdlib: be more DLL friendly on Windows
When the standard library is built dynamically on COFF targets, the public
interfaces must be decorated in order to generate a proper DLL which can be
confused by the dependent libraries.  When the exported interface is used, it
must be indirectly addressed.  This can be done manually in code or the MS
extension of `__declspec(dllimport)` may be used to indicate to the compiler
that this symbol be addressed indirectly.  This permits building more pieces of
the standard library dynamically on Windows.
2016-07-06 17:51:31 -07:00
Michael Gottesman
770a58b4ae [cmake] Use the new LLVM_BUILD_TYPE variable provided by LLVMConfig.cmake in order to find the clang headers when compiling with Xcode. 2016-06-27 18:19:04 -07:00
Saleem Abdulrasool
b86da25823 shims: repair cygwin build
This was a typo in the commit.  Unfortunately, we dont have any tests for the
cygwin target, so this wasnt caught.  The alternate code path is for the MSVC
code path which is under development via cross-compilation.
2016-06-22 21:37:03 -07:00
Saleem Abdulrasool
924e8cd690 shims: correct __swift_size_t for Windows
Windows uses `unsigned int` for `__SIZE_TYPE__` on the 32-bit targets and `long
long unsigned int` for 64-bit targets.  Reflect this for the `__swift_size_t`
type definition.
2016-06-22 06:49:37 -07:00
Saleem Abdulrasool
8b498bf998 stdlib: COFF variant of "visibility" macro
Currently, LLVM supports the current three common object file formats (COFF,
ELF, MachO).  Unfortunately, COFF does not provide a compiler macro to identify
the object file format.  If neither `__MACH__` nor `__ELF__` is defined, then
assume that the object file format being used is COFF.  Within the COFF target
handling, do not use `__declspec(dllexport)` for cygwin targets.
2016-06-18 18:36:11 -07:00
Han Sangjin
be815aabbb [stdlib/msvc] Runtime with MSVC library
This patch is for libswiftCore.lib, linking with the library set of Visual Studio 2015. Clang with the option -fms-extension is used to build this port.
This is the approved subpatch of a large patch.
2016-06-02 08:10:40 +09:00
John McCall
b1983621d3 Fix the declaration of shim visibility on ELF platforms.
Declarations with protected visibility are assumed to be defined
within the current linkage unit, so we have to use default visibility
if we don't know that we're building that.  Teach the shim
visibility header to only use protected visibility when the
__SWIFT_CURRENT_DYLIB macro is defined, and define it when building
the standard library.  Eventually we should change
SWIFT_RUNTIME_STDLIB_INTERFACE and SWIFT_RUNTIME_EXPORT to be
parameterized by the defining dylib so that this works for all the
overlay stubs, too; for now, special-casing swiftCore is necessary
to fix the LInux build.
2016-05-19 14:38:34 -06:00
Dmitri Gribenko
09f7245dbf stdlib: add SWIFT_RUNTIME_STDLIB_INTERFACE attribute where necessary
... and remove some redundant ones.

This change fixes the RuntimeObjC.swift test.

rdar://problem/26239602
2016-05-12 15:48:25 -07:00
Dmitri Gribenko
0556c4b387 Merge pull request #2480 from compnerd/attribute-spelling
stdlib: use the reserved attribute spellings
2016-05-11 16:28:17 -07:00
Saleem Abdulrasool
81661fca61 stdlib: use the reserved attribute spellings
This is a purely mechanical change replacing the attributes with the reserved
spelling.  Compilers are to not error when they encounter a reserved spelling
for an attribute which they do not support.
2016-05-11 11:30:24 -07:00
Saleem Abdulrasool
3743cbc563 stdlib: annotate some more symbols with interfaces
Mark some more of the SwiftShim interfaces with the RUNTIME_INTERFACE
decoration.
2016-05-11 11:20:39 -07:00
John McCall
8ebf7bc954 Add export attribute to header declaration. 2016-05-04 10:58:11 -07:00
John McCall
39107bdab9 Build fix. 2016-05-04 10:36:23 -07:00