Commit Graph

21665 Commits

Author SHA1 Message Date
Doug Gregor
0d37bd3015 Switch the standard library from "static" to "type".
Swift SVN r12026
2014-01-08 01:09:56 +00:00
Dave Zarzycki
6e7bb68279 15763917 stdlib/POSIX should probably be removed
Foundation vends wrappers for most of this stuff anyway. We should
duplicate or "innovate" here.

Swift SVN r12002
2014-01-07 19:10:42 +00:00
Dave Abrahams
212f39e307 [stdlib] Rename Indexable.swift => Container.swift
Now that the protocol name changed, get the filename straightened out
too.

Swift SVN r11959
2014-01-06 22:30:27 +00:00
Doug Gregor
1ee513e7e8 Use Builtin.Word for array lengths, string literal lengths, etc.
This eliminates a number of 64-bit integer/64-bit pointer assumptions
in the type checker and SILGen.


Swift SVN r11863
2014-01-03 18:53:01 +00:00
Dave Zarzycki
632264cbd1 stdlib: checkpoint 15612767: Int should become a separate, platform-sized type
1) Abstract away assumptions about all LLVM types being prefixed by 'Int'.
2) Thread through the ability to create a "word" sized type. This is
   blocked by a couple bugs.
3) Fix a bug where Int8/UInt8 did not conform to ArrayBounds.
   (This bug dates back to when FixedPoint.swift was hand maintained.)

Swift SVN r11858
2014-01-03 07:50:08 +00:00
Dave Abrahams
b86ebcc042 [stdlib] Rename Char.swift => UnicodeScalar.swift
Swift SVN r11846
2014-01-03 01:37:33 +00:00
Dave Abrahams
0ca0b46065 [stdlib] Rename NewString.swift -> String.swift
Swift SVN r11845
2014-01-03 01:32:20 +00:00
Dave Abrahams
dc26363d29 [stdlib] Remove String.swift
It was only serving up a single typealias

Swift SVN r11832
2014-01-02 22:09:08 +00:00
Dave Abrahams
8eb7129b9c [stdlib] Replace String with NewString
This change is as minimal as possible, which means leaving obsolete
functionality in place (e.g. StringByteData) and even keeping the
"NewString" name in many places.  The obsolete functionality was useful
for testing my changes, but expect immediate cleanup commits
addressing all those issues to follow.

* All String bridging now happens in pure Swift code.

* Because String no longer owns an array of UInt8, some assumptions and
  assertions are no longer valid.  As a result, some code was deleted
  and all the code that produces null-terminated strings had to be
  rewritten

* test/Constraints/construction.swift had to have one test commented out
  because it relied on an element of the String interface that I did not
  port forward.  It seems to me that this test should declare its own
  types and not rely on the stdlib, if it's still valid.

* One test in /test/stdlib/Algorithm.swift had to be disabled pending
  <rdar://problem/15736729> and <rdar://problem/15733855>

* This change revealed that test/Interpreter/repl.swift is sensitive to
  type-alias names; I had to change a "NewString" to "String" there.
  This may indicate a bug somewhere?

Swift SVN r11830
2014-01-02 20:16:59 +00:00
Dave Zarzycki
d24e2454de stdlib: add overflow checking to div and rem
Swift SVN r11783
2014-01-01 03:32:01 +00:00
Dave Zarzycki
0228f019c1 stdlib: make unary + generic over SignedNumbers
Swift SVN r11774
2013-12-31 20:16:13 +00:00
Dave Zarzycki
3feaac40c6 stdlib: drop IEEE from type/protocol names
Swift SVN r11768
2013-12-31 05:28:57 +00:00
Dave Zarzycki
a38ce8d8ef stdlib: move related NumericOperations out of Policy.swift
Swift SVN r11762
2013-12-31 03:41:30 +00:00
Dave Zarzycki
44269cc01d stdlib: Move IEEE754 support into its own file
Swift SVN r11761
2013-12-31 02:42:16 +00:00
Dave Zarzycki
f4e60d11b3 stdlib: Move the LogicValue implementation into its own file
Swift SVN r11759
2013-12-31 02:31:01 +00:00
Dave Zarzycki
c550e75954 stdlib: consolidate compiler protocols into a dedicated file
Annotating each protocol with "NOTE: ..." doesn't scale.

Swift SVN r11758
2013-12-31 02:08:59 +00:00
Dave Zarzycki
669ca06213 stdlib: mark SignedNumber methods as @transparent
Swift SVN r11757
2013-12-31 01:54:11 +00:00
Dave Zarzycki
9bfa643933 stdlib: abs() should use Builtin.*fabs* on floats
Swift SVN r11745
2013-12-30 21:42:22 +00:00
Doug Gregor
8383a25989 Remove the __less__ hack; use < instead.
Note that we have to work around <rdar://problem/14432081> a bit.

Swift SVN r11726
2013-12-29 21:05:16 +00:00
Doug Gregor
d1054b9e86 Eliminate the __equal__ protocol requirement; use == directly.
This is DaveA's patch, slightly tweaked, which works properly now that
<rdar://problem/15715996> is fixed.

Swift SVN r11725
2013-12-29 20:45:25 +00:00
Chris Lattner
4f4c698ed6 Change 'self' to be an rvalue instead of an lvalue in non-@mutating
struct methods.  This does not including properties and subscripts,
but covers the bulk of the change.  The implication of this is that
the compiler now rejects mutations of self in a non-@mutating method,
and rejects attempts to call a @mutating method from a non-@mutating
method.

Along with this:
 - Fix a refcounting bug in SILGenExpr where I emitted multiple releases
   in the rvalue member_ref_expr case, which was exposed by the 
   testsuite now that rvalues are being used a lot more.
 - Change a few native binding things in objc/Foundation to understand
   that String is passed by value now when calling size() and that
   you can't take the address of self in a non-mutating method (this
   should probably pass the components by value instead of passing
   &self, for better performance).  I filed rdar://15726720 to track
   this.
 - Update a ton of testcases.  We now don't materialize nearly as much
   as we used to.
 - Brutalize the test/stdlib/Getopt.swift testcase to work, now that
   the "GetoptLongOptions().noArgument("foo")" builder pattern doesn't
   work anymore (noArgument is a @mutating method, which isn't allowed
   on an rvalue temporary).



Swift SVN r11662
2013-12-26 17:38:03 +00:00
Joe Groff
3e30cbcfef SILGen/IRGen: Don't emit top_level_code for libraries.
If there's no script-mode file in a module, don't produce a top_level_code SILFunction for it, and don't consider emitting an LLVM global_ctor for it. We should never emit static constructors from user code anymore.

Swift SVN r11644
2013-12-26 00:18:29 +00:00
Dave Abrahams
afbbbd1287 [stdlib] Add a facility for calling "C" functions that take va_list arguments
This code has only been tested on x86_64, but is designed to work on
the other platforms supported by Apple.

Swift SVN r11561
2013-12-22 02:37:33 +00:00
Joe Groff
3c192269d0 Runtime: Remove debug noise from swift_getExistentialMetadata.
Swift SVN r11524
2013-12-20 23:06:14 +00:00
John McCall
c5aa41ffd1 Change around some manglings to make them carry more
information and be easier to demangle.

Swift SVN r11423
2013-12-18 08:33:52 +00:00
Dave Abrahams
85511c09b1 Remove mistakenly-committed file
Swift SVN r11329
2013-12-15 03:18:08 +00:00
Dave Abrahams
90f13d55b4 [stdlib] NSStringAPI: add a couple of missing .AutoReleased annotations
Swift SVN r11328
2013-12-15 03:13:10 +00:00
Doug Gregor
1ecccd8f47 Remove unused static function.
Swift SVN r11264
2013-12-13 21:19:53 +00:00
Dave Abrahams
eea35fd745 BlockShims: correct a mangled name
Where did the triple underscore come from?  Are the other ones wrong,
too?  We should at least have a trivial test for each of these.

Swift SVN r11255
2013-12-13 16:18:43 +00:00
Dave Abrahams
5c24f790c8 [stdlib] NSStringAPI: create missing block shim
Now we can actually link the implementation of
enumerateLinguisticTagsInRange

Swift SVN r11221
2013-12-12 23:47:07 +00:00
Dave Abrahams
68c47c7121 [stdlib] Remove ObjectPointer.swift; it was not ready for prime-time
Swift SVN r11131
2013-12-11 17:20:06 +00:00
Dave Abrahams
4c98b501a6 [stdlib] Expose NSString.stringWithContentsOfFile on String
Along the way created bridging utilities for ObjectiveC functions that
take "out" arguments and added an fmap for operating on Optionals

Swift SVN r11123
2013-12-11 07:24:05 +00:00
Doug Gregor
a5167f6bac Remove the type-checker performance workaround in <rdar://problem/14925518>
Swift SVN r11118
2013-12-11 03:40:22 +00:00
Dmitri Hrybenko
b55f943d0d stdlib/FixedPoint: fix indentation
Swift SVN r11089
2013-12-10 20:44:03 +00:00
Joe Groff
ab95d6cd11 stdlib: Add a BitwiseOperations protocol.
Collect the bitwise logical operators under a protocol. Add an 'allZeros' static method to produce the 'zero' identity value for the type when used with bitwise operations.

Swift SVN r11068
2013-12-10 04:03:20 +00:00
Jordan Rose
b4fe56eb1c Actually fix the Makefile build for multi-file Swift libraries.
The hack to get the LLVM build system to do what we want is to define a
custom build rule for "XYZ.o" and then add "XYZ" as a dummy source file
to the SOURCES variable, which the LLVM Makefile system uses. To make it
clear that something unusual is going on here, I've changed all existing
instances of this to use "XYZ.o" in SOURCES, rather than having that name
be derived from "XYZ.swift" or whatever.

The actual Swift source files go in SWIFT_SOURCES for the time being
(and possibly forever, since Swift sources will always be built together).

Swift SVN r11058
2013-12-10 00:23:43 +00:00
Dave Abrahams
2293ac8d2e Fix the Makefile build
Since our build system isn't really set up to cope with
multi-sourcefile-modules, dump all Foundation support directly into
Foundation.swift

Swift SVN r11049
2013-12-09 23:17:29 +00:00
Dave Abrahams
00e4a84b74 [stdlib] Begin exposing the NSString API directly on String
Because we're using a "brute-force" combination of conversion to
NSString and forwarding, this code will continue to work when String
is replaced by NewString.  It may not be fast yet, but at least it
will flesh out the experience for Cocoa programmers

Swift SVN r11034
2013-12-09 18:44:58 +00:00
Anna Zaks
b75cb37cf8 Reapply r10534 in a more convenient form.
Swift SVN r10944
2013-12-06 22:10:52 +00:00
Dave Abrahams
983438948f [stdlib] Rip out mistakenly committed test code
Swift SVN r10920
2013-12-06 06:02:25 +00:00
Dave Abrahams
01b2a39029 [stdlib] Add a length property to NewString
Swift SVN r10919
2013-12-06 06:02:24 +00:00
Dmitri Hrybenko
f08ee12841 stdlib/FloatingPoint: add APIs to handle special floating point values
See IEEEFloatingPointNumber protocol for a full list of new APIs and
documentation.


Swift SVN r10826
2013-12-05 01:36:15 +00:00
Doug Gregor
95ebc6b596 Eliminate the use of the T(x) syntax as type coercion.
Long ago we decided to eliminate the use of this syntax for type
coercion, but we didn't have a good replacement (now we do: x as T)
and the type checker used this ability to handle string
interpolation. Switch string interpolation over to disjunction
constraints.


Swift SVN r10789
2013-12-04 21:11:57 +00:00
Dave Zarzycki
d08712cb35 15242776 stdlib: merge "Array" and "Slice" into Array.swift
The "HArray" name is temporary.

Swift SVN r10708
2013-12-01 08:16:43 +00:00
Dave Abrahams
b3955c6d7a [stdlib] NewString.swift: work in progress
Swift SVN r10680
2013-11-28 16:45:21 +00:00
Dave Abrahams
88b0edaf82 [stdlib] NewString: conversion from string literals
Swift SVN r10651
2013-11-22 00:40:08 +00:00
John McCall
b1bbbac19b Correct the mangling of SIL results to include the
ownership convention.

Swift SVN r10598
2013-11-20 18:05:05 +00:00
Doug Gregor
ba6362af8f Update VOID mangling for block shims.
Unbreaks the "Name That Tune" build.


Swift SVN r10593
2013-11-20 16:35:50 +00:00
John McCall
20e58dcf93 Change the type of function values in SIL to SILFunctionType.
Perform major abstraction remappings in SILGen.  Introduce
thunking functions as necessary to map between abstraction
patterns.

Swift SVN r10562
2013-11-19 22:55:09 +00:00
Dave Zarzycki
18fc62f4eb 15489271 Adopt @transparent on min/max static var min/max decls of the integer types
Swift SVN r10534
2013-11-17 23:16:41 +00:00