Commit Graph

7762 Commits

Author SHA1 Message Date
Guillaume Lessard
4f4bfba61c [stdlib] use a primary associated type 2022-09-14 02:27:18 -06:00
Guillaume Lessard
2689b6044b Merge pull request #41608 from glessard/se-pointer-family-initialization 2022-09-13 22:00:59 -06:00
Guillaume Lessard
874cd336ab [stdlib] avoid work when source and destination are the same 2022-09-13 16:15:42 -06:00
Guillaume Lessard
7f4caede90 [stdlib] avoid primary associated type for the time being 2022-09-13 13:31:44 -06:00
Ben Pious
57d82317c1 Add CustomDebugDescription conformance to AnyKeyPath (#60133)
* initial

* it works

demangling mostly works

fix dots

printing works

add tests

add conformance to AnyKeyPath

implement SPI

subscripts fully work

comments

use cross platform image inspection

remove unnecessary comment

fix

fix issues

add conditional conformance

add types

try to fix the api-digester test

cr feedback: move impls behind flag, remove addChain(), switch statement, fallthrough instead of if-elses, move import

cr feedback: refactor switch statement

fix #ifdef

reindent, cr feedback: removes manual memory management

fix missing whitespace

fix typo

fix indentation issues

switch to regexes

checks should test in on all platforms

print types in subscripts

add test for empty subscript

Update test/api-digester/stability-stdlib-abi-without-asserts.test

Co-authored-by: Xiaodi Wu <13952+xwu@users.noreply.github.com>

add commas

fix failing test

fix stdlib annotation

cr feedback: remove global, refactor ifdef

cr feedback: switch back to manual memory management

switch to 5.8 macro

add new weakly linked functions to the allowlist

fix one more failing test

more cr feedback

more cr feedback

* fix invisible unicode
2022-09-13 09:23:32 -07:00
Guillaume Lessard
1152347699 [stdlib] remove primary associated type from copyBytes
- this caused an unexpected test failure, will change separately.
2022-09-12 14:18:47 -06:00
Karoy Lorentey
5d0c6e6fab Merge pull request #60973 from lorentey/fix-modify-implementations
[stdlib] _modify: Ensure cleanup is always executed
2022-09-12 11:12:39 -07:00
Guillaume Lessard
ffa7b0e78c [se-0370] add notes regarding overlapping memory regions 2022-09-08 18:23:45 -06:00
Erik Eckstein
9c1e7cac0f stdlib: fix compilation error when compiling with an old compiler
Fix wrong/missing check for `$BuiltinUnprotectedAddressOf` around the new "unprotectedAddressOf" builtins.

rdar://99713099
2022-09-08 23:05:17 +02:00
Erik Eckstein
5eff9066cc stdlib: use _withUnprotected... functions instead of Builtin.unprotectedAddressOf 2022-09-08 08:42:25 +02:00
Erik Eckstein
0f8dd3a551 stdlib: opt out of stack protection in places where there can't be buffer overflows.
We trust the internal implementation of the stdlib to not cause any unintentional buffer overflows.
In such cases we can use the "unprotected" address-to-pointer conversions.
This avoids inserting stack protections where it's not needed.
2022-09-08 08:42:25 +02:00
Erik Eckstein
ba135dc493 stdlib: add underscored "withUnprotected..Pointer" functions
Those functions work the same way as their "unprotected" counterparts, except that they don't trigger stack protection for the pointers.

* `_withUnprotectedUnsafeMutablePointer`
* `_withUnprotectedUnsafePointer`
* `_withUnprotectedUnsafeBytes` (two times)
2022-09-08 08:42:25 +02:00
Guillaume Lessard
559e5ed54b [stdlib] use the internal precondition calls 2022-09-07 16:47:08 -06:00
Guillaume Lessard
d9a448860b [se-0370] use primary associated type 2022-09-07 15:24:41 -06:00
Guillaume Lessard
44a349f8e0 [se-0370] edit doc-comments for consistency 2022-09-07 15:22:49 -06:00
Guillaume Lessard
88225a2584 [se-0370] some consistency tweaks 2022-09-07 10:07:10 -06:00
Guillaume Lessard
6512840469 [stdlib] update copyBytes with primary associated type 2022-09-07 10:07:04 -06:00
Karoy Lorentey
7cbadf2c8d [stdlib] _modify: Ensure cleanup is always executed
Cleanup code in _modify accessors will only run reliably if it is put in a defer statement.

(Statements that follow the `yield` aren’t executed if the yielded-to code throws an error.)
2022-09-06 21:15:58 -07:00
Karoy Lorentey
486dc27e1d Merge pull request #60917 from lorentey/no-conversions-please
[stdlib] Don’t do full integer conversions in _roundUp
2022-09-04 16:44:56 -07:00
Alex Martini
33deabab88 Merge pull request #60788 from amartini51/significand_exponent_56184186
Make pseudocode look less like real code.
2022-09-02 11:56:28 -07:00
Karoy Lorentey
6eddc2ed42 [stdlib] Don’t do full integer conversions in _roundUp
This code is exercised on pretty much every access to ManagedBuffer — let’s keep it as simple as possible.

The overflow case is not expected to ever occur here; this code is used to align offsets within objects, it isn’t expected to get inputs anywhere near Int.max.
2022-09-01 15:25:39 -07:00
Guillaume Lessard
805da6d8ad [stdlib] improve note about subscripts and initialization 2022-08-31 17:24:23 -06:00
Guillaume Lessard
1f4ed8d976 Update stdlib/public/core/UnsafePointer.swift
Co-authored-by: Ben Rimmington <me@benrimmington.com>
2022-08-31 14:19:26 -06:00
Guillaume Lessard
99505d0819 [stdlib] simplify update(from:)
- one fewer variable, one fewer return point
- thanks @benrimmington
2022-08-31 11:49:06 -06:00
Guillaume Lessard
aabf2e2843 Update stdlib/public/core/UnsafeBufferPointer.swift.gyb
Co-authored-by: YR Chen <stevapple@icloud.com>
2022-08-31 10:50:25 -06:00
Guillaume Lessard
285984e3ae [stdlib] simplify update(fromContentsOf:)
- one fewer variable, one fewer return point
2022-08-31 10:46:36 -06:00
Guillaume Lessard
d24b749ac2 [se-0370] improve silgen names for renamed symbols 2022-08-30 18:44:03 -06:00
Guillaume Lessard
c2c432c9d2 [se-0370] re-implement in accordance with updated proposal 2022-08-30 11:05:41 -06:00
Guillaume Lessard
f5ffe09c53 [se-0370] fix editing errors 2022-08-26 17:36:40 -06:00
Guillaume Lessard
0a78756bf4 [se-0370] add element labels to a returned tuple
- this is technically source-breaking,
  but the risk seems to be very low.
2022-08-26 17:36:40 -06:00
Guillaume Lessard
26e5c43aa3 [se-0370] update documentation to track proposal
for the functions involving `fromContentsOf:`.
2022-08-26 17:36:40 -06:00
Guillaume Lessard
d63747f13d [stdlib] remove the single-element update functions
- as per an update to the proposal
2022-08-26 17:36:40 -06:00
Guillaume Lessard
254a8d4af5 [stdlib] fix inconsistency with storeBytes on slices 2022-08-26 17:36:40 -06:00
Guillaume Lessard
6550fb109c [stdlib] add loading and storing to and from raw buffer slices 2022-08-26 17:36:40 -06:00
Guillaume Lessard
c78cc93977 [gardening] typo fix 2022-08-26 17:36:40 -06:00
Guillaume Lessard
9cbc9eb000 [stlib] remove Slice<UMRBP>.copyMemory 2022-08-26 17:36:40 -06:00
Guillaume Lessard
75f64e731f [stdlib] implement slice operations without protocols 2022-08-26 17:36:40 -06:00
Guillaume Lessard
359e69d67e [stdlib] make more additions non-abi 2022-08-26 17:36:40 -06:00
Guillaume Lessard
00aaa07daf [stdlib] improve doc-comments 2022-08-26 17:36:40 -06:00
Guillaume Lessard
831a87fd36 [stdlib] make additions non-abi 2022-08-26 17:36:40 -06:00
Guillaume Lessard
fcd10c3efc [stdlib] partial buffer initialization (better buffer slices) 2022-08-26 17:36:40 -06:00
Guillaume Lessard
cc16a9f997 [stdlib] assign → update 2022-08-26 17:36:40 -06:00
Guillaume Lessard
2e3b5e6655 [stdlib] more memory initialization functions for UMRBP 2022-08-26 17:36:40 -06:00
Guillaume Lessard
bef793dd45 [stdlib] add single-element version of initializeMemory to UMRP 2022-08-26 17:36:40 -06:00
Guillaume Lessard
cff3012b37 [stdlib] additions to UMBP
- add initialization from a Collection
- assign to a UMBP from a Sequence or a Collection
- add `moveInitialize` and `moveAssign` to UMBP
- deinitialize UMBP
- add single-element memory state functions in a buffer
2022-08-26 17:36:40 -06:00
Guillaume Lessard
94d53871af [gardening] remove outdated recommendation 2022-08-26 17:36:39 -06:00
Guillaume Lessard
99d957fa1e [gardening] improve summary line 2022-08-26 17:36:39 -06:00
Guillaume Lessard
a7326d0353 [gardening] improve doc-comments in UnsafeMutablePointer 2022-08-26 17:36:39 -06:00
Guillaume Lessard
304a422c3e [stdlib] add single-element assign to UnsafeMutablePointer 2022-08-26 17:36:39 -06:00
Alejandro Alonso
284f8d4fdd Fix Substring.removeSubrange for entire substring (#60744)
fix start and end

fix test
2022-08-25 16:08:33 -07:00