Commit Graph

42 Commits

Author SHA1 Message Date
Dave Abrahams
0d383f28a9 [stdlib] CGFloat : CVarArgType
Along the way, had to generalize the mechanism for detecting that a type
is handled as a Double by C's varargs.

Swift SVN r24859
2015-01-30 23:23:57 +00:00
Dmitri Hrybenko
6670bb76ec Rewrite the CMake build system
Swift SVN r24124
2014-12-23 22:15:30 +00:00
Joe Groff
e6d97e8de7 Clang importer: Add a zeroing default initializer to imported structs.
If an imported C struct has no __nonnull pointer fields, then we can give a default initializer that zeroes all of its fields. This becomes a requirement when working with partially-imported types like NSDecimal. NSDecimal has bitfields Swift can't see yet, so it's impossible to DI, but the Foundation functions that work with NSDecimal all emit their result by out parameter, and without access to its fields it is impossible to initialize an NSDecimal for use with one of these functions. Implement the initializer using a builtin that gets lowered by IRGen; this is also made necessary by the fact that Swift has only a partial view of the struct, so we can't form a complete zero initializer until we have the definitive type layout from Clang.

Swift SVN r23727
2014-12-05 05:31:22 +00:00
Dave Abrahams
ebde372ef9 [stdlib] Add space to Core Graphics type printing
Core Graphics mirrors were emitting textual representations without
spaces following commas separating values.  This commit fixes that
issue.

Swift SVN r22897
2014-10-23 20:50:09 +00:00
Erik Eckstein
a4c7d89671 fix coding style in stdlib: move non-attribute keywords in same line as function declaration
Swift SVN r22275
2014-09-25 08:43:55 +00:00
Dave Abrahams
d1b6dfa48f [stdlib] pick off more public non-protocol docs
137 undocumented public non-operator APIs remain in core

Swift SVN r22253
2014-09-24 03:58:14 +00:00
Dave Abrahams
795799b0d2 [stdlib] Propagate Hashable docs
202 undocumented public non-operator APIs remain in core

Swift SVN r22241
2014-09-23 23:35:58 +00:00
Dave Abrahams
69470a24ff [stdlib] Propagate Strideable docs
228 undocumented public non-operator APIs remain in core

Swift SVN r22237
2014-09-23 23:13:28 +00:00
Dave Abrahams
dbde275230 [stdlib] Propagate Reflectable docs
230 undocumented public non-operator APIs remain in core

Swift SVN r22236
2014-09-23 23:08:43 +00:00
Dave Abrahams
24fe53ed6c [stdlib] Propagate OutputStream docs
240 undocumented public non-operator APIs remain in core

Note: previous estimates were wrong because my regex was broken.  The
previous commit, for example, had 260 undocumented APIs.

Swift SVN r22234
2014-09-23 22:01:49 +00:00
Dave Abrahams
7c9ebaa19f [stdlib] Propagate LiteralConvertible docs
219 undocumented public APIs remain in core

Swift SVN r22213
2014-09-23 11:12:39 +00:00
Doug Gregor
6a19c1235e Convert FloatLiteralConvertible to initializers
Swift SVN r21992
2014-09-16 22:45:09 +00:00
Doug Gregor
4dca192b18 Switch IntegerLiteralConvertible over to initializers.
Swift SVN r21986
2014-09-16 21:59:15 +00:00
Anna Zaks
412d59009c CGVector initializers should have named parameters.
This ensures they are consistent with other types like CGPoint.

Swift SVN r21758
2014-09-06 00:46:19 +00:00
Dmitri Hrybenko
60cf5d3d1b SwiftIntTypes.py: remove transitional '_new' suffix from a function name
Swift SVN r21579
2014-08-29 15:38:22 +00:00
Dmitri Hrybenko
cb9e5c2c86 stdlib: use simpler interface to iterate over integer types
Swift SVN r21573
2014-08-29 14:32:46 +00:00
Doug Gregor
8df878c02a Give CGRect/CGSize/CGVector initializers that take Doubles.
Now that CGFloat is its own distinct type, it's useful to have Double
initializers to go along with the Int initializers we added a while
back <rdar://problem/17224725>.

Swift SVN r21156
2014-08-12 21:54:50 +00:00
Dmitri Hrybenko
6f20c51e3e stdlib: fix crashes in CGPoint, CGSize, CGRect mirrors
rdar://17933906


Swift SVN r21091
2014-08-07 15:59:24 +00:00
Dmitri Hrybenko
ac0d9b8175 stdlib/CGFloat: GYB'ify initializers that convert between CGFloat and
integer types.  Never miss an integer type again.

rdar://17853313

Swift SVN r20751
2014-07-30 11:24:11 +00:00
Doug Gregor
681059a089 Make CGFloat conform to Strideable but not RandomAccessIndex.
This brings CGFloat into line with changes recently made to the other
floating-point types. <rdar://problem/17758020>

Swift SVN r20548
2014-07-25 17:17:18 +00:00
Doug Gregor
505674484b Allow construction of CGFloat from the sized Int/UInt types and vice-versa.
Fixes <rdar://problem/17670817> (+ dupes).
Notably, we were also missing a UInt(CGFloat) initializer, which

Swift SVN r20547
2014-07-25 16:56:47 +00:00
Ben Langmuir
9c267d5dc7 Add some missing cmake dependencies
The only interesting bit is that for stdlib/objc to build reliably, its
.o files all need to depend on the generated swiftmodule files for any
of its library dependencies.  It looks like cmake treats
target_link_libraries as only implying a dependency between the
resulting libraries, and not the objects.  For now, I've achieved this
by making the objects depend on the whole target (which includes
linking), but only the swiftmodule is actually necessary.

Swift SVN r20240
2014-07-21 04:07:50 +00:00
Jordan Rose
8f520414b7 [Accessibility] A private class cannot contain public methods.
There's no meaningful way in which these methods are public, since they
can't be accessed through any value of the type

<rdar://problem/17647878>

Swift SVN r20224
2014-07-20 17:26:24 +00:00
Enrico Granata
e67251392e Now that CGFloat is a struct, it needs to be reflected separately. We can still just reflect its native buffer, but an explicit Reflectable conformace is required. Fixes rdar://17682337
Swift SVN r19984
2014-07-15 20:42:08 +00:00
Chris Lattner
e0b0205cd7 Remove the @assignment attribute entirely. It doesn't do anything except
enforce its own little constraints.  The type checker isn't using it for
anything, and it is just clutter.

This resolves <rdar://problem/16656024> Remove @assignment from operator implementations



Swift SVN r19960
2014-07-14 22:44:25 +00:00
Doug Gregor
71cd9245ba Rename swift_stdlib_core -> swiftCore and swift_runtime -> swiftRuntime.
We can't use underscores in plists, so just makes the names consistent
<rdar://problem/17652418>.

Swift SVN r19954
2014-07-14 22:19:03 +00:00
Chris Lattner
8991456ff2 Switch infix/postfix/prefix to be declaration modifiers instead of attributes,
eliminating the @'s from them when used on func's.  This is progress towards
<rdar://problem/17527000> change operator declarations from "operator prefix" to "prefix operator" & make operator a keyword

This also consolidates rejection of custom operator definitions into one
place and makes it consistent, and adds postfix "?" to the list of rejected
operators.

This also changes the demangler to demangle weak/inout/postfix and related things
without the @.



Swift SVN r19929
2014-07-14 15:51:49 +00:00
Dave Abrahams
bf55e6b4ed [stdlib] s/FloatingPointNumberType/FloatingPointType/
Swift SVN r19887
2014-07-13 01:00:51 +00:00
Dave Abrahams
6d1095f44e Protocol names end in "Type," "ible," or "able"
Mechanically add "Type" to the end of any protocol names that don't end
in "Type," "ible," or "able."  Also, drop "Type" from the end of any
associated type names, except for those of the *LiteralConvertible
protocols.

There are obvious improvements to make in some of these names, which can
be handled with separate commits.

Fixes <rdar://problem/17165920> Protocols `Integer` etc should get
uglier names.

Swift SVN r19883
2014-07-12 17:29:57 +00:00
Greg Parker
bde0d301fc Fix fmod() covers. Add CGFloat to the math.h tests.
<rdar://problem/17275152> Can't call C fmodf() from stdlib


Swift SVN r19777
2014-07-10 03:54:27 +00:00
Jordan Rose
254930a134 Update stdlib for r19751.
Swift SVN r19755
2014-07-09 22:56:25 +00:00
Doug Gregor
9e2b68c4f9 Introduce CGFloat as a distinct struct type.
CGFloat is 32-bit on 32-bit architectures and 64-bit on 64-bit
architectures for historical reasons. Rather than having it alias
either Float (32-bit) or Double (64-bit), introduce a distinct struct
type for CGFloat. CGFloat provides a complete set of comparisons and
arithmetic operators (including tgmath functions), initializers allows
explicit conversion between it an Int, UInt, Float, and Double, as
well as conforming to all of the protocols that Float/Double do.

This formulation of CGFloat makes use of CGFloat
architecture-independent, although it still requires a number of casts.
Fixes <rdar://problem/17224725>

Swift SVN r19689
2014-07-08 19:00:18 +00:00
Jordan Rose
da29f099f0 Update stdlib for accessibility modifiers becoming context-sensitive keywords.
Swift SVN r19672
2014-07-08 02:17:46 +00:00
Enrico Granata
4fd20e7064 Use The Mirror Generator to simplify the CoreGraphics mirrors - a little bit of magic, but much less boilerplate
Oh, and add a test case for those Mirrors, since none was there



Swift SVN r19653
2014-07-08 00:17:06 +00:00
Doug Gregor
a5bde4e3a4 CMake: Add COMPILE_FLAGS support for add_swift_library.
COMPILE_FLAGS is currently used for two purposes:
  - For any target library, add the appropriate Swift optimization flags. This eliminates the add_swift_optimization_flags boilerplate and makes these flags work for all library variants
  - For the runtime, pass the appropriate define down when SWIFT_RUNTIME_CLOBBER_FREED_OBJECTS is set, so that all library variants get this setting.

Swift SVN r19444
2014-07-02 00:37:48 +00:00
Doug Gregor
99d4e0c8ed CMake: start building iOS variants for the CoreGraphics, Darwin, Dispatch, Foundation, ObjectiveC, and SpriteKit framework overlays
Swift SVN r19413
2014-07-01 17:11:36 +00:00
Jordan Rose
cca27d02a0 Tag everything in the standard library with accessibility attributes.
Keep calm: remember that the standard library has many more public exports
than the average target, and that this contains ALL of them at once.
I also deliberately tried to tag nearly every top-level decl, even if that
was just to explicitly mark things @internal, to make sure I didn't miss
something.

This does export more than we might want to, mostly for protocol conformance
reasons, along with our simple-but-limiting typealias rule. I tried to also
mark things private where possible, but it's really going to be up to the
standard library owners to get this right. This is also only validated
against top-level access control; I haven't fully tested against member-level
access control yet, and none of our semantic restrictions are in place.

Along the way I also noticed bits of stdlib cruft; to keep this patch
understandable, I didn't change any of them.

Swift SVN r19145
2014-06-24 21:32:18 +00:00
Arnold Schwaighofer
da6d9152b6 Differentiate between user assertion and preconditions and the like
assert() and fatalError()
These functions are meant to be used in user code. They are enabled in debug
mode and disabled in release or fast mode.

_precondition() and _preconditionFailure()
These functions are meant to be used in library code to check preconditions at
the api boundry. They are enabled in debug mode (with a verbose message) and
release mode (trap). In fast mode they are disabled.

_debugPrecondition() and _debugPreconditionFailure()
These functions are meant to be used in library code to check preconditions that
are not neccesarily comprehensive for safety (UnsafePointer can be null or an
invalid pointer but we can't check both). They are enabled only in debug mode.

_sanityCheck() and _fatalError()
These are meant to be used for internal consistency checks. They are only
enabled when the library is build with -DSWIFT_STDLIB_INTERNAL_CHECKS=ON.

I modified the code in the standard library to the best of my judgement.

rdar://16477198

Swift SVN r18212
2014-05-16 20:49:54 +00:00
Doug Gregor
1efd9fba5b Start accepting '#' in addition to '`' to mark a keyword argument <rdar://problem/16891828>.
Update the standard library, tests, diagnostics, and Fix-Its.

Swift SVN r17981
2014-05-13 00:03:04 +00:00
Ted Kremenek
fad874708e Adjust test cases.
Swift SVN r17964
2014-05-12 22:01:52 +00:00
Jordan Rose
20fb4513e2 [CMake] Fix dependencies for swiftDispatch.
Without proper dependencies among the overlays, we may try to load an
outdated overlay module while building another overlay.

Swift SVN r17753
2014-05-09 01:20:34 +00:00
Greg Parker
0275393c6d [stdlib] Add a CoreGraphics overlay with additions to CGPoint/CGSize/CGRect.
Swift SVN r16029
2014-04-07 22:54:14 +00:00