mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
stdlib: add a couple of ABI FIXMEs to String implementation
We should not make grapheme segmentation algorithm inlineable now (and possibly ever). The immediate reason is that Unicode 8.0 grapheme segmentation algorithm has been changed significantly in Unicode 9.0. Unicode 9.0 requires a stateful algorithm. Current indices and iterators just don't have the storage for that state, so we can't mark them as fragile.
This commit is contained in:
@@ -236,6 +236,9 @@ extension String.CharacterView : BidirectionalCollection {
|
||||
)
|
||||
}
|
||||
|
||||
// FIXME(ABI): don't make this function inlineable. Grapheme cluster
|
||||
// segmentation uses a completely different algorithm in Unicode 9.0.
|
||||
//
|
||||
/// Returns the length of the first extended grapheme cluster in UTF-16
|
||||
/// code units.
|
||||
@inline(never)
|
||||
@@ -276,6 +279,9 @@ extension String.CharacterView : BidirectionalCollection {
|
||||
return start._position - startIndexUTF16
|
||||
}
|
||||
|
||||
// FIXME(ABI): don't make this function inlineable. Grapheme cluster
|
||||
// segmentation uses a completely different algorithm in Unicode 9.0.
|
||||
//
|
||||
/// Returns the length of the previous extended grapheme cluster in UTF-16
|
||||
/// code units.
|
||||
@inline(never)
|
||||
|
||||
@@ -577,6 +577,8 @@ extension String.UnicodeScalarIndex {
|
||||
}
|
||||
|
||||
extension String.UnicodeScalarView {
|
||||
// FIXME(ABI): don't make this function inlineable. Grapheme cluster
|
||||
// segmentation uses a completely different algorithm in Unicode 9.0.
|
||||
internal func _isOnGraphemeClusterBoundary(_ i: Index) -> Bool {
|
||||
if i == startIndex || i == endIndex {
|
||||
return true
|
||||
|
||||
@@ -206,6 +206,9 @@ struct _UnicodeGraphemeClusterBreakPropertyTrie {
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME(ABI): don't mark this type versioned, or any of its APIs inlineable.
|
||||
// Grapheme cluster segmentation uses a completely different algorithm in
|
||||
// Unicode 9.0.
|
||||
internal struct _UnicodeExtendedGraphemeClusterSegmenter {
|
||||
let _noBoundaryRulesMatrix: UnsafePointer<UInt16>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user