Commit Graph

21803 Commits

Author SHA1 Message Date
Dmitri Hrybenko
29cebdf797 Splitting the standard library: step 1: move stdlib -> stdlib/core
Swift SVN r5864
2013-06-28 02:31:01 +00:00
Dave Abrahams
2e0ff6e8ca [stdlib] Add HeapBuffer: a reference-counted buffer of dynamic size
This will be useful in implementing Copy-On-Write value types

Swift SVN r5844
2013-06-27 20:47:18 +00:00
Doug Gregor
9a5c96a8c1 Introduce basic support for LLVM vectors as builtins.
This adds builtin types Builtin.VecNxT, where N is a natural number
and T is a builtin type, which map down to the LLVM type <N x T>. 

Update varous builtins to support vector arguments, e.g., binary
operations, comparisons, negation. Add InsertElement and
ExtractElement builtins for vectors.

On top of these builtins, add Vec4f and Vec4b structs to the standard
library, which provide 4xFloat and 4xBool vectors, respectively, with
basic support for arithmetic. These are mostly straw men, to be burned
down at our leisure.

Some issues as yet unresolved:
  - Comparisons of Vec4f'ss are producing bogus Vec4b's, which I
  haven't tracked down yet.
  - We still don't support the shuffle builtin, although it should be
  easy
  - More testing!



Swift SVN r5820
2013-06-26 21:16:36 +00:00
Chris Lattner
bc903a5513 Add a new -parse-stdlib command line option to better model autoimport
of swift vs builtin module (moving towards rdar://11187080).  When
swift ultimately has "project files", this bit will come from there,
until then it is best to come from the command line.



Swift SVN r5739
2013-06-21 17:24:49 +00:00
Dmitri Hrybenko
6fa2efaf0b stlib: Introduce a LifetimeManager -- a class to emulate precise lifetime.
This is needed to ensure that the objects are not deallocated when they are
passed as UnsafePointers to C APIs.

Also clean up our String <-> CString <-> UnsafePointer<UInt8> conversion
routines.  Clean up all users and refactor users poking into CString's
internals whenever possible.


Swift SVN r5656
2013-06-18 21:51:46 +00:00
Dave Zarzycki
4dae2eb7c2 Remove Float{16,128}
We can always add these back later.

Swift SVN r5510
2013-06-07 17:32:56 +00:00
Dave Abrahams
a3f937a21c [stdlib] Never break the Makefile build again!
Swift SVN r5482
2013-06-05 21:09:36 +00:00
Doug Gregor
b393311086 Unbreak Makefile build
Swift SVN r5469
2013-06-04 17:30:34 +00:00
Dave Abrahams
c5da3b6888 [stdlib] Add Indexable protocol and adapters
Swift SVN r5444
2013-06-03 20:09:24 +00:00
Dave Abrahams
1c0dea724c [stdlib] Add Ranges of Forward and Bidirectional values
Swift SVN r5443
2013-06-03 20:09:23 +00:00
Dave Abrahams
baab5913ad [stdlib] Dictionary uses Optional<String> instead of relying on String nullability
Swift SVN r5301
2013-05-24 16:39:23 +00:00
Chris Lattner
8f4f90606d move the order of .swift files. This order crashes the compiler.
Swift SVN r5274
2013-05-22 21:32:35 +00:00
Dave Abrahams
b2b4bf9f32 [stdlib] Incorporate CodePoints; split tests out accordingly
Swift SVN r5273
2013-05-22 21:05:47 +00:00
Dave Abrahams
24af18987b [stdlib] Generators and Adaptors
Allows us to write in terms of the "ideal" traversal protocol while
maintaining compatibilty with the existing one

Swift SVN r5101
2013-05-08 21:39:12 +00:00
Dave Abrahams
a793099ba2 Add Zip.swift to the stdlib Makefile
Swift SVN r5078
2013-05-07 15:31:37 +00:00
Dave Abrahams
78cb2016e6 Add Zip2, which zips two Enumerables
Swift SVN r5077
2013-05-07 02:14:24 +00:00
Doug Gregor
401cbf4058 Add Optional.swift to the list of stdlib sources in the makefile.
Swift SVN r5063
2013-05-06 21:32:20 +00:00
Dave Abrahams
9e0ecddfb9 stdlib: add Optional<T>
Swift SVN r5020
2013-05-01 23:19:48 +00:00
Dave Abrahams
2760b9ced7 WIP: CodePoints range with access to first() element
Swift SVN r4935
2013-04-27 13:31:14 +00:00
Joe Groff
f5bfb870c5 Make -sil-irgen default for stdlib too.
Everything seems to work now.

Swift SVN r4755
2013-04-16 02:56:11 +00:00
Joe Groff
76331b2391 Make -sil-irgen default everywhere (except libs).
Everything can compile and run with SILGen now, but there are a handful of crashing tests when linking against a stdlib built with SIL, so make SWIFT_SIL_IRGEN a CMake option and disable it by default for now. Also tag the IRGen tests with -no-sil-irgen so that I don't have to rewrite their CHECK: lines right now.

Swift SVN r4749
2013-04-16 00:46:59 +00:00
Dave Zarzycki
90f8078ce2 Compile multiple files as one translation unit
1) This now works: swift -o foo.o *.swift
2) Errors/warnings are now correct: ".../OutputStream.swift:331:10:"

NOTES:
1) The name of the module is now inferred from -o when available.
2) I had to workaround a unexpected IRGen crash with '&&' in Slice.swift. Weird.
3) "Assemble" is now the default, not "GenerateLL".
4) 'import swift' still requires the 'cat *.swift > swift.swift' hack.

NEXT STEP:
Make 'clang -o foo *.swift' and 'clang -o foo.dylib *.swift' just work.

Swift SVN r4572
2013-04-02 08:10:59 +00:00
Dave Abrahams
3f6a40b648 Add swift-level argv access
Swift SVN r4566
2013-04-01 22:47:25 +00:00
Joe Groff
4366f258cf Makefiles: Fix a race in creating lib/swift.
The rules in runtime/Makefile create a lib/swift symlink without a dependency on
lib/swift, but the library rules all create a real directory, creating a race
between making the symlink and making the directory and breaking the build if
the latter wins. Make a formal rule for lib/swift that creates a symlink, and
update all the .dir dependencies on the directory to instead depend on the
symlink.



Swift SVN r4537
2013-03-29 16:33:22 +00:00
Doug Gregor
599d761891 Remove "-constraint-checker" everywhere, since it is now the default.
Swift SVN r4301
2013-03-06 06:38:40 +00:00
Dave Zarzycki
2d8719ac75 Unbreak 'make' on OSX 10.9
Swift SVN r4179
2013-02-25 02:11:37 +00:00
Joe Groff
d78d95b861 stdlib: Add a 'replExit' hook.
In the repl, if a replExit function is defined, call it when the repl is exiting. In the stdlib, add an atREPLExit function that pushes replExit handlers onto a vector and a replExit function that invokes those handlers. In swiftAppKit, have REPLApplicationMain use atREPLExit to terminate the application when the REPL is exited.

Swift SVN r4132
2013-02-21 20:50:15 +00:00
Dave Zarzycki
33b9f245e2 Cleanup: Move Range logic out of Enumeration
Next up: make a generic Range<T> and Series<T> once we can tiptoe around the constraint checker...

Swift SVN r3764
2013-01-15 19:14:55 +00:00
Dave Zarzycki
9232d330c1 Add formal Word and UWord types
These types are meant as _implementation_ details for classes/structs to
save space on 32-bit machines. "Int" is still the one true integer type
between classes/structs.

Use a build system hack to get Word/UWord to be 32 bits in size on
32-bit targets.

Swift SVN r3755
2013-01-12 01:46:21 +00:00
Chris Lattner
7f0663fe6c didn't mean to commit this.
Swift SVN r3690
2013-01-05 00:39:25 +00:00
Chris Lattner
c378beb606 Fix rdar://12951176 - rejecting */, instead of parsing it as an operator.
Swift SVN r3687
2013-01-04 23:21:56 +00:00
Dave Zarzycki
480c1b8f5e Split Char and StringByte out of String.swift
Swift SVN r3678
2013-01-04 17:54:38 +00:00
Dave Zarzycki
c205840079 Add Float16 and Float128 but only typecheck them
Swift SVN r3672
2013-01-04 06:26:15 +00:00
Dave Zarzycki
2ed2aaa3f5 Add Float80 and limit it to x86/x86_64 with a build system hack
Swift SVN r3671
2013-01-04 06:26:13 +00:00
Dave Zarzycki
33076b5b38 Split FloatingPoint.swift into Float32.swift and Float64.swift
Swift SVN r3670
2013-01-04 06:26:11 +00:00
Dave Zarzycki
ef7c502b33 Move policy out of Misc.swift into Policy.swift
Also, until the typechecker improves, be paranoid and concat the Policy
file upfront at build time.

Swift SVN r3649
2013-01-02 22:48:21 +00:00
Dave Zarzycki
ba7f0b0f2c Enable '==' and '!=' for class references
This may not be how we want to implement class equality checks in the
long run, but in the short term this is _very_ handy. See also:
<rdar://problem/12939898> ER: formalize root classes

This also removes support for greater-than/less-than on Vectors, which
makes no sense given that this has everything to do with the randomness
of the memory allocator and nothing intrinsic about Vectors or class
references in general.

Swift SVN r3628
2012-12-31 01:43:58 +00:00
Doug Gregor
d2c40eeccd Move the ObjCBool type into the 'objc' module.
Swift SVN r3533
2012-12-18 22:06:48 +00:00
Dave Zarzycki
c825debf2f Cleanup Enumeration
I tried to transform getEnumeratorType() into a VarDecl, but IRGen hasn't implement this feature yet.

Swift SVN r3527
2012-12-18 02:12:19 +00:00
Doug Gregor
97ea8e66c3 Split the Objective-C types in the standard library into a separate file.
Eventually, the Objective-C types will move to a separate Objective-C
support layer. For now, they sit in the standard library.


Swift SVN r3463
2012-12-13 00:22:28 +00:00
Dave Zarzycki
36fc6a0c27 Make assert() work correctly in debug and release builds respectively
Yay for build system hacks! And thank you Doug for proposing this
instead of my original CPP hack...

Swift SVN r3446
2012-12-12 16:24:44 +00:00
Doug Gregor
3f9b2d0aab Add missing CTypes.swift, since I accidentally committed its use.
Swift SVN r3327
2012-12-03 15:35:34 +00:00
Doug Gregor
a79f61a4a7 Add missing #include to fix compilation with mainline Clang
Swift SVN r3326
2012-12-03 15:34:03 +00:00
Dave Zarzycki
5e7b9928fd Move Range out of Misc.swift into Range.swift
Swift SVN r3299
2012-11-29 21:51:26 +00:00
Dave Zarzycki
ac4ddce56d Move CString out and extend
Swift SVN r3296
2012-11-29 19:33:54 +00:00
Dave Zarzycki
25e83e44b6 Move Slice<T> and UnsafePointer<T> out of Misc.swift
Swift SVN r3294
2012-11-29 19:33:40 +00:00
Dave Zarzycki
fa5c235bff Move crude input shims to InputStream.swift
We need to replace and flush input streaming later with genuine parsing.

Swift SVN r3170
2012-11-13 22:52:00 +00:00
Dave Zarzycki
5e485a91f1 Move I/O logic out of Misc.swift
Also remove contentious [US]{8,16,32,64,128} types

Swift SVN r3169
2012-11-13 22:36:44 +00:00
Dave Zarzycki
e9d2c11710 Workaround lack of modules: fake 'errno'
Swift SVN r3162
2012-11-13 00:24:08 +00:00
Dave Zarzycki
79d61845de Crude filesystem directory support
Swift SVN r3078
2012-10-28 22:11:41 +00:00