Merge branch 'main' into elsh/pkg-sil-verify

This commit is contained in:
Ellie Shin
2024-04-17 22:46:55 -07:00
committed by GitHub
604 changed files with 9702 additions and 3715 deletions

View File

@@ -1327,21 +1327,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,