This is an archive of the discontinued LLVM Phabricator instance.

[clang][deps] Handle modular dependencies present in PCH
ClosedPublic

Authored by jansvoboda11 on Jun 2 2021, 7:53 AM.

Details

Summary

When a translation unit uses a PCH and imports the same modules as the PCH, we'd prefer to resolve to those modules instead of inventing new modules and reporting them as modular dependencies. Since the PCH modules have already been built nudge the compiler to reuse them when deciding whether to build a new module and don't report them as regular modular dependencies.

Depends on D103524 & D103802.

Diff Detail

Event Timeline

jansvoboda11 requested review of this revision.Jun 2 2021, 7:53 AM
jansvoboda11 created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptJun 2 2021, 7:53 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
jansvoboda11 retitled this revision from [clang][deps] Mark modular deps to file deps if they come from PCH to [clang][deps] Mark modular deps as file deps if they come from PCH.Jun 3 2021, 10:35 AM
jansvoboda11 edited the summary of this revision. (Show Details)
jansvoboda11 retitled this revision from [clang][deps] Mark modular deps as file deps if they come from PCH to [clang][deps] Mark modules as file deps if they come from PCH.Jun 3 2021, 10:49 AM
jansvoboda11 planned changes to this revision.Jun 4 2021, 7:26 AM

Handle case when TU depends on a PCH module

jansvoboda11 retitled this revision from [clang][deps] Mark modules as file deps if they come from PCH to [clang][deps] Handle modular dependencies present in PCH.Jun 7 2021, 4:24 AM
jansvoboda11 edited the summary of this revision. (Show Details)
jansvoboda11 added inline comments.Jun 8 2021, 4:13 AM
clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
127

I'd expect to have to do this recursively for each IMPORT in the PCH, since AST files list only direct imports.

However, the AST file for PCH I use in tests contains imports of ModCommon1, ModCommon2, ModPCH even though only ModCommon1 and ModPCH are imported directly in the header.

This revision is now accepted and ready to land.Jun 13 2021, 1:09 PM
This revision was landed with ongoing or failed builds.Jun 14 2021, 3:01 AM
This revision was automatically updated to reflect the committed changes.