[PATCH] D135634: [clang][modules] Serialize VFS overlay paths into PCMs

Jan Svoboda via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 10 18:34:52 PDT 2022


jansvoboda11 created this revision.
jansvoboda11 added reviewers: akyrtzi, benlangmuir, Bigcheese.
Herald added a subscriber: ributzka.
Herald added a project: All.
jansvoboda11 requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

With implicitly built modules, the importing `CompilerInstance` assumes PCMs were built in a "compatible way" (i.e. with similarly set up instance). Either because their context hash matches, or because this instance has just built them.

There are some use-cases, however, where this assumption doesn't hold, the libclang/c-index-test being one of them. There, the importing instance (or `ASTUnit`) is being set up while the PCM file is being deserialized. Until now, we've assumed the serialized paths to input files are the actual on-disk files, meaning the default physical VFS was always able to resolve them. This won't be the case after Dxxxxxx. Therefore, this patch makes sure `ASTUnit` is initialized with the same VFS as the PCM it's deserializing - by storing paths to the VFS overlay files into the PCM itself.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D135634

Files:
  clang/include/clang/Basic/FileManager.h
  clang/include/clang/Frontend/CompilerInvocation.h
  clang/lib/Frontend/ASTUnit.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/lib/Serialization/ASTReader.cpp
  clang/lib/Serialization/ASTWriter.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D135634.466678.patch
Type: text/x-patch
Size: 4373 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221011/1bc332a8/attachment.bin>


More information about the cfe-commits mailing list