File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed
Sources/SwiftDriver/SwiftScan Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -339,14 +339,15 @@ internal extension swiftscan_diagnostic_severity_t {
339
339
invocationStringArray)
340
340
}
341
341
342
- let targetInfoString : String = try compilerExecutablePath. description. withCString { cstring in
343
- let targetInfoStringRef = api. swiftscan_compiler_target_info_query_v2 ( invocation, cstring)
344
- defer { api. swiftscan_string_dispose ( targetInfoStringRef) }
345
- return try toSwiftString ( targetInfoStringRef)
342
+ return try compilerExecutablePath. description. withCString {
343
+ let info = api. swiftscan_compiler_target_info_query_v2 ( invocation, $0)
344
+ defer { api. swiftscan_string_dispose ( info) }
345
+ guard let data = info. data else {
346
+ throw DependencyScanningError . invalidStringPtr
347
+ }
348
+ return Data ( buffer: UnsafeBufferPointer ( start: data. bindMemory ( to: CChar . self, capacity: info. length) ,
349
+ count: info. length) )
346
350
}
347
-
348
- let targetInfoData = Data ( targetInfoString. utf8)
349
- return targetInfoData
350
351
}
351
352
}
352
353
You can’t perform that action at this time.
0 commit comments