Commit Graph

7762 Commits

Author SHA1 Message Date
Alejandro Alonso
d78d1eb0ac Merge pull request #42124 from Azoy/spi-unicode
[stdlib] Mark NFD and NFC as SPI
2022-04-05 12:50:41 -07:00
Alejandro Alonso
c9115e1cec Create wrapper types with availability NFD and NFC
Swap the bases to unicodeScalarView
2022-04-05 09:06:32 -07:00
Guillaume Lessard
cfdb44ee7e [test] check deprecation warnings for undesirable overloads 2022-04-04 20:26:40 -06:00
Guillaume Lessard
ec7a725833 [stdlib] overload String-from-C-string initializers in the case of inout conversion 2022-04-04 17:53:54 -06:00
Guillaume Lessard
f49ea0d7d5 [stdlib] String overloads for String-from-C-string inits 2022-04-04 17:44:31 -06:00
Guillaume Lessard
22121d585d [stdlib] overload for arrays passed to String(decodeCString:as:) 2022-04-04 17:44:31 -06:00
swift_jenkins
a196130589 Merge remote-tracking branch 'origin/main' into next 2022-04-04 16:20:34 -07:00
Slava Pestov
674a2aaf77 Merge pull request #42168 from slavapestov/stdlib-redundant-requirements
stdlib: Remove some redundant generic requirements
2022-04-04 19:01:21 -04:00
swift_jenkins
c1374f6f8f Merge remote-tracking branch 'origin/main' into next 2022-04-04 13:20:30 -07:00
Michael Gottesman
5c8bd3266e Merge pull request #40779 from buttaface/android-tag
[android] Move the string and other tags in pointers to the second byte because Android enabled memory tagging
2022-04-04 13:06:43 -07:00
Slava Pestov
2716874f01 stdlib: Remove some redundant generic requirements 2022-04-04 15:52:05 -04:00
Alejandro Alonso
5e5e183ef8 Mark NFD and NFC as SPI
underscore Unicode SPI
2022-04-04 11:38:09 -07:00
Yuta Saito
ed7ab2a5a3 [Wasm][KeyPath] Resolve absolute function pointer as identity
Emit and resolve idValue of KeyPath as an absolute pointer if relative
function pointer is turned-off on Wasm target.
The existing ABI can't distinguish an idValue between function pointer
or data pointer in use-site at compile-time and also at runtime. So this
patch adds a new id resolution scheme `ResolvedAbsolute` to distinguish
them at runtime properly.
2022-04-02 16:25:23 +00:00
swift_jenkins
b1e0d1088c Merge remote-tracking branch 'origin/main' into next 2022-04-02 04:20:19 -07:00
Yuta Saito
f492250b84 Merge pull request #42095 from kateinoigakukun/pr-26594e2245d681b594f6e1b190c8107a1c6dbb1d
[Wasm][Runtime] Interpret absolute function pointer in runtime structures
2022-04-02 20:04:23 +09:00
Yuta Saito
8c598e98f7 [Wasm][Runtime] Interpret absolute function pointer in runtime structures
When SWIFT_COMPACT_ABSOLUTE_FUNCTION_POINTER is enabled, relative direct
pointers whose pointees are functions will be turned into absolute
pointer at compile-time.
2022-04-02 04:32:41 +00:00
Butta
7b2256f97b [android] Move the string and other tags in pointers to the second byte because Android enabled memory tagging
Starting with Android 11, AArch64 placed a tag in the top byte of pointers to
allocations, which has been slowly rolling out to more devices and collides
with Swift's tags. Moving these tags to the second byte works around this
problem.
2022-04-02 08:50:54 +05:30
Guillaume Lessard
a6474f657b [stdlib] overload for arrays passed to String.init?(validatingUTF8:) 2022-04-01 12:10:16 -06:00
Guillaume Lessard
5dffce5017 [stdlib] overload for arrays passed to String.init(cString:) 2022-04-01 12:10:16 -06:00
Guillaume Lessard
516cdcfe0f [stdlib] harmonize parameter labels with StringProtocol 2022-04-01 12:10:16 -06:00
swift_jenkins
b343f0c286 Merge remote-tracking branch 'origin/main' into next 2022-04-01 08:40:43 -07:00
Alastair Houghton
b3b080e12d Merge pull request #42109 from al45tair/eng/PR-91095592
[Demangling] Fix duplicate _gCRAnnotations symbol problems.
2022-04-01 16:37:05 +01:00
Alex Martini
6c443e5d45 Match code listing markup used elsewhere. 2022-03-31 16:05:51 -07:00
Alex Martini
34306bc933 Introduce an example explicitly. 2022-03-31 16:05:19 -07:00
Alex Martini
ec74b18b25 Add reference page for Sendable protocol. 2022-03-31 16:01:09 -07:00
Alastair Houghton
3f49b8be32 [Demangling] Fix duplicate _gCRAnnotations symbol problems.
Moved the _gCRAnnotations declarations to their own object module,
which will help to avoid duplicate symbol problems (at least with .a
files).

Also tweaked things to make it so that the demangler and runtime
versions of the message setting code will interoperate (and so that
they'll interoperate better with other implementations that might
creep in from somewhere, like the one in LLVMSupport).

rdar://91095592
2022-03-31 13:04:09 +01:00
Karoy Lorentey
ff58d54565 [stdlib][NFC] Substring adjustments 2022-03-29 20:10:40 -07:00
Karoy Lorentey
3616a05d97 [stdlib] Substring.makeContiguousUTF8: Do not lose context in base 2022-03-29 20:10:40 -07:00
Karoy Lorentey
c9adf7aaea [stdlib] Substring: Review view creation/conversion code 2022-03-29 20:10:40 -07:00
Karoy Lorentey
b7c54ac41c [stdlib] Substring.init: Stop checking things twice 2022-03-29 20:00:08 -07:00
Karoy Lorentey
b29d8f4805 [stdlib] Substring: restrict grapheme breaking to the bounds of the substring
(Oops)
2022-03-29 20:00:08 -07:00
Karoy Lorentey
9714f97ad8 [stdlib] Substring: round indices down to nearest character in indexing operations
Distances between indices aren’t well-defined without this.
2022-03-29 20:00:08 -07:00
Karoy Lorentey
755712a25d [stdlib] StringGuts.replaceSubrange: Fast path for replacing with a fast substring
If the replacement collection is a fast UTF-8 substring, we can simply
access its backing store directly — we don’t need to use a circuituous
lazy algorithm.
2022-03-29 20:00:08 -07:00
Karoy Lorentey
dc6990370e [stdlib] StringGuts.scalarAlign: Preserve encoding flags in returned index 2022-03-29 20:00:08 -07:00
Karoy Lorentey
4eab8355ca [stdlib] String: prefer passing ranges to start+end argument pairs 2022-03-29 20:00:08 -07:00
Karoy Lorentey
4aae824124 [stdlib] String: Deprecate old bounds checking methods
These weren’t doing the right thing, and all callers have now
migrated to the new `_StringGuts.validate*` methods, which combine
bounds checks with encoding validation and scalar alignment.
2022-03-29 20:00:08 -07:00
Karoy Lorentey
e8212690d1 [stdlib] String: Apply transcoded offset when converting indices from UTF-16 2022-03-29 20:00:08 -07:00
Karoy Lorentey
4ad8b26ab3 [stdlib] String.UTF16View: Review/fix index validation
Also, in UTF-16 slices, forward collection methods to the base view
instead of `Slice`, to make behavior a bit easier to understand.

(There is no need to force readers to page in `Slice`
implementations _in addition to_ whatever the base view is doing.)
2022-03-29 20:00:08 -07:00
Karoy Lorentey
5f6c300adb [stdlib] String.UTF8View: Review/fix index validation
Also, in UTF-8 slices, forward collection methods to the base view
instead of `Slice`, to make behavior a bit easier to understand.

(There is no need to force readers to page in `Slice`
implementations _in addition to_ whatever the base view is doing.)
2022-03-29 18:40:25 -07:00
Karoy Lorentey
8610bdf515 [stdlib] String.unicodeScalars: Add a _modify accessor
This will eliminate unnecessary CoW copies when calling mutating
Unicode scalar view methods directly through this property.
2022-03-29 18:40:25 -07:00
Karoy Lorentey
d58811262d [stdlib] String.UnicodeScalarView: Review index validation 2022-03-29 18:40:25 -07:00
swift_jenkins
b760e46c74 Merge remote-tracking branch 'origin/main' into next 2022-03-29 11:00:34 -07:00
Guillaume Lessard
3e739f62fc Merge pull request #42076 from glessard/se-withMemoryRebound
[stdlib] remove preconditions from compatibility entry point
2022-03-29 11:41:45 -06:00
Guillaume Lessard
ce7d8134a6 [stdlib] remove preconditions from compatibility entry point
- The old implementation of `UnsafePointer.withMemoryRebound` had no preconditions.
- When implementing SE-0333, we forwarded the old entry point to the new implementation, which has preconditions.
- This change removes the precondition from the compatibility entry point, reverting it to its previous behaviour.
- This resolves rdar://90462471
2022-03-28 18:30:11 -06:00
swift_jenkins
be50947706 Merge remote-tracking branch 'origin/main' into next 2022-03-25 03:20:42 -07:00
Alastair Houghton
eb6f9e0bba Merge pull request #41452 from al45tair/eng/PR-89139049
[Demangler] Make Node::addChild(NULL, ...) always assert.
2022-03-25 10:03:59 +00:00
Karoy Lorentey
67f01a1159 [stdlib] Stop inlining String.subscript
`index(after:)`/`index(before:)` aren’t inlinable, so I don’t expect
force-inlining the subscript has much benefit.
2022-03-24 21:00:00 -07:00
Karoy Lorentey
298899264d [stdlib] String: Add some extra invariant checks 2022-03-24 21:00:00 -07:00
Karoy Lorentey
90fee621b6 [stdlib] String.UTF16View: Mark foreign indices as UTF-16 encoded 2022-03-24 21:00:00 -07:00
Karoy Lorentey
98d5959478 [stdlib] String.Index: Adjust printing 2022-03-24 21:00:00 -07:00