File tree Expand file tree Collapse file tree 3 files changed +10
-3
lines changed Expand file tree Collapse file tree 3 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -246,6 +246,9 @@ SWIFT_NAME("BridgedASTContext.langOptsGetCompilerVersion(self:_:)")
246246SwiftInt BridgedASTContext_langOptsGetCompilerVersion(BridgedASTContext cContext,
247247 SwiftInt* _Nullable * _Nonnull cComponents);
248248
249+ /* Deallocate an array of Swift int values that was allocated in C++. */
250+ void deallocateIntBuffer (SwiftInt * _Nullable cComponents);
251+
249252enum ENUM_EXTENSIBILITY_ATTR (closed) BridgedCanImportVersion : size_t {
250253 CanImportUnversioned,
251254 CanImportVersion,
Original file line number Diff line number Diff line change @@ -195,6 +195,10 @@ namespace {
195195 }
196196}
197197
198+ void deallocateIntBuffer (SwiftInt * _Nullable cComponents) {
199+ free (cComponents);
200+ }
201+
198202SwiftInt BridgedASTContext_langOptsGetLanguageVersion (BridgedASTContext cContext,
199203 SwiftInt** cComponents) {
200204 auto theVersion = cContext.unbridged ().LangOpts .EffectiveLanguageVersion ;
Original file line number Diff line number Diff line change @@ -123,7 +123,7 @@ final class CompilerBuildConfiguration: BuildConfiguration {
123123 var bitWidthsBuf : UnsafeMutablePointer < SwiftInt > ? = nil
124124 let count = ctx. langOptsGetTargetAtomicBitWidths ( & bitWidthsBuf)
125125 let bitWidths = Array ( UnsafeMutableBufferPointer ( start: bitWidthsBuf, count: count) )
126- bitWidthsBuf ? . deallocate ( )
126+ deallocateIntBuffer ( bitWidthsBuf ) ;
127127 return bitWidths
128128 }
129129
@@ -140,7 +140,7 @@ final class CompilerBuildConfiguration: BuildConfiguration {
140140 let version = VersionTuple (
141141 components: Array ( UnsafeMutableBufferPointer ( start: componentsBuf, count: count) )
142142 )
143- componentsBuf ? . deallocate ( )
143+ deallocateIntBuffer ( componentsBuf ) ;
144144 return version
145145 }
146146
@@ -150,7 +150,7 @@ final class CompilerBuildConfiguration: BuildConfiguration {
150150 let version = VersionTuple (
151151 components: Array ( UnsafeMutableBufferPointer ( start: componentsBuf, count: count) )
152152 )
153- componentsBuf ? . deallocate ( )
153+ deallocateIntBuffer ( componentsBuf ) ;
154154 return version
155155 }
156156}
You can’t perform that action at this time.
0 commit comments