Commit Graph

4650 Commits

Author SHA1 Message Date
Jawwad Ahmad
8f6f5ab0dd [stdlib] Remove trailing semicolons from files in stdlib 2015-12-04 15:50:13 +05:00
ken0nek
2218e433b4 Add whitespaces after comma and remove redundant whitespaces.
Manage whitespaces

Remove unrelated line

Fix

Fix again
2015-12-04 15:36:34 +09:00
Thomas Jeans
8b7cee09cc Fix typo 2015-12-03 22:40:27 -05:00
John Andrews
c7710b75b7 Fix typo in SwiftPrivate.swift, "hexidecimal" -> "hexadecimal" 2015-12-03 18:01:23 -08:00
Chris Willmore
51a9cea5cd Merge pull request #121 from noahfradin/patch-1
Fix grammar in Shims.swift: "value that is be used" -> "value to be used"
2015-12-03 17:32:56 -08:00
to4iki
6e22607a6f Fix typo
hexidecimal > hexadecimal
2015-12-04 10:22:32 +09:00
Noah Fradin
048327cd02 Update Shims.swift 2015-12-03 16:36:19 -08:00
Vincent Esche
b7a6236040 Fixing wrong method documentation for SetAlgebra (see my rdar://22031133)
Spot the error:

	/// Return true iff `self.intersect(other).isEmpty`.
	@warn_unused_result
	func subtract(other: Self) -> Self
	
	…
	
	/// Return true iff `self.intersect(other).isEmpty`.
	@warn_unused_result
	func isDisjointWith(other: Self) -> Bool

😉
2015-12-03 21:44:26 +01:00
Johan K. Jensen
fa76656c82 Remove instances of duplicated words 2015-12-03 20:00:29 +01:00
Johan K. Jensen
110f48d2a5 Update referenced IntegerArithmetic filename 2015-12-03 19:42:38 +01:00
Riley Avron
d3fa0c1b91 Fix typo in String.swift documentation. 2015-12-03 09:42:23 -08:00
Dmitri Gribenko
f431025638 stdlib: Fix documentation comments for Sequence.{dropFirst(),dropLast()} 2015-12-02 10:29:07 -08:00
Joe Groff
fed7f79147 Runtime: Static-ize swift_unsafeReflectAny.
The _unsafeReflect entry point never ended up getting used on the Swift side, so don't export it, and remove the _silgen_name'd declaration.
2015-12-02 09:39:29 -08:00
Dmitri Gribenko
174d475833 stdlib: Remove unavavailable APIs that were left as migration aids
These APIs are from the Swift 1.2 => Swift 2.0 transition, and are not
relevant anymore.

Removing them reduces the surface area of the library that needs to be
reviewed.
2015-12-02 01:19:50 -08:00
Dmitri Gribenko
047e4002af stdlib: Fix coding style 2015-12-01 18:32:50 -08:00
Nadav Rotem
b6c284b24f Rename a variable. NFC.
"builder" -> "result", as requested by @gribozavr.
2015-12-01 17:10:42 -08:00
Nadav Rotem
2b47167d24 Simplify another implementation of map() and filter().
This commit removes _UnsafePartiallyInitializedContiguousArrayBuffer from two
more methods. I did not measure the performance impact of this change but I am
expecting this code to run faster.
2015-12-01 17:10:42 -08:00
Nadav Rotem
8885997807 Simplify map() to a simple loop
This commit simplifies map() of collections into a simple append-loop. The Swift
optimizer can do a better job optimizing code without unsafe constructs. This
change accelerates the MapReduce benchmark by 2x.
2015-12-01 12:32:30 -08:00
Erik Eckstein
e15132a6f7 Revert "Compile StdlibUnittest with -sil-serialize-all."
This reverts commit adc92bab45.

It caused a fail of stdlib/AtomicInt.swift on linux.
2015-11-30 16:53:08 -07:00
Slava Pestov
9ee10e7d39 IRGen: destructiveProjectEnumData() value witness doesn't need a return value
The rest of the runtime assumes the payload starts at the beginning
of the enum, so simplify some code by removing the return value here.
2015-11-30 13:32:55 -08:00
Erik Eckstein
adc92bab45 Compile StdlibUnittest with -sil-serialize-all. 2015-11-30 13:11:00 -08:00
Joe Groff
5e5cdc6be3 Runtime: Use 'once' instead of static local variable initialization.
The C++ ABI for static locals is a bit heavy compared to dispatch_once; doing this saves more than 1KB in runtime code size. Dispatch_once/call_once is also more likely to be hot because it's also used by Swift and ObjC code.

Alas, llvm::get_execution_seed() from llvm/ADT/Hashing.h still inflicts one static local initialization on us we can't override (without forking Hashing.h, anyway).
2015-11-30 12:08:12 -08:00
Argyrios Kyrtzidis
a33319b30d [CMake] Fix "Clang headers were not found" cmake error in a non-standalone build. 2015-11-30 10:32:26 -08:00
Erik Eckstein
5e7342633b runtime: add runtime functions for stack promotion of buffers.
These functions are usually lowered away, but can remain if SIL optimizations run but not llvm optimizations.
This is only a workaround. I hope that I can remove the functions soon when we have a better support for buffers in SIL.
2015-11-19 15:18:17 -08:00
Andrew Trick
c1e45d899e Add a shim: swift_stdlib_objcDebugDescription, NFC.
This allows removal of the DebugDescription protocol which is invalid
because no classes actually conform to it. The problem is that we need
to send a debugDescription message to an NSObject without loading
Foundation. This is exactly what shims are for. A very simple shim
solves the problem.
2015-11-18 18:40:45 -08:00
Andrew Trick
b3604aaa83 Remove the fake _CocoaStringType protocol, NFC.
Adding a conformance to Foundation doesn't work because NSString can
be used without loading Foundation. debugDescription is one example of
this.

The only value we derive from the _CocoaStringType is its name, which
makes some APIs more readable. Adding a type safe wrapper around it
serves no purpose since we're almost always immediately casting back
and forth from an 'id'. This was previously done with unsafeBitCast,
which should be avoided unless we really need to reinterpret a bit
pattern.
2015-11-18 18:40:45 -08:00
Joe Groff
9ea30d00fe Runtime: Remove custom operator new(InPlace).
C++ no longer imposes a null check requirement on placement 'new', and clang no longer emits the null check. This hack is no longer needed.
2015-11-18 12:31:24 -08:00
Joe Groff
fbd2e4d872 Rename @asmname to @_silgen_name.
This reflects the fact that the attribute's only for compiler-internal use, and isn't really equivalent to C's asm attribute, since it doesn't change the calling convention to be C-compatible.
2015-11-17 14:13:48 -08:00
Joe Groff
a3b6bef4e5 Runtime: Use new(InPlace) in more places to avoid unwanted null checks. 2015-11-17 14:13:48 -08:00
Joe Groff
385f4cc38c Demangle: Use our own isDigit instead of isdigit.
Darwin's isdigit is strangely heavy, looking up traits in _DefaultRuneLocale instead of a simple comparison pair.
2015-11-17 14:13:48 -08:00
John McCall
5203a688f6 Pick up LLVM_PACKAGE_VERSION correctly in unified builds. 2015-11-17 12:33:17 -08:00
John McCall
a653f7120e Quote cmake variable in case it isn't properly set. 2015-11-17 11:48:03 -08:00
Jordan Rose
514a9bc2e4 [CMake] Really fix the issue from rdar://problem/23570075.
ebcadcfc was close but not quite correct.
2015-11-17 11:15:38 -08:00
Jordan Rose
ebcadcfc38 [CMake] Fix install of Swift's copy of Clang headers.
This is a speculative fix for rdar://problem/23570075, as fallout from
e6bdcbcc. I fixed the build directory, but not the install components.
2015-11-17 08:55:41 -08:00
Joe Groff
0fc6dc8e3b Runtime: Rename swift_stdlib_getDemangledTypeName to swift_getTypeName and decouple it from String.
Getting the name of a type seems like reasonable core runtime functionality, and something the runtime can cache on its side too. Have the function return a pointer to a raw string in memory owned by the runtime, and have it be wrappen in a Swift.String on the standard library side.
2015-11-17 08:37:50 -08:00
Greg Parker
e09027ca04 Fix the error message when a cast to a protocol type fails.
rdar://22936612
2015-11-17 01:08:31 -08:00
Enrico Granata
868035b7c8 Fix an issue where the PlaygroundQuickLook for an NSRange would cause a crash for certain values
rdar://problem/23153462
2015-11-16 13:26:44 -08:00
Joe Groff
8436c1ae6b Runtime: Remove unnecessary block. 2015-11-16 13:05:19 -08:00
Joe Groff
dc26310f34 Runtime: Avoid instantiating call_once on Darwin by using cross-platform Lazy definitions. 2015-11-16 13:05:19 -08:00
Slava Pestov
6057ede7d1 Runtime: Add new swift_getResilientMetadata() entry point 2015-11-16 11:11:07 -08:00
Jordan Rose
cf8baedee2 Re-apply "Rename @transparent to @_transparent for now."
This re-applies 90fcbfe9a6. I'll be committing
the corresponding change to Foundation momentarily.
2015-11-16 10:53:56 -08:00
Xin Tong
16843684b2 Revert "Rename @transparent to @_transparent for now."
This reverts commit 90fcbfe9a6.

Seems there are still some tests that are left not modified.
2015-11-14 07:04:31 -08:00
Jordan Rose
bdc42e71d9 Revert several commits working around the autolinking breakage.
Swift was failing to autolink frameworks in the new text-based SDKs.
Clang r253060 fixes the underlying issue, so we can go back to relying
on autolinking for these.

This reverts the following commits (newest to oldest):
f658841
59092a3
7ea9d54
e52ef22

rdar://problem/23511008
2015-11-13 20:21:04 -08:00
Joe Groff
4abd79d1d0 Remove unnecessary #include. 2015-11-13 19:15:17 -08:00
Joe Groff
9d366f78b6 Build libswiftStdlibStubs.a with the same warnings about global ctors/dtors as the runtime.
We don't want unnecessary static constructors or destructors to leak into the stdlib or runtime. Add -Wexit-time-destructors to both targets too.
2015-11-13 19:15:17 -08:00
Joe Groff
a230ab2bfb Move GlobalObjects.cpp to SwiftStubs.
It holds the empty array object used by the array implementation, and isn't needed by the core runtime.
2015-11-13 18:18:23 -08:00
Jordan Rose
90fcbfe9a6 Rename @transparent to @_transparent for now.
This feature has not been fully designed, let alone properly implemented.
For more information, see docs/TransparentAttr.rst.
2015-11-13 16:25:34 -08:00
Jordan Rose
e6bdcbcc7c [ClangImporter] Drop the version from Clang's resource directory.
Background: Clang has a set of base headers distributed with the compiler
that contain things like vector operations, stddef.h, and tgmath.h.
Swift also needs these headers in order to import C and Objective-C (not
really a surprise), so we symlink to them from lib/swift/clang/. When we
build installable packages, we actually copy them in.

Now the tricky part. Clang's headers are actually at a path like
"include/clang/3.6.0/include/tgmath.h". That "3.6.0" is the Clang version,
which allows multiple Clangs to be installed on a single system. Swift
currently links to the top-level directory, but of course it's only
guaranteed to work with a specific version of the Clang headers. So the
version number here is always the version of Clang we use to build Swift.

Rather than leave the (relatively meaningless) version number here, just
make the symlink point at the "3.6.0" directory rather than the "clang"
directory. This means Swift doesn't have to think about the version number
here at all.

rdar://problem/23223066
2015-11-13 14:43:23 -08:00
Joe Groff
d8b68590c6 Runtime: Remove unused swift_stdlib_demangleName stub. 2015-11-13 12:09:41 -08:00
Mishal Awadah
a77183c068 [stdlib] Removing unused library.
Fixes rdar://problem/23495046
2015-11-13 10:39:34 -08:00