Commit Graph

215 Commits

Author SHA1 Message Date
Dmitri Hrybenko
63c5a145b4 stdlib: factor out _SwiftNSFastEnumerationState initialization
Swift SVN r17624
2014-05-07 12:54:17 +00:00
Dave Abrahams
7f29548040 [stdlib] Re-alphabetize CMakeLists.txt
Swift SVN r17489
2014-05-05 21:24:45 +00:00
Dave Abrahams
23f98db278 [stdlib] A .utf16 property for String
Also, test the .utf8 property

Swift SVN r17488
2014-05-05 21:23:48 +00:00
Ted Kremenek
050fd53af7 Rename UncheckedOptional to ImplicitlyUnwrappedOptional.
Swift SVN r17232
2014-05-02 06:13:57 +00:00
Dmitri Hrybenko
9d4bd6da69 stdlib: remove Keyboard
rdar://16205673


Swift SVN r17089
2014-04-30 13:00:08 +00:00
Dave Abrahams
efe08045ba [stdlib] Kill (Contiguous|Opaque)String
Detritus makes it hard to do API review, so kill it off.

Along the way we got a generic lexicographicalCompare algorithm.

Swift SVN r17064
2014-04-30 01:49:34 +00:00
Dave Abrahams
18c7b0e440 [stdlib] Kill StringByteData
StringByteData was legacy detritus containing an in-memory UTF8
representation of a Swift string.  Since we switched to a UTF16 base
representation, use the new stuff in StringUTF8 instead.

Swift SVN r16968
2014-04-28 08:32:41 +00:00
Dave Abrahams
1dd3b76e97 [stdlib] Add a lazy UTF8 view of String
We need something here so we can rip out StringByteData.  Ideally this
would have BidirectionalIndex'es, but this will do for now.  It has to
be a Collection so we can represent its multi-pass-ness.

Swift SVN r16966
2014-04-28 08:32:40 +00:00
John McCall
d9e4d6f2ad Add the Unmanaged library type.
Swift SVN r16796
2014-04-25 02:16:04 +00:00
Arnold Schwaighofer
45ffb41adf Remove AssertDebug hack and fixup make files
When we build the standard libary with -parse-stdlib the frontend sets the
assert configuration to 'DisableReplacement'. Constant replacement does not take
place and the call to the builtin function 'assert_configuration' call stays in
the serialize SIL of the swiftmodule.

IRGen replaces the function call to the assert_configuration builtin function by
the value for Debug (0). The resuling standard library dylib hence contains the
debug version of the standard library assert function.

Frontend optimization flags can now determine whether asserts should be executed
or not.

This commit removes the SWIFT_ASSERTS cmake flag.

rdar://16458612

Swift SVN r16473
2014-04-17 22:05:43 +00:00
Enrico Granata
942676abb2 Everyone loves a good Mirror, and this commit has plenty of them!
With this check-in, we get Mirrors for IntXX, UIntXX, Float32, and we don't lose the existing ones for Double, Int, String and Bool

This fixes rdar://16517273 and will make playgrounds able to display more data more often more consistently!



Swift SVN r16418
2014-04-16 17:16:06 +00:00
Dave Abrahams
f4b04760c8 [stdlib] Add a lazy "Map" Collection
The name may have the wrong implication to a C++'er, but the point is
that this Collection is a Lazy version of the map() function.  Maybe we
should be giving our Collections capitalized lazy versions of their
member algorithms, e.g.

  a.Map {something}

Swift SVN r16110
2014-04-09 09:43:22 +00:00
Dave Abrahams
3de27d2179 [stdlib] Array: add bridgeCache/fix refCounting
Array's getObjects:range: needs to fill the supplied buffer without
incrementing the reference count.  For that reason, and to fulfill
lifetime expectations for Array elements that are computed
dynamically (e.g. from value types that are BridgedToObjectiveC), we
maintain a cache of converted objects associated with each Array.

Swift SVN r16105
2014-04-09 07:59:43 +00:00
Dave Abrahams
de3df28a62 [stdlib] Reorganize [Native]Array/Slice code
Just moving things between files, and creating a few new source files, in
the standard library, so it's easier to find a given component.

Swift SVN r16094
2014-04-09 02:32:15 +00:00
Dave Abrahams
2adf0679a3 [stdlib] CountAndCapacity => ArrayBody
CountAndCapacity is about to become even more Array-specific, so rename
it and give it its own source file.

Swift SVN r16091
2014-04-09 01:25:03 +00:00
Dave Abrahams
27daefa878 [stdlib] Delete obsolete Array.swift
It held the old implementation and is no longer needed.

Swift SVN r16062
2014-04-08 18:41:06 +00:00
Dave Abrahams
548f3c0e81 [stdlib] Add and test single-element modifiers
Swift SVN r15978
2014-04-05 05:39:17 +00:00
Dave Abrahams
dd96f5f082 [stdlib] Give ArrayBufferType its own file
Swift SVN r15770
2014-04-02 02:47:39 +00:00
Dave Abrahams
079821c8cc [stdlib] Start generating actual (new) Array types
Swift SVN r15769
2014-04-02 02:47:38 +00:00
Dave Abrahams
004998e63e [stdlib] Move SliceBuffer into its own file
Swift SVN r15766
2014-04-02 02:47:34 +00:00
Dave Abrahams
800cba5125 [stdlib] Bring most of ArrayType into the stdlib
The ArrayType protocol is developed for NewArray is a good basis for
what we want, but the ability to create arrays without value semantics
is adding complexity but questionable value.  It isn't clear that we can
usefully expose a type called SharedArray<T>, even internally, if it
ceases to be truly shared when one copy grows, and therefore has its
buffer reallocated. Therefore, leave the NewArray test with a
ArrayType2, a refinement of ArrayType, that adds the ability to report
on its value semantics.

If we really want the optimizations that can be had in a large-scale
mutation by first unique'ing the array and making mutations in-place
thereafter, we can fall back to operating on NativeArrayBuffer<T>
directly.

Swift SVN r15673
2014-03-31 08:42:55 +00:00
Michael Gottesman
c98c4d54b1 Move Benchmark.swift out of the stdlib now that we can deserialize from the stdlib.
rdar://15797364.

Swift SVN r15636
2014-03-29 22:19:34 +00:00
Dave Abrahams
9ef1ba13c0 [stdlib] Rename file ArrayBridge => ArrayCore
Swift SVN r15618
2014-03-29 10:43:45 +00:00
Dave Abrahams
bfc6cfa5b6 [stdlib] Give Array bridging a home of its own
Also create a simple NSSwiftArray class that DaveZ can use to test our
bridging strategy.

Swift SVN r15081
2014-03-14 22:07:14 +00:00
Jordan Rose
27d1746467 [CMake] Move the install command for the Clang headers to the shims target too.
For consistency with r14968.

Swift SVN r14969
2014-03-12 22:17:02 +00:00
Jordan Rose
1c4d9b78a4 [CMake] Symlink Clang's headers into lib/swift as part of copy_shim_headers.
Turns out CMake's PRE_BUILD mode for custom commands doesn't work with the
Ninja or Makefile generators (not sure about Xcode). Just do it as part of
an earlier target instead.

Swift SVN r14968
2014-03-12 22:11:26 +00:00
Dave Abrahams
a398607c43 [build] Evil hack to make Make make
CMake's Makefile generator is not very smart about sibling dependencies,
apparently.  See the comment in the commit for more details.

Swift SVN r14909
2014-03-11 05:56:09 +00:00
Dave Abrahams
38f68fcba4 [build] stdlib core depends on SwiftShims
We need to make sure the core standard library is rebuilt when the shims
header changes.

Swift SVN r14906
2014-03-11 03:22:12 +00:00
Dave Abrahams
7a91b9f749 [stdlib] Remove *, /, and % from RandomAccessIndex
Before this commit, RandomAccessIndex was a refinement of
NumericOperations, which forced it to support inappropriate operations
such as multiplication.  Many obvious random-access index types can't
support multiplication (e.g. a StridedIndex adapter, which moves its
underlying index by N positions for each increment).

Along the way:

* the addition and subtraction operations on RandomAccessIndex were
  renamed to advancedBy and distanceTo, which prevents nasty ambiguities
  when a type conforms to both RandomAccessIndex and Integer, and allows
  Index DistanceTypes to actually be signed integers even when the Index
  is unsigned.

* Before this commit, using internal interfaces, it was possible to
  request static checking without also getting dynamic checks when
  static checking is impossible.  Now the relationship between static
  and dynamic checking is built into the core protocols.

* NumericOperations.swift was moved into IntegerArithmetic.swift.gyb,
  correcting missing operators by generating them programmatically and
  in preparation for renaming the protocol to something more appropriate

Fixes

  <rdar://problem/16246927> RandomAccessIndex is over-constrained

and possibly:

  <rdar://problem/15605729> Make all operators generic over
  protocols (in particular, get NumericOperations done)

Swift SVN r14854
2014-03-09 19:56:18 +00:00
Dave Abrahams
469f8629c6 [stdlib] OpaqueString is still an essential source
Swift SVN r14852
2014-03-09 19:56:16 +00:00
Dave Abrahams
6732cc1c4d [stdlib] Bugfix for essential sources check
I was using the wrong variable name in CMakeLists.txt

Swift SVN r14851
2014-03-09 19:56:15 +00:00
Dave Abrahams
0ec3ead12b [stdlib] Link an essential core library subset
To support layering improvements, add an (optionally built) "essential
core" library containing the minimum set of files required just to link
successfully.  Right now all those object files are linked again into
swift_stdlib_core; it would probably be better to link the essential
core into the core, but my CMake/Swift Driver fu is not strong enough
and this will at least help during development.

Along the way, removed the obsolete SwiftStdlibSources.txt file, as we
only have to support one build system now.

Swift SVN r14792
2014-03-07 21:01:49 +00:00
Joe Groff
3d93acb81b stdlib: Remove the 'Object' class.
It's dead, Jim. Also remove 'ClassNameable' since we don't use it for anything.

Reapply r14647 now that John fixed the serialization issue that scuttled it last time.

Swift SVN r14722
2014-03-06 04:53:25 +00:00
Joe Groff
565f889fe8 Revert "stdlib: Remove the 'Object' class."
This reverts commit r14647. It exposes an optimizer bug.

Swift SVN r14648
2014-03-04 17:39:06 +00:00
Joe Groff
59426904e2 stdlib: Remove the 'Object' class.
It's dead, Jim. Also remove 'ClassNameable' since we don't use it for anything.

Swift SVN r14647
2014-03-04 17:14:27 +00:00
Dave Abrahams
c33a59c6a7 [build] Complete gyb support
Remove all gyb-generated files and generate them automatically from .gyb
files.  Rename the proof-of-concept UnsafeArray.swift.gyb back to
UnsafeArray.swift.  Never forget to update the .gyb file or regenerate
again!

Swift SVN r14445
2014-02-27 03:01:16 +00:00
Dave Abrahams
69c1a857f9 [build] Basic support for gyb
Now a "foo.bar.gyb" file in a list of sources gets automatically
processed through gyb to produce "foo.bar"

Renamed a simple .swift file in the stdlib (which needs a rename anyway)
to have a .gyb extension as a proof-of-concept.

To make this useful for our existing gyb files, we need to figure out
how to pass them the right arguments; that's coming next.

Swift SVN r14444
2014-02-27 02:23:11 +00:00
Chris Lattner
3f5255fa2c update gyb files for val -> let.
Swift SVN r14442
2014-02-27 02:15:03 +00:00
Joe Groff
f02f4314eb Update original .gyb file for FixedPoint*.swift.
Swift SVN r14437
2014-02-27 01:07:56 +00:00
Ted Kremenek
028f9d0561 Remove rest of Makefile build except for 'docs' and 'www'.
For 'docs' and 'www' it is possible these are still being used,
as they work independent of the Makefile build.  Keeping them for now.

Swift SVN r14418
2014-02-26 22:21:25 +00:00
Dave Abrahams
aa97136232 [stdlib] Replace all uses of ~> with boilerplate
Swift SVN r14314
2014-02-24 21:08:07 +00:00
Dave Abrahams
28e67eb007 [stdlib] Backport edit to FixedPoint.gyb
r13988 made the change to the generated files, but not the source.

Swift SVN r14310
2014-02-24 19:50:28 +00:00
Dmitri Hrybenko
3da05e347d Change property accessor syntax to include braces
See release notes update for details.

rdar://15966905


Swift SVN r14271
2014-02-22 21:00:56 +00:00
Joe Groff
73e564428f stdlib/runtime: Stub out a mechanism for introspecting value structure.
Define a "Mirror" protocol with methods for querying the number of children a structured value has, getting the name and mirror for each of those children, and a string and "IDE representation" of the value, as needed by playgrounds and by our planned generic printing facility.

In the runtime, define a "reflect" function that can provide a Mirror for any object, either using a "Reflectable" protocol conformance if available, or falling back to a magic implementation in the runtime that grovels the type metadata. Stub out a bare minimum default implementation.

Swift SVN r14139
2014-02-20 08:26:27 +00:00
Dave Zarzycki
f9b6b02b9b stdlib: remove SNaN generation completely
We'll add this back when we're ready.

Swift SVN r14130
2014-02-20 07:12:46 +00:00
Dave Zarzycki
092d420b83 stdlib: disable ability to generate SNaN
<rdar://problem/16091995> Signaling NaN doesn't work in i386

Swift SVN r14128
2014-02-20 07:02:43 +00:00
Dave Zarzycki
f7e815dfb4 stdlib: remove CountingSink
<rdar://problem/15634455> dead CountingSink in the stdlib

Swift SVN r14127
2014-02-20 06:51:22 +00:00
John McCall
26c076832b Update for stdlib name change.
Swift SVN r14010
2014-02-17 22:20:25 +00:00
Jordan Rose
0b2541b58f Rename the standard library to "Swift" (instead of "swift")
This is more in line with all other modules currently on our system.
If/when we get our final name for the language, we're at least now set
up to rename the library without /too/ much trouble. (This is mostly just
a lot of searching for "import swift", "swift.", "'swift'", and '"swift"'.
The compiler itself is pretty much just using STDLIB_NAME consistently now,
per r13758.)

<rdar://problem/15972383>

Swift SVN r14001
2014-02-17 19:30:47 +00:00
Dave Abrahams
67734b1835 [stdlib] CollectionOfOne<T>
A simple collection of one element

Swift SVN r13976
2014-02-17 04:56:11 +00:00