mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Caching] Embed bridging header in binary module correctly when caching
When caching is enabled with include-tree, the bridging header PCH is created from the include tree directly. Setup the rewriter correctly when embedding the bridging header into swift binary module. rdar://125719747
This commit is contained in:
@@ -1321,21 +1321,25 @@ void Serializer::writeInputBlock() {
|
||||
time_t importedHeaderModTime = 0;
|
||||
std::string contents;
|
||||
auto importedHeaderPath = Options.ImportedHeader;
|
||||
std::string pchIncludeTree;
|
||||
// We do not want to serialize the explicitly-specified .pch path if one was
|
||||
// provided. Instead we write out the path to the original header source so
|
||||
// that clients can consume it.
|
||||
if (Options.ExplicitModuleBuild &&
|
||||
llvm::sys::path::extension(importedHeaderPath)
|
||||
.ends_with(file_types::getExtension(file_types::TY_PCH)))
|
||||
importedHeaderPath = clangImporter->getClangInstance()
|
||||
.getASTReader()
|
||||
->getModuleManager()
|
||||
.lookupByFileName(importedHeaderPath)
|
||||
->OriginalSourceFileName;
|
||||
.ends_with(file_types::getExtension(file_types::TY_PCH))) {
|
||||
auto *pch = clangImporter->getClangInstance()
|
||||
.getASTReader()
|
||||
->getModuleManager()
|
||||
.lookupByFileName(importedHeaderPath);
|
||||
pchIncludeTree = pch->IncludeTreeID;
|
||||
importedHeaderPath = pch->OriginalSourceFileName;
|
||||
}
|
||||
|
||||
if (!importedHeaderPath.empty()) {
|
||||
contents = clangImporter->getBridgingHeaderContents(
|
||||
importedHeaderPath, importedHeaderSize, importedHeaderModTime);
|
||||
importedHeaderPath, importedHeaderSize, importedHeaderModTime,
|
||||
pchIncludeTree);
|
||||
}
|
||||
assert(publicImportSet.count(bridgingHeaderImport));
|
||||
ImportedHeader.emit(ScratchRecord,
|
||||
|
||||
Reference in New Issue
Block a user