Skip to content

Commit 2d4f8a9

Browse files
lorenteymilseman
authored andcommitted
Remove _StringBuffer πŸŽ‰πŸŽ‰πŸŽ‰
1 parent 9c69d11 commit 2d4f8a9

File tree

9 files changed

+78
-294
lines changed

9 files changed

+78
-294
lines changed

β€Žstdlib/public/core/Builtin.swift

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -579,14 +579,6 @@ extension ManagedBufferPointer {
579579
self._nativeBuffer = buffer
580580
}
581581
}
582-
extension _StringBuffer {
583-
@_inlineable
584-
public // FIXME: String Guts
585-
var _nativeObject: _BuiltinNativeObject {
586-
@inline(__always)
587-
get { return _storage._nativeBuffer }
588-
}
589-
}
590582

591583
/// Create a `BridgeObject` around the given `nativeObject` with the
592584
/// given spare bits.

β€Žstdlib/public/core/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ set(SWIFTLIB_ESSENTIAL
123123
StringHashable.swift # ORDER DEPENDENCY: Must precede String.swift
124124
String.swift
125125
StringBridge.swift
126-
StringBuffer.swift
127126
StringComparable.swift
128127
StringGuts.swift
129128
StringObject.swift

β€Žstdlib/public/core/CString.swift

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -195,11 +195,14 @@ internal func _decodeCString<Encoding : _UnicodeEncoding>(
195195
-> (result: String, repairsMade: Bool)? {
196196

197197
let buffer = UnsafeBufferPointer<Encoding.CodeUnit>(
198-
start: cString, count: length)
198+
start: cString,
199+
count: length)
199200

200-
let (stringBuffer, hadError) = _StringBuffer.fromCodeUnits(
201-
buffer, encoding: encoding, repairIllFormedSequences: isRepairing)
202-
return stringBuffer.map {
203-
(result: String(_storage: $0), repairsMade: hadError)
201+
let (guts, hadError) = _StringGuts.fromCodeUnits(
202+
buffer,
203+
encoding: encoding,
204+
repairIllFormedSequences: isRepairing)
205+
return guts.map {
206+
(result: String($0), repairsMade: hadError)
204207
}
205208
}

β€Žstdlib/public/core/GroupInfo.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
"StaticString.swift",
1313
"String.swift",
1414
"StringBridge.swift",
15-
"StringBuffer.swift",
1615
"StringCharacterView.swift",
1716
"StringComparable.swift",
1817
"StringObject.swift",

β€Žstdlib/public/core/String.swift

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,28 +1042,6 @@ extension String {
10421042
Builtin.unreachable()
10431043
}
10441044

1045-
@_inlineable // FIXME(sil-serialize-all)
1046-
public // SPI(Foundation)
1047-
init(_storage: _StringBuffer) { // FIXME: Replace with _SwiftStringStorage
1048-
if _storage.elementWidth == 1 {
1049-
let native = _SwiftStringStorage<UInt8>.create(
1050-
capacity: _storage.capacity,
1051-
count: _storage.usedCount)
1052-
native.start.initialize(
1053-
from: _storage.start.assumingMemoryBound(to: UInt8.self),
1054-
count: _storage.usedCount)
1055-
_guts = _StringGuts(native)
1056-
} else {
1057-
let native = _SwiftStringStorage<UInt16>.create(
1058-
capacity: _storage.capacity,
1059-
count: _storage.usedCount)
1060-
native.start.initialize(
1061-
from: _storage.start.assumingMemoryBound(to: UInt16.self),
1062-
count: _storage.usedCount)
1063-
_guts = _StringGuts(native)
1064-
}
1065-
}
1066-
10671045
@_inlineable // FIXME(sil-serialize-all)
10681046
public
10691047
init<CodeUnit>(_storage: _SwiftStringStorage<CodeUnit>)
@@ -1275,7 +1253,7 @@ internal func _nativeUnicodeUppercaseString(_ str: String) -> String {
12751253
dest, Int32(utf16.count), // FIXME: handle overflow case
12761254
utf16.start, Int32(utf16.count))
12771255
}
1278-
return String(_storage: buffer)
1256+
return String(_storage: storage)
12791257
}
12801258
#endif
12811259

β€Žstdlib/public/core/StringBridge.swift

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -48,29 +48,6 @@ func _stdlib_binary_CFStringGetCharactersPtr(
4848
/// Loading Foundation initializes these function variables
4949
/// with useful values
5050

51-
/// Produces a `_StringBuffer` from a given subrange of a source
52-
/// `_CocoaString`, having the given minimum capacity.
53-
@_versioned // FIXME(sil-serialize-all)
54-
@inline(never) // Hide the CF dependency
55-
internal func _cocoaStringToContiguous(
56-
source: _CocoaString, range: Range<Int>, minimumCapacity: Int
57-
) -> _StringBuffer {
58-
_sanityCheck(_swift_stdlib_CFStringGetCharactersPtr(source) == nil,
59-
"Known contiguously stored strings should already be converted to Swift")
60-
61-
let startIndex = range.lowerBound
62-
let count = range.upperBound - startIndex
63-
64-
let buffer = _StringBuffer(capacity: max(count, minimumCapacity),
65-
initialSize: count, elementWidth: 2)
66-
67-
_swift_stdlib_CFStringGetCharacters(
68-
source, _swift_shims_CFRange(location: startIndex, length: count),
69-
buffer.start.assumingMemoryBound(to: _swift_shims_UniChar.self))
70-
71-
return buffer
72-
}
73-
7451
/// Copies the entire contents of a _CocoaString into contiguous
7552
/// storage of sufficient capacity.
7653
@_versioned // FIXME(sil-serialize-all)

β€Žstdlib/public/core/StringBuffer.swift

Lines changed: 0 additions & 232 deletions
This file was deleted.

0 commit comments

Comments
Β (0)