This is an archive of the discontinued LLVM Phabricator instance.

[Serialization] Read main file's HeaderFileInfo from PCH even if changed
AbandonedPublic

Authored by sammccall on Jul 17 2023, 6:00 AM.

Details

Reviewers
None
Summary

Because file size is part of the cache key, overriding the main file
content leaves us unable to load its HeaderFileInfo from a preamble.

The fix is a little messy: write a second copy with size 0 in the key.
During deserialization, if a load fails and the main filename matches,
make a second attempt with this size-0 key.
In both cases, we only do this for preambles, not for modules.

Fixes https://github.com/clangd/clangd/issues/337

Diff Detail

Event Timeline

sammccall created this revision.Jul 17 2023, 6:00 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 17 2023, 6:00 AM
sammccall requested review of this revision.Jul 17 2023, 6:00 AM
Herald added projects: Restricted Project, Restricted Project, Restricted Project. · View Herald TranscriptJul 17 2023, 6:00 AM
sammccall abandoned this revision.Jul 17 2023, 6:01 AM
nridge added a subscriber: nridge.Jul 22 2023, 5:39 PM