File tree Expand file tree Collapse file tree 2 files changed +6
-0
lines changed Expand file tree Collapse file tree 2 files changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -148,6 +148,10 @@ private struct BitstreamReader {
148
148
}
149
149
}
150
150
151
+ /// Computes a non-owning view of a `BitcodeElement.Record` that is valid for
152
+ /// the lifetime of the call to `body`.
153
+ ///
154
+ /// - Warning: If this function throws, the `body` block will not be called.
151
155
mutating func withAbbreviatedRecord(
152
156
_ abbrev: Bitstream . Abbreviation ,
153
157
body: ( BitcodeElement . Record ) throws -> Void
Original file line number Diff line number Diff line change @@ -338,6 +338,7 @@ extension BitstreamWriter {
338
338
339
339
fileprivate init ( ) {
340
340
self . values = [ ]
341
+ self . values. reserveCapacity ( 8 )
341
342
}
342
343
343
344
fileprivate init < CodeType> ( recordID: CodeType )
@@ -367,6 +368,7 @@ extension BitstreamWriter {
367
368
}
368
369
369
370
public mutating func append( _ string: String ) {
371
+ self . values. reserveCapacity ( self . values. capacity + string. utf8. count)
370
372
for byte in string. utf8 {
371
373
values. append ( UInt32 ( byte) )
372
374
}
You can’t perform that action at this time.
0 commit comments