Commit Graph

6693 Commits

Author SHA1 Message Date
Karoy Lorentey
ed7d60c711 [stdlib] Remove unused fn 2022-04-11 14:03:01 -07:00
Alex Martini
0089134307 Apply suggestions from tech review
Co-authored-by: Doug Gregor <dgregor@apple.com>
2022-04-11 11:01:40 -07:00
Karoy Lorentey
dcfc26cbc5 [stdlib][NFC] Doc adjustments 2022-04-10 16:57:44 -07:00
Karoy Lorentey
d3df05cb30 [stdlib] String.Index: Remove custom printing 2022-04-10 16:51:51 -07:00
Karoy Lorentey
bbb004854e [stdlib] Minor enhancements 2022-04-10 16:49:01 -07:00
Alejandro Alonso
5fe6a7e247 Add caseFolded to scalar properties 2022-04-10 13:03:13 -07:00
Karoy Lorentey
67adcabefc Apply notes from code review 2022-04-10 00:14:43 -07:00
Karoy Lorentey
58ab3fea34 Apply suggestions from code review
Co-authored-by: Alejandro Alonso <alejandro_alonso@apple.com>
2022-04-10 00:14:43 -07:00
Karoy Lorentey
3c9968945e [stdlib] String: Implement happy paths for index validation 2022-04-10 00:14:43 -07:00
Karoy Lorentey
d18b5f573f [stdlib] Branchless _StringGuts.hasMatchingEncoding 2022-04-09 21:33:53 -07:00
Karoy Lorentey
eadef7a204 [stdlib] String.Index: Use symbolic names rather than magic constants 2022-04-09 21:33:53 -07:00
Karoy Lorentey
b06e6e5dd3 [stdlib] String: Fix major perf regression due to extra arc traffic 2022-04-09 21:33:53 -07:00
Karoy Lorentey
d24ae9dfcd [stdlib] Remove Substring._endIsCharacterAligned
Now that the cached character stride in indices always mean the
stride in the full string, we can stop looking at whether a substring
has a character-aligned end index.
2022-04-09 21:33:53 -07:00
Karoy Lorentey
83df814c63 [stdlib] _StringObject.isKnownUTF16 → isForeignUTF8
This fixes a compatibility issue with potential future UTF-8 encoded
foreign String forms, as well as simplifying the code a bit — we no
longer need to do an availability check on inlinable fast paths.

The isForeignUTF8 bit is never set by any past or current stdlib
version, but it allows us to introduce UTF-8 encoded foreign forms
without breaking inlinable index encoding validation introduced in
Swift 5.7.
2022-04-09 21:33:53 -07:00
swift_jenkins
6fd51f61af Merge remote-tracking branch 'origin/main' into next 2022-04-07 21:21:11 -07:00
Alejandro Alonso
ef2c999c7a Merge pull request #42227 from Azoy/add-script-data
[stdlib] Add Unicode script data to scalar properties
2022-04-07 21:04:00 -07:00
Alejandro Alonso
1a3f791779 Underscore the script APIs
forgot underscore part 2

add build rules back in for right now

indents
2022-04-07 16:20:10 -07:00
swift_jenkins
bb35e7a7d5 Merge remote-tracking branch 'origin/main' into next 2022-04-06 21:21:20 -07:00
Guillaume Lessard
d2970cddd2 Merge pull request #42226 from glessard/rdar91343475
[stdlib] remove most uses of _asCChar and _asUInt8
2022-04-06 22:19:17 -06:00
Guillaume Lessard
152353157c [stdlib] less assumingMemoryBound, rebind instead 2022-04-06 16:18:02 -06:00
Guillaume Lessard
8379b2422a [stdlib] remove most uses of _asCChar and _asUInt8 2022-04-06 15:21:00 -06:00
Alejandro Alonso
79bf63505b Add Unicode script data to scalar properties 2022-04-06 13:37:04 -07:00
swift_jenkins
510dc8e1ff Merge remote-tracking branch 'origin/main' into next 2022-04-06 10:01:09 -07:00
Guillaume Lessard
e9be0a2915 Merge pull request #42002 from glessard/rdar90336023
[stdlib] prevent preventable buffer overflows when constructing Strings from C strings.
2022-04-06 10:50:11 -06:00
Karoy Lorentey
73312fedd4 [stdlib] Grapheme breaking: Refactor to simplify logic
- Split forward and backward direction into separate code paths.
  This makes the code more readable and paves the way for future
  improvements. (E.g., switching to a linear-time algorithm for
  breaking backwards.)
- `Substring.index(after:)` now uses the same grapheme breaking paths
  as `String.index(after:)`.
- The cached stride value in string indices is now well-defined even
  on indices that aren’t character-aligned.
2022-04-05 20:47:42 -07:00
Karoy Lorentey
4247279889 [stdlib] String.UnicodeScalarView: Optimize replaceSubrange 2022-04-05 20:47:42 -07:00
Karoy Lorentey
e0bd5f7a79 [stdlib] Fix Substring.UnicodeScalarView.replaceSubrange 2022-04-05 20:47:42 -07:00
Karoy Lorentey
2e9fd9eb6b [stdlib] Substring.UnicodeScalarView: Add _invariantCheck 2022-04-05 20:47:42 -07:00
Karoy Lorentey
f7c674ed55 [stdlib] Slice._bounds, Range<String.Index>._encodedOffsetRange: New helpers 2022-04-05 20:47:42 -07:00
Guillaume Lessard
b13377726f [stdlib] improve the new deprecation messages 2022-04-05 14:43:03 -06:00
swift_jenkins
7a42d74736 Merge remote-tracking branch 'origin/main' into next 2022-04-05 13:20:19 -07:00
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