mirror of
https://github.com/apple/swift.git
synced 2026-02-27 18:26:24 +01:00
[Caching][DependencyScan] Fix main module header chaining
Fix a programming mistake when chaining bridging header for the main module. Main module never has the binary module, thus it always need to chain the bridging header content directly without falling back to embedded binary module. Previously, the scanner was wrongly error out because it failed to locate the binary module for main module. rdar://167707148
This commit is contained in:
@@ -1843,8 +1843,9 @@ llvm::Error ModuleDependencyScanner::performBridgingHeaderChaining(
|
||||
auto FS = ScanASTContext.SourceMgr.getFileSystem();
|
||||
|
||||
auto chainBridgingHeader = [&](StringRef moduleName, StringRef headerPath,
|
||||
StringRef binaryModulePath) -> llvm::Error {
|
||||
if (useImportHeader) {
|
||||
StringRef binaryModulePath,
|
||||
bool useHeader) -> llvm::Error {
|
||||
if (useHeader) {
|
||||
if (auto buffer = FS->getBufferForFile(headerPath)) {
|
||||
outOS << "#include \"" << headerPath << "\"\n";
|
||||
return llvm::Error::success();
|
||||
@@ -1885,9 +1886,9 @@ llvm::Error ModuleDependencyScanner::performBridgingHeaderChaining(
|
||||
if (binaryMod->headerImport.empty())
|
||||
continue;
|
||||
|
||||
if (auto E =
|
||||
chainBridgingHeader(moduleID.ModuleName, binaryMod->headerImport,
|
||||
binaryMod->compiledModulePath))
|
||||
if (auto E = chainBridgingHeader(
|
||||
moduleID.ModuleName, binaryMod->headerImport,
|
||||
binaryMod->compiledModulePath, useImportHeader))
|
||||
return E;
|
||||
}
|
||||
}
|
||||
@@ -1917,7 +1918,8 @@ llvm::Error ModuleDependencyScanner::performBridgingHeaderChaining(
|
||||
if (mainModule->textualModuleDetails.bridgingHeaderFile) {
|
||||
if (auto E = chainBridgingHeader(
|
||||
rootModuleID.ModuleName,
|
||||
*mainModule->textualModuleDetails.bridgingHeaderFile, ""))
|
||||
*mainModule->textualModuleDetails.bridgingHeaderFile, "",
|
||||
/*useHeader=*/true))
|
||||
return E;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user