This is an archive of the discontinued LLVM Phabricator instance.

[clang][modules] Serialize `Module::DefinitionLoc`
ClosedPublic

Authored by jansvoboda11 on May 10 2023, 1:07 PM.

Details

Summary

This is a prep patch for avoiding the quadratic number of calls to HeaderSearch::lookupModule() in ASTReader for each (transitively) loaded PCM file. (Specifically in the context of clang-scan-deps).

This patch explicitly serializes Module::DefinitionLoc so that we can stop relying on it being filled by the module map parser. This change also required change to the module map parser, where we used the absence of DefinitionLoc to determine whether a file came from a PCM file. We also need to make sure we consider the "containing" module map affecting when writing a PCM, so that it's not stripped during serialization, which ensures DefinitionLoc still ends up pointing to the correct offset. This is intended to be a NFC change.

Diff Detail

Event Timeline

jansvoboda11 created this revision.May 10 2023, 1:07 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 10 2023, 1:07 PM
Herald added a subscriber: ributzka. · View Herald Transcript
jansvoboda11 requested review of this revision.May 10 2023, 1:07 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 10 2023, 1:07 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
benlangmuir accepted this revision.May 10 2023, 2:23 PM
This revision is now accepted and ready to land.May 10 2023, 2:23 PM
This revision was landed with ongoing or failed builds.Jul 17 2023, 1:51 PM
This revision was automatically updated to reflect the committed changes.