[BrdigingHeader] Auto bridging header chaining

Add ability to automatically chaining the bridging headers discovered from all
dependencies module when doing swift caching build. This will eliminate all
implicit bridging header imports from the build and make the bridging header
importing behavior much more reliable, while keep the compatibility at maximum.

For example, if the current module A depends on module B and C, and both B and
C are binary modules that uses bridging header, when building module A,
dependency scanner will construct a new header that chains three bridging
headers together with the option to build a PCH from it. This will make all
importing errors more obvious while improving the performance.
This commit is contained in:
Steven Wu
2025-01-06 15:52:32 -08:00
parent 8534f29ef5
commit 9d59044bb1
44 changed files with 1094 additions and 275 deletions

View File

@@ -436,7 +436,7 @@ public:
getFilenameForPrivateDecl(const Decl *decl) const override;
virtual TypeDecl *lookupLocalType(StringRef MangledName) const override;
virtual OpaqueTypeDecl *
lookupOpaqueResultType(StringRef MangledName) override;
@@ -583,6 +583,11 @@ bool extractCompilerFlagsFromInterface(
/// Extract the user module version number from an interface file.
llvm::VersionTuple extractUserModuleVersionFromInterface(StringRef moduleInterfacePath);
/// Extract embedded bridging header from binary module.
std::string
extractEmbeddedBridgingHeaderContent(std::unique_ptr<llvm::MemoryBuffer> file,
ASTContext &Context);
} // end namespace swift
#endif