mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[BridgingHeaderChaining] Bind bridging header module when load module
When loading a module with embedded bridging header, bind the bridging header module in the context when bridging header auto chaining is used. This is because all the bridging header contents are chained into a PCH file so binary module with bridging header should reference the PCH file for all declarations. rdar://148538787
This commit is contained in:
@@ -165,15 +165,18 @@ ModuleFile::loadDependenciesForFileContext(const FileUnit *file,
|
||||
if (dependency.isHeader()) {
|
||||
// The path may be empty if the file being loaded is a partial AST,
|
||||
// and the current compiler invocation is a merge-modules step.
|
||||
if (!dependency.Core.RawPath.empty() &&
|
||||
!M->getASTContext().SearchPathOpts.BridgingHeaderChaining) {
|
||||
if (!dependency.Core.RawPath.empty()) {
|
||||
// If using bridging header chaining, just bind the entire bridging
|
||||
// header pch to the module. Otherwise, import the header.
|
||||
bool hadError =
|
||||
clangImporter->importHeader(dependency.Core.RawPath,
|
||||
file->getParentModule(),
|
||||
Core->importedHeaderInfo.fileSize,
|
||||
Core->importedHeaderInfo.fileModTime,
|
||||
Core->importedHeaderInfo.contents,
|
||||
diagLoc);
|
||||
M->getASTContext().SearchPathOpts.BridgingHeaderChaining
|
||||
? clangImporter->bindBridgingHeader(file->getParentModule(),
|
||||
diagLoc)
|
||||
: clangImporter->importHeader(
|
||||
dependency.Core.RawPath, file->getParentModule(),
|
||||
Core->importedHeaderInfo.fileSize,
|
||||
Core->importedHeaderInfo.fileModTime,
|
||||
Core->importedHeaderInfo.contents, diagLoc);
|
||||
if (hadError)
|
||||
return error(Status::FailedToLoadBridgingHeader);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user