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 {
148148 }
149149 }
150150
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.
151155 mutating func withAbbreviatedRecord(
152156 _ abbrev: Bitstream . Abbreviation ,
153157 body: ( BitcodeElement . Record ) throws -> Void
Original file line number Diff line number Diff line change @@ -338,6 +338,7 @@ extension BitstreamWriter {
338338
339339 fileprivate init ( ) {
340340 self . values = [ ]
341+ self . values. reserveCapacity ( 8 )
341342 }
342343
343344 fileprivate init < CodeType> ( recordID: CodeType )
@@ -367,6 +368,7 @@ extension BitstreamWriter {
367368 }
368369
369370 public mutating func append( _ string: String ) {
371+ self . values. reserveCapacity ( self . values. capacity + string. utf8. count)
370372 for byte in string. utf8 {
371373 values. append ( UInt32 ( byte) )
372374 }
You can’t perform that action at this time.
0 commit comments