Commit Graph

80 Commits

Author SHA1 Message Date
Max Moiseev
02006f20bc Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-03-09 16:05:03 -08:00
Ted Kremenek
838d5864ba Merge pull request #1498 from ianpartridge/print-using-fwrite
[stdlib] Use fwrite(3) in _Stdout.write()
2016-03-08 21:52:42 -08:00
Ted Kremenek
90ce8daf0b Merge pull request #1552 from hughbe/stdlib-newlines
[gardening] Remove double new lines from stdlib files
2016-03-05 14:40:04 -08:00
Hugh Bellamy
c1b25bb32f [gardening] Remove double new lines from stdlib files 2016-03-05 15:44:54 +00:00
Ian Partridge
1fcf15b150 [stdlib] Ignore errors from fwrite() 2016-03-02 17:29:18 +00:00
Ian Partridge
1ee493218b [stdlib] Add _fixLifetime() to avoid ARC leak 2016-03-01 22:23:39 +00:00
Ian Partridge
fbf11ce054 [stdlib] Fix indentation 2016-03-01 20:49:53 +00:00
Ian Partridge
9412c21345 [stdlib] Use fwrite(3) in ASCII fastpath only 2016-03-01 20:18:32 +00:00
Ian Partridge
259d57bbe7 [stdlib] Use fwrite(3) in print() 2016-03-01 15:55:52 +00:00
Max Moiseev
a49dab6bf8 Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-02-29 12:08:52 -08:00
Daniel Duan
2bc78b8c09 [stdlib] update for 'inout' adjustment (SE-0031) 2016-02-26 12:02:29 -08:00
Dmitri Gribenko
82998a155a stdlib: _TeeStream: unlock streams in the order opposite to locking order 2016-02-22 18:16:38 -08:00
Dmitri Gribenko
e2f5e05ec4 stdlib: Streamable.writeTo() => .write(to:) 2016-02-22 18:16:37 -08:00
Dmitri Gribenko
b1ef18fb75 stdlib: lowercase cases of AncestorRepresentation and DisplayStyle enums 2016-02-19 16:06:26 -08:00
Max Moiseev
55fde4c923 making tests pass 2016-02-10 16:08:40 -08:00
Max Moiseev
39fdbca8d0 making Swift build succesfully after the merge 2016-02-04 16:48:14 -08:00
Max Moiseev
61c837209b Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-02-04 16:13:39 -08:00
Kevin Ballard
ac1996000e [Stdlib] Remove all redundant stdout locking when printing
* Switch to calling `putchar_unlocked()` instead of `putchar()` for
  actual printing. We're already locking stdout with `flockfile()`, so
  there's no need for the redundant lock that `putchar()` uses.
* Add an explicit lock to the output stream in `dump()`. This means the
  entire dump is printed with the lock held, which will prevent the
  output of `dump()` from mixing with prints on other threads.
* Use `_debugPrint_unlocked()` instead of `debugPrint()` in
  `_adHocPrint()`. The output stream is already locked while this
  function is executing. Rename the function to `_adHocPrint_unlocked()`
  to make this explicit.
* Use `targetStream.write()` and `_print_unlocked()` instead of
  `print()` in `_dumpObject()`. This removes the redundant locking, and
  also eliminates the creation of intermediate strings. Rename the
  function to `_dumpObject_unlocked()` to make this explicit.
* Use `targetStream.write()`, `_print_unlocked()`, and
  `_debugPrint_unlocked()` in `_dumpSuperclass()`. This removes the
  redundant locking, and also eliminates the creation of intermediate
  strings. Rename the function to `_dumpSuperclass_unlocked()` to make
  this explicit.
* Use `_debugPrint_unlocked()` instead of `debugPrint()` in
  `String.init(reflecting:)`. This shouldn't really make much of a
  difference but it matches the usage of `_print_unlocked()` in
  `String.init(_:)`.

The net result is that all printing is still covered under locks like
before, but stdout is never recursively locked. This should result in
slightly faster printing. In addition, `dump()` is now covered under a
single lock so it can't mix its output with prints from other threads.
2016-02-02 13:40:55 -08:00
Austin Zheng
77918a86ac [SR-88] Reinstate Mirror migration changes, fix test issues
This reverts commit 182bb7f812.
2016-01-27 20:40:52 -08:00
Andrew Trick
182bb7f812 Revert "Merge pull request #1058 from austinzheng/az-port-mirror"
This pull request broke the following tests on several build configurations
(eg --preset=buildbot,tools=RA,stdlib=DA)

    1_stdlib/Reflection.swift
    1_stdlib/ReflectionHashing.swift
    1_stdlib/UnsafePointer.swift.gyb

This reverts commit c223a3bf06, reversing
changes made to 5c2bb09b09.
2016-01-27 10:43:08 -08:00
Austin Zheng
10d5b23c30 [SR-88] Reinstate mirror migration commit
Changes:
- Reverted commit reverting original SR-88 commit
- Removed mirror children helper collections and related code
- Rewrote some tests to keep them working properly
- Wrote two more tests for the three pointer APIs to ensure no crashes if created using a value > Int64.max

This reverts commit 8917eb0e5a.
2016-01-26 19:28:32 -08:00
Dmitri Gribenko
9bcd5a1056 Collection.length => .count 2016-01-22 18:41:19 -08:00
Mark Lacey
8917eb0e5a Revert "[Runtime][StdLib] Migrate mirrors to use CustomReflectable API, rewrite dump()"
This reverts commit 9798dfd4aa because it
broke the stdlib build.
2016-01-22 08:41:07 -08:00
Austin Zheng
9798dfd4aa [Runtime][StdLib] Migrate mirrors to use CustomReflectable API, rewrite dump()
Jira: SR-88
Changes:
- Removed stdlib type conformances to _Reflectable
- Conformed stdlib types to CustomReflectable, CustomPlaygroundQuickLookable
- Rewrote dump() function to not use _reflect()
- CGRect, CGPoint, CGSize now conform to CustomDebugStringConvertible
- Rewrote unit tests for compatibility with new API
2016-01-21 09:44:15 -08:00
Dmitri Gribenko
74ce1ca79c Add unavailable declarations for Swift 2.2 -> 3 migration 2016-01-19 14:32:59 -08:00
Max Moiseev
f51e708a8f Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-01-04 12:25:25 -08:00
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +00:00
ken0nek
e7e70cea92 Add spaces before and after closure arrow in stdlib 2015-12-23 04:52:15 +09:00
Max Moiseev
f4aaece75e revisiting CString related String extensions 2015-12-17 17:27:29 -08:00
Dmitri Gribenko
73ce9ae7e9 Collection.count => .length
And other API changes that naturally fall out from this, like
Array(repeating:count:) => Array(repeating:length:).
2015-12-17 15:55:29 -08:00
Maxim Moiseev
62c85d379d OutputStreamType => OutputStream 2015-12-16 14:45:38 -08:00
Max Moiseev
d610fa0d1c Merge remote-tracking branch 'origin' into swift-3-api-guidelines 2015-12-10 10:29:52 -08:00
Andrew Trick
35cb1afab8 Fix dynamic runtime casts of Optionals.
Fixes <rdar://23122310> Runtime dynamic casts...

This makes runtime dynamic casts consistent with language rules, and
consequently makes specialization of generic code consistent with an
equivalent nongeneric implementation.

The runtime now supports casts from Optional<T> to U. Naturally the
cast fails on nil source, but otherwise succeeds if T is convertible to
U.

When casting T to Optional<U> the runtime succeeds whenever T is
convertible to U and simply wraps the result in an Optional.

To greatly simplify the runtime, I am assuming that
target-type-specific runtime cast entry points
(e.g. swift_dynamicCastClass) are never invoked with an optional
source. This assumption is valid for the following reasons. At the
language level optionals must be unwrapped before downcasting (via
as[?!]), so we only need to worry about SIL and IR lowering.  This
implementation assumes (with asserts) that:

- SIL promotion from an address cast to a value casts should only happen
  when the source is nonoptional. Handling optional unwrapping in SIL
  would be too complicated because we need to check for Optional's own
  conformances. (I added a test case to ensure this promotion does not
  happen). This is not an issue for unchecked_ref_cast, which
  implicitly unwraps optionals, so we can promote those!

- IRGen lowers unchecked_ref_cast (Builtin.castReference) directly to
  a bitcast (will be caught by asserts).

- IRGen continues to emit the generic dynamicCast entry point for
  address-casts (will be caught by asserts).
2015-12-09 16:12:30 -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 Hrybenko
153d95efc6 SwiftShims: don't redeclare libc functions
Clang importer thinks that SwiftShims is the primary module where they
live, and this confuses code completion.

rdar://22488333

Swift SVN r32218
2015-09-25 03:33:50 +00:00
Nadav Rotem
7a49d7e334 [codesize] Keep _print_unlocked in the swift dylib.
We keep most of our printing code in the swift dylib but we missed
this method in our last refactoring.

Swift SVN r31508
2015-08-26 22:14:19 +00:00
Joe Pamer
828eb68e72 Commit DaveA's API changes to 'print', along with the compiler changes necessary to support them.
There's still work left to do. In terms of next steps, there's still rdar://problem/22126141, which covers removing the 'workaround' overloads for print (that prevent bogus overload resolution failures), as well as providing a decent diagnostic when users invoke print with 'appendNewline'.

Swift SVN r30976
2015-08-04 01:57:11 +00:00
Dave Abrahams
d06a07897f [stdlib] Move _playgroundPrintHook into OutputStream
Makes for a simpler patch for the LLDB folk to apply

Swift SVN r30824
2015-07-30 23:39:47 +00:00
Dave Abrahams
b428dc8a6a [stdlib] wire _playgroundPrintHook into legacy print
Those LLDB peeps need it for testing

Swift SVN r30823
2015-07-30 23:39:46 +00:00
Dave Abrahams
1a01fee74a [stdlib] Strip comments and other distractions from unavailable APIs
Swift SVN r30777
2015-07-29 20:30:34 +00:00
Dave Abrahams
0711371641 [stdlib] Update FIXMEs to place the blame correctly
Swift SVN r30752
2015-07-29 03:30:16 +00:00
Dave Abrahams
b6d4007b55 [stdlib] Fix incorrect comment
Swift SVN r30750
2015-07-29 02:04:10 +00:00
Joe Groff
db0fea590e stdlib: Use unqualified names in 'print'.
Leave the qualification off of enum cases and type names when 'print'-ing them, but keep them on 'debugPrint'. (At least, at the outermost level; since ad-hoc printing of structs and tuples uses debugPrint, we'll still get qualification at depth, which kind of sucks but needs more invasive state management in print to make possible.) Implements rdar://problem/21788604.

Swift SVN r30166
2015-07-13 21:42:11 +00:00
Joe Pamer
0e35bad9dc Revert "[stdlib] Remove workarounds for fixed bug"
This reverts commit r30148, since it regresses the following tests:

   Swift :: ClangModules/script.swift
   Swift :: Interpreter/currying_protocols.swift
   Swift :: Interpreter/if_expr.swift
   Swift :: Interpreter/protocol_extensions.swift
   Swift :: Interpreter/weak.swift
   Swift :: Interpreter/weak_objc.swift
   Swift :: PlaygroundTransform/array_did_set.swift
   Swift :: PlaygroundTransform/print.swift

Swift SVN r30159
2015-07-13 19:48:08 +00:00
Dave Abrahams
c0399e240f [stdlib] Remove workarounds for fixed bug
Also fixes rdar://21582758

Swift SVN r30148
2015-07-13 16:52:57 +00:00
Dmitri Hrybenko
9da16e592e stdlib: underscore reflect() and unsafeReflect()
Part of removing the old mirrors.

rdar://21428474

Swift SVN r29826
2015-07-01 00:31:39 +00:00
Dave Abrahams
b034468ebb [stdlib] Fix indentation
Swift SVN r29392
2015-06-15 23:40:07 +00:00
Greg Parker
6c812d0751 [stdlib] Reinstate r29043 "strip final from protocol extensions".
This reverts r29050. This wasn't the change that broke the SourceKit tests.


Swift SVN r29052
2015-05-27 01:52:17 +00:00
Greg Parker
16a3b8ebd7 [stdlib] Revert "strip final from protocol extensions".
SourceKit tests need to be updated.


Swift SVN r29050
2015-05-27 01:34:45 +00:00
Dave Abrahams
1f1643221d [stdlib] strip final from protocol extensions
Now that we've lifted the requirement

Swift SVN r29043
2015-05-26 23:52:36 +00:00