Skip to content

[DependencyScanning] Make ModuleInfo.ImportInfos nil when using a toolchain which does not support querying them. #1945

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Sources/SwiftDriver/SwiftScan/DependencyGraphBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -104,19 +104,19 @@ private extension SwiftScan {
}
}

var importInfos: [ImportInfo] = []
var importInfos: [ImportInfo]? = nil
if supportsImportInfos {
let importInfoSetRefOrNull = api.swiftscan_module_info_get_imports(moduleInfoRef)
guard let importInfoSetRef = importInfoSetRefOrNull else {
throw DependencyScanningError.missingField("dependency_graph.imports")
}
let importInfoRefArray = Array(UnsafeBufferPointer(start: importInfoSetRef.pointee.imports,
count: Int(importInfoSetRef.pointee.count)))
for importInfoRefOrNull in importInfoRefArray {
importInfos = try importInfoRefArray.map { importInfoRefOrNull in
guard let importInfoRef = importInfoRefOrNull else {
throw DependencyScanningError.missingField("dependency_set_t.imports[_]")
}
importInfos.append(try constructImportInfo(from: importInfoRef))
return try constructImportInfo(from: importInfoRef)
}
}

Expand Down