[PATCH] D155503: [clang][modules] Track included files per submodule

Jan Svoboda via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 17 11:40:01 PDT 2023


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

When building a module consisting of submodules, the preprocessor maintains a global set of included headers. This information gets serialized into the PCM file (specifically into the HeaderFileInfo table). After loading such PCM file, this information is deserialized into the state of the importing preprocessor. This happens even if the headers were included by (sub)modules that are not visible. This can incorrectly prevent imports of textual headers in the importing instance (see attached tests).

This patch fixes this bug splitting the set of included files per submodule. This is an alternative to D112915 <https://reviews.llvm.org/D112915> and D104344 <https://reviews.llvm.org/D104344>.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D155503

Files:
  clang/include/clang/Lex/Preprocessor.h
  clang/lib/Lex/HeaderSearch.cpp
  clang/lib/Lex/Preprocessor.cpp
  clang/lib/Serialization/ASTReader.cpp
  clang/lib/Serialization/ASTReaderInternals.h
  clang/lib/Serialization/ASTWriter.cpp
  clang/test/Modules/import-submodule-visibility.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155503.541160.patch
Type: text/x-patch
Size: 14462 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230717/81f25d97/attachment-0001.bin>


More information about the cfe-commits mailing list