Commit Graph

21492 Commits

Author SHA1 Message Date
Dmitri Hrybenko
1b589e15ca stdlib: Remove a redundant _precondition from _asUTF16CodeUnit
Swift SVN r19583
2014-07-06 12:58:45 +00:00
Dmitri Hrybenko
e95a9e9b72 stdlib: rename private API _asUnicodeCodePoint to _asUnicodeScalar
Swift SVN r19582
2014-07-06 12:50:07 +00:00
Chris Lattner
190d4901ae improve the doc comment on toInt to be more specific about what it does.
Swift SVN r19577
2014-07-04 21:18:47 +00:00
Chris Lattner
0ad1c248c8 fix <rdar://problem/17493994> String.toInt() returns 0 (not nil) for some non-numeric characters
Swift SVN r19575
2014-07-04 21:02:49 +00:00
Dmitri Hrybenko
81f1e660a0 stdlib: hide encodeBitsAsWords
rdar://17315534


Swift SVN r19569
2014-07-04 17:04:48 +00:00
Dmitri Hrybenko
594dfe5e2d stdlib: hide swift_MagicMirrorData_summaryImpl
rdar://17315534


Swift SVN r19568
2014-07-04 16:08:29 +00:00
Dmitri Hrybenko
7f351643d9 stdlib: hide roundUpToAlignment
rdar://17315534


Swift SVN r19566
2014-07-04 15:57:47 +00:00
Dmitri Hrybenko
29ab26ca39 stdlib/UnicodeScalar: hide UnicodeScalar.isPrint(), it is not
Unicode-aware

rdar://17550187

Swift SVN r19564
2014-07-04 13:13:42 +00:00
Dmitri Hrybenko
6e5060d471 stdlib/UnicodeScalar: remove arithmetic operations, they interact in
non-obvious ways with double-quoted literal sytax; "1" - "1" used to compile

rdar://17225816


Swift SVN r19563
2014-07-04 13:11:52 +00:00
Dmitri Hrybenko
cf2c5386a9 stdlib: change ReverseRange.isEmpty() into a property
Swift SVN r19562
2014-07-04 12:46:21 +00:00
Dmitri Hrybenko
ac7fee3a64 stdlib: add Dictionary.isEmpty property
Swift SVN r19561
2014-07-04 11:27:48 +00:00
Dmitri Hrybenko
3422201d21 stdlib/String: move lowercaseString and uppercaseString properties to
Foundation, and have them forward to Foundation.

This is slower than it could be, but at least this way we produce correct
results.

Another part of rdar://17550187


Swift SVN r19560
2014-07-04 09:27:32 +00:00
Dmitri Hrybenko
8361bccc5a stdlib: fix some 80-cols violations
Swift SVN r19559
2014-07-04 08:09:44 +00:00
Chris Lattner
7a56499d61 Start making @objc not start with an @ sign:
- Change the parser to accept "objc" without an @ sign as a contextual
   keyword, including the dance to handle the general parenthesized case.
 - Update all comments to refer to "objc" instead of "@objc".
 - Update all diagnostics accordingly.
 - Update all tests that fail due to the diagnostics change.
 - Switch the stdlib to use the new syntax.

This does not switch all tests to use the new syntax, nor does it warn about
the old syntax yet.  That will be forthcoming.  Also, this needs a bit of 
refactoring, which will be coming up.



Swift SVN r19555
2014-07-04 05:57:57 +00:00
Anna Zaks
c1537fdcdd Reject explicit uses of CFRetain/CFRelease/CFAutorelease
Ban use of CFRetain, CFRelease, CFAutorelease used for manual memory management as well as a bunch of other similar APIs, such as CGColorRelease.
Addresses radar://16892185

Swift SVN r19552
2014-07-04 02:29:05 +00:00
Jordan Rose
bdd1ec3116 Update stdlib and tests for accessibility, again.
I'll be turning on access control early next week.

Swift SVN r19551
2014-07-04 01:53:53 +00:00
Jordan Rose
cdd8532f33 Remove @private from the stdlib.
@private can't safely be used with inlineable code at this time, which
unfortunately covers the entire standard library.

Swift SVN r19550
2014-07-04 01:53:52 +00:00
Enrico Granata
314dbc6ed1 Forgot to add the most important part of the patch to the previous commit.
Swift SVN r19544
2014-07-03 23:44:21 +00:00
Enrico Granata
b0548f13cd Start using the Mirror Generator
This commit removes Mirrors for RangeGenerators, since Dave and I discussed that these won't be necessary in practice
Also, it removes the Mirrors for Range types from Range.swift.gyb, and instead adds a new RangeMirrors.swift.gyb used to generate range types Mirrors



Swift SVN r19543
2014-07-03 23:43:14 +00:00
Anna Zaks
6aadb1a647 APIs in XCTest now uses UInt, not Int.
Fixup for r19536.

Swift SVN r19538
2014-07-03 22:33:07 +00:00
Enrico Granata
d6586cb7a7 The Mirrors Generator
This is a .gyb file based upon Dave's trick of allowing boilerplate templates (r19490)
As per comments, this will generate all the common cruft of getting a Mirror up and running - yes including the Reflectable conformance on the type!

It could likely be extended to specify a full Mirror, either by defaulting missing parts, or by letting you specify them as arguments to the template
However, since we can have other templates that use this as a foundation, those expansions might be best served being their own templates based upon this

Also, the members this doesn't generate for you are usually the ones you care about when writing a Mirror, so probably passing them as arguments to this template generator would only make things look uglier/less obvious when skimming through the code



Swift SVN r19534
2014-07-03 21:46:13 +00:00
Dave Abrahams
8db106ea17 [stdlib] Optimize Array member sort
Have it use withUnsafeMutableStorage just like the overloaded free
algorithm does.

Swift SVN r19533
2014-07-03 21:45:50 +00:00
Dave Abrahams
1f68ff48cc [stdlib] Detect/fix potential memory-safety issue
When a user violates the inout rules by "re-entering" an array that is
currently undergoing mutation, it must not admit a memory-safety
violation.  To ensure that it doesn't, temporarily make the buffer being
operated on inaccessible through the original array.

Swift SVN r19532
2014-07-03 21:44:49 +00:00
Dmitri Hrybenko
0c205b3e5e stdlib/OutputStream: fix println() comments
Swift SVN r19525
2014-07-03 19:57:51 +00:00
Doug Gregor
0598b6db5e Casting runtime: Use the runtime's constant for reserved bits in an ObjC pointer.
Previously, we had a predicate that only worked properly for 64-bit
architectures; the 32-bit platforms don't have tagged pointers, and
have an annoying tendency to allocate objects with the high bit of the
address set. Fixes <rdar://problem/17544277>.

Swift SVN r19523
2014-07-03 17:55:38 +00:00
Jordan Rose
8080ca6820 [Accessibility] Public functions/initializers may not use private types.
Also, don't diagnose accessibility violations on implicit decls. Every now
and then the compiler needs to bend the rules, such as when providing an ==
implementation for a local enum.

Swift SVN r19519
2014-07-03 17:45:36 +00:00
Dave Abrahams
6dde77adca [stdlib] Delete Range.swift
This was a part of r19497 that I failed to commit.

Swift SVN r19517
2014-07-03 17:15:21 +00:00
Dmitri Hrybenko
c2ae63ba72 stdlib/UnicodeScalar: hide APIs that don't work with non-ASCII correctly
rdar://17550187


Swift SVN r19513
2014-07-03 14:47:35 +00:00
Dmitri Hrybenko
7802479519 stdlib: don't use '\returns' in comments
Swift SVN r19512
2014-07-03 14:25:46 +00:00
Doug Gregor
37d69a4207 Allocator: round the size of an allocation up to the alignment on all allocation and deallocation paths.
We were rounding the size up to the alignment when allocating a new object (swift_allocObject) but not when directly allocating memory for a non-object (swift_slowAlloc). The deallocation code wasn’t rounding the size up to the alignment at all. Overall, this meant that we would get the wrong index into the allocation cache when deallocating an object whose size got rounded in a way that affects the index.

Fixes <rdar://problem/17542859>, where println(5) would fail on the 32-bit iOS simulator when building the runtime without NDEBUG (so we get extra checking) and the standard library is built without optimization (which keeps a certain 33-byte allocation on the heap). The Interpreter/SDK/objc_cast.swift test triggers this when built under those conditions.

Swift SVN r19499
2014-07-03 02:11:50 +00:00
Dave Abrahams
312c55a308 [stdlib] Range WIP 1: create RandomAccessRange
Using ..< and ... on RandomAccessIndex endpoints now produces a distinct
RandomAccessRange type that can have zero-based indexing, validation at
creation, efficient strides (the other Range should probably lose its
stride capability), and all kinds of other goodness.  This is the first
step in solving our cluster of outstanding Range-related issues.

Swift SVN r19497
2014-07-03 00:59:48 +00:00
Chris Hanson
d459ee4a3d Since all NSObject subclasses are Equatable, we can just use XCTAssertEqual/XCTAssertNotEqual.
Addresses <rdar://problem/17257148>

Swift SVN r19496
2014-07-03 00:31:08 +00:00
Jordan Rose
1769dd9a0b Mark some more things public...and mark ArrayType internal again!
Swift SVN r19492
2014-07-02 23:54:48 +00:00
Doug Gregor
2618061168 Eliminate a pointless and wrong initialization from swift_bridgeNonVerbatimFromObjectiveCConditional.
Fixes part of <rdar://problem/17411843>.

Swift SVN r19485
2014-07-02 22:15:47 +00:00
Joe Groff
1a332dbc80 Remove the UIKit overlay for UIApplicationMain.
UIApplicationMain now naturally gets imported with the correct argv type.

Swift SVN r19481
2014-07-02 20:53:10 +00:00
Joe Groff
c34b4f6a9e Enable string-to-pointer conversions and remove CString.
There is some follow-up work remaining:

- test/stdlib/UnicodeTrie test kills the type checker without manual type annotations. <rdar://problem/17539704>
- test/Sema/availability test raises a type error on 'a: String == nil', which we want, but probably not as a side effect of string-to-pointer conversions. I'll fix this next.

Swift SVN r19477
2014-07-02 19:15:10 +00:00
Enrico Granata
1625193055 ..and also fix a few that the script didn't seem to find
Swift SVN r19474
2014-07-02 18:44:34 +00:00
Enrico Granata
cfe3087278 Per DaveA's script, Remove spurious TABs I introduced
Swift SVN r19473
2014-07-02 18:36:01 +00:00
Dmitri Hrybenko
f3c7bdc273 stdlib/NSString APIs on String: change substringFromIndex() and
substringToIndex() to accept String.Index instead of Int

rdar://17306557


Swift SVN r19467
2014-07-02 15:58:59 +00:00
Dmitri Hrybenko
57df21cefe stdlib/comments: UTF-8 and UTF-16 are spelled with a dash
Swift SVN r19466
2014-07-02 15:45:38 +00:00
Dmitri Hrybenko
7e4c6782ee stdlib/String: rename String.utf16count -> .utf16Count to follow naming
conventions

rdar://17016806


Swift SVN r19463
2014-07-02 15:03:02 +00:00
Dmitri Hrybenko
36cbfe3c8f stdlib: fix grammar mistake in API name (introduced by me), and use a better
name suggested by Dave

enum UTFDecodeResult -> enum UnicodeDecodingResult


Swift SVN r19462
2014-07-02 14:58:31 +00:00
Dmitri Hrybenko
f7e926e5b0 stdlib/Arrays: refer to the parameter correctly.
Swift SVN r19460
2014-07-02 14:32:50 +00:00
Dmitri Hrybenko
db4fbb4f33 stdlib/Array: use monospaced text in a comment
Swift SVN r19459
2014-07-02 14:15:38 +00:00
Dmitri Hrybenko
b304e651c8 stdlib/HeapBuffer: add a message to a runtime trap
Swift SVN r19458
2014-07-02 14:14:55 +00:00
Dmitri Hrybenko
313cfcaaa7 Unicode trie generator: add tests for the generator itself that use non-default
trie parameters and fix a few bugs

The bugs did not affect correctness of the particular instance of trie created
for grapheme cluster property, because trie parameters that were confused with
each other happened to be equal.

Also, fix a trie size bug: we were creating a trie large enough to store
information for 0x200000 code points, but there are only 0x10ffff.  It saved
only 15 bytes in the grapheme cluster tree, because that extra information was
compressed with some supplementary planes that also had default values.  This
also improved trie generation time by almost 2x.


Swift SVN r19457
2014-07-02 10:29:52 +00:00
Dmitri Hrybenko
d8ed7b6a7c stdlib: convert tabs to spaces
Swift SVN r19456
2014-07-02 09:08:48 +00:00
Andrew Trick
8122715df7 Teach the ColdBlocks SIL analysis to recognize the branch hint semantic model.
We're temporarily using @semantics until we have mandatory inlining of branch hints.

We now have @noinline, which helps a lot, but:
- @noinline and "cold/slow" are not the same thing.

- Some functions may need to be inlined into hot paths, but that
  doesn't mean we should also inline them into cold paths.

- It is easier to find cold blocks than to look for blocks that
  contain calls to @noinline functions. And that doesn't necessarilly
  mean the blocks are cold anyway.

Swift SVN r19455
2014-07-02 06:35:09 +00:00
Manman Ren
2b2330bf5b [attribute] rename @noinline to @inline(never).
Add support for parsing inline(never), it can be easily expanded to
handle inline(always).

rdar://17527111


Swift SVN r19447
2014-07-02 01:27:05 +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