[PATCH] D155455: [Serialization] Read main file's HeaderFileInfo from PCH even if changed

Sam McCall via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 17 06:00:11 PDT 2023


sammccall created this revision.
Herald added subscribers: kadircet, arphaman.
Herald added a project: All.
sammccall requested review of this revision.
Herald added subscribers: cfe-commits, llvm-commits, ilya-biryukov.
Herald added projects: clang, LLVM, clang-tools-extra.

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D155455

Files:
  clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp
  clang/lib/Serialization/ASTReader.cpp
  clang/lib/Serialization/ASTWriter.cpp
  llvm/include/llvm/Support/OnDiskHashTable.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155455.540984.patch
Type: text/x-patch
Size: 4415 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230717/93bab4cc/attachment.bin>


More information about the llvm-commits mailing list