[clang][modules] Avoid re-exporting PCH imports on every later module import
authorBen Langmuir <blangmuir@apple.com>
Wed, 12 Apr 2023 21:54:55 +0000 (14:54 -0700)
committerBen Langmuir <blangmuir@apple.com>
Thu, 20 Apr 2023 18:29:23 +0000 (11:29 -0700)
commite06a91c5996b039cacd55e6ead0baf14424c740c
tree6419845a92a4390dd7329fbec73b88bf8dd13840
parent7c59e8001a3b66be545a890a26ad8a24a6c9fe4b
[clang][modules] Avoid re-exporting PCH imports on every later module import

We only want to make PCH imports visible once for the the TU, not
repeatedly after every subsequent import. This causes some incorrect
behaviour with submodule visibility, and causes us to get extra module
dependencies in the scanner. So far I have only seen obviously incorrect
behaviour when building with -fmodule-name to cause a submodule to be
textually included when using the PCH, though the old behaviour seems
wrong regardless.

rdar://107449644

Differential Revision: https://reviews.llvm.org/D148176
clang/include/clang/Serialization/ASTReader.h
clang/lib/Serialization/ASTReader.cpp
clang/test/ClangScanDeps/modules-pch-imports.c [new file with mode: 0644]
clang/test/Modules/submodule-visibility-pch.c [new file with mode: 0644]