Commit Graph

63 Commits

Author SHA1 Message Date
Enrico Granata
f59f6abc4e The bot is unhappy that these are not marked @public, so mark them @public
Swift SVN r19388
2014-07-01 01:47:13 +00:00
Enrico Granata
9abfdb372e Add a Mirror for UnsafePointer
The one design choice here was whether to expose the pointee directly through the Mirror

My choice was against that. Instead, we present UnsafePointer as UnsafePointer(0x123) and the child we expose is the 0x123 numeric pointer value

The other option, of course, would be to present it as UnsafePointer(reflect(memory)) - but that seems risky to do by default
UnsafePointers are allowed to be in, guess what, unsafe states, and the stakes of having playgrounds try and dereference at all times are quite too high.

If the user really wants to reflect the pointee reflect(pointer.memory) will do it for them - and then any crashes will be theirs to enjoy.

Of course, I am very open to arguments as to why reflect(memory) would be a better choice.



Swift SVN r19386
2014-07-01 00:54:52 +00:00
Dave Abrahams
8e7d45f2c0 [stdlib] Normalize .gyb files
- Follow LLVM conventions for emacs mode specification

- Use local variables suffix to make the output read-only (at least on
  Emacs)

- But drop the admonitions not to edit the generated files;
  line-directive mostly takes care of that problem now.

Swift SVN r19381
2014-06-30 23:24:17 +00:00
Jordan Rose
5e59d30c6f Update stdlib for memberwise access control.
As before, there may be more things marked @public than we actually want
public. Judicious use of the frontend option -disable-access-control may
help reduce the public surface area of the stdlib.

Swift SVN r19353
2014-06-30 18:50:50 +00:00
Joe Groff
47fde864e9 Remove UnsafePointer.withUnsafePointer.
This is no longer necessary for API parity with CMutablePointer now that pointer conversions are in.

Swift SVN r19296
2014-06-27 16:54:51 +00:00
Joe Groff
cb48fbd24b Enable pointer conversions.
Swift SVN r19274
2014-06-26 23:26:31 +00:00
Joe Groff
687e1c5174 stdlib: Migrate some stdlib convenience APIs to UnsafePointer.
Give UnsafePointer versions of CMutablePointer._setIfNonNil and _withBridgeObject/Value. Also provide a version of 'withUnsafePointer' as a staging aid so that UnsafePointer can be used in place of CMutablePointer.

Swift SVN r19215
2014-06-26 01:51:45 +00:00
Joe Groff
87dd6ed419 stdlib: Add #ifs to help stage in pointer conversions.
Hide the bridged C*Pointer types if the stdlib is built with -DENABLE_POINTER_CONVERSIONS as a temporary transition aid.

Swift SVN r19159
2014-06-25 16:37:25 +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
Ted Kremenek
58558fcca3 Rename 'succ' and 'pred' to 'successor' and 'predecessor' respectively.
This is motivated by <rdar://problem/17051606>.

This ends up renaming variables as well, which seems right for
consistency since we use "predicate" as variable name.

Swift SVN r19135
2014-06-24 19:27:19 +00:00
Joe Groff
1a1683e813 stdlib: Add internal entry points that can be used by intrinsic pointer conversions.
Swift SVN r19084
2014-06-22 20:10:19 +00:00
Jordan Rose
f60213e4e6 Update Joe's UnsafePointer changes to account for Chris's ..< changes.
Swift SVN r19010
2014-06-19 18:09:55 +00:00
Joe Groff
aeaa23470c stdlib: Add a ConstUnsafePointer type.
Like UnsafePointer, without the mutation accessors. gybify UnsafePointer.swift so we can generate both types from the same skeleton.

Swift SVN r18937
2014-06-16 20:35:30 +00:00