[Pitch] Better tracking of dependencies from .pch files

I've been looking into improving incremental build times for modules that bridge Objective-C code into Swift. Currently, the bridging header is compiled into a .pch, and Swift source files each depend on every Obj-C header that is transitively included in the the bridging header.

It seems like we may be able to avoid adding every header from the .pch as dependencies, and rather add only the headers which provide declarations found in the Swift source.

I hacked together a prototype that does this by:
a) Modifying ClangImporter::create() to avoid collecting external dependencies while importing the .pch
b) Modifying various the *LookupRequest::writeDependencySink() methods to also collect external file dependencies for Decls that were imported from clang.

It seems to work in simple cases, but there's a ton I don't know. Does this approach seem viable at a high level? Thanks!

Terms of Service

Privacy Policy

Cookie Policy