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:_:)")
246
246
SwiftInt BridgedASTContext_langOptsGetCompilerVersion(BridgedASTContext cContext,
247
247
SwiftInt* _Nullable * _Nonnull cComponents);
248
248
249
+ /* Deallocate an array of Swift int values that was allocated in C++. */
250
+ void deallocateIntBuffer (SwiftInt * _Nullable cComponents);
251
+
249
252
enum ENUM_EXTENSIBILITY_ATTR (closed) BridgedCanImportVersion : size_t {
250
253
CanImportUnversioned,
251
254
CanImportVersion,
Original file line number Diff line number Diff line change @@ -195,6 +195,10 @@ namespace {
195
195
}
196
196
}
197
197
198
+ void deallocateIntBuffer (SwiftInt * _Nullable cComponents) {
199
+ free (cComponents);
200
+ }
201
+
198
202
SwiftInt BridgedASTContext_langOptsGetLanguageVersion (BridgedASTContext cContext,
199
203
SwiftInt** cComponents) {
200
204
auto theVersion = cContext.unbridged ().LangOpts .EffectiveLanguageVersion ;
Original file line number Diff line number Diff line change @@ -123,7 +123,7 @@ final class CompilerBuildConfiguration: BuildConfiguration {
123
123
var bitWidthsBuf : UnsafeMutablePointer < SwiftInt > ? = nil
124
124
let count = ctx. langOptsGetTargetAtomicBitWidths ( & bitWidthsBuf)
125
125
let bitWidths = Array ( UnsafeMutableBufferPointer ( start: bitWidthsBuf, count: count) )
126
- bitWidthsBuf ? . deallocate ( )
126
+ deallocateIntBuffer ( bitWidthsBuf ) ;
127
127
return bitWidths
128
128
}
129
129
@@ -140,7 +140,7 @@ final class CompilerBuildConfiguration: BuildConfiguration {
140
140
let version = VersionTuple (
141
141
components: Array ( UnsafeMutableBufferPointer ( start: componentsBuf, count: count) )
142
142
)
143
- componentsBuf ? . deallocate ( )
143
+ deallocateIntBuffer ( componentsBuf ) ;
144
144
return version
145
145
}
146
146
@@ -150,7 +150,7 @@ final class CompilerBuildConfiguration: BuildConfiguration {
150
150
let version = VersionTuple (
151
151
components: Array ( UnsafeMutableBufferPointer ( start: componentsBuf, count: count) )
152
152
)
153
- componentsBuf ? . deallocate ( )
153
+ deallocateIntBuffer ( componentsBuf ) ;
154
154
return version
155
155
}
156
156
}
You can’t perform that action at this time.
0 commit comments