[clang][modules] Cache loads of modules imported by PCH
During explicit modular build, PCM files are typically specified via the `-fmodule-file=<path>` command-line option. Early during the compilation, Clang uses the `ASTReader` to read their contents and caches the result so that the module isn't loaded implicitly later on. A listener is attached to the `ASTReader` to collect names of the modules read from the PCM files. However, if the PCM has already been loaded previously via PCH: 1. the `ASTReader` doesn't do anything for the second time, 2. the listener is not invoked at all, 3. the module load result is not cached, 4. the compilation fails when attempting to load the module implicitly later on. This patch solves this problem by attaching the listener to the `ASTReader` for PCH reading as well. Reviewed By: dexonsmith Differential Revision: https://reviews.llvm.org/D111560
Loading
Please register or sign in to comment