[PATCH] D106876: Remove non-affecting module maps from PCM files.

Jan Svoboda via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 19 14:13:01 PDT 2022


jansvoboda11 added a comment.

I agree that avoiding serializing non-affecting input files is the better approach. Your code is more or less what I had in mind, thanks for sketching it out!
The number of ignored module maps is typically around 70 - 110 on macOS (when you allow system module maps to be treated as non-affecting), and those are at the start of the `SourceManager` block. I might implement this approach and test out if there's a noticeable performance impact. Maybe we could use something similar to the optimization in `SourceManager::getFileIDLoaded()`.

I remember having a separate `SourceManager` came up before, when investigating other issues. Though I think you want to merge `SourceManager`s earlier than on serialization. I think other data structures might hold a `SourceLocation` pointing into the module-map-specific `SourceManager`. How can you tell which `SourceManager` it came from? This could be prevented by merging the module-map-specific `SourceManager` into the main one when returning non-null result from `Module *ModuleMap::lookupModule(StringRef Name)`, were that the only way to get a module.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D106876/new/

https://reviews.llvm.org/D106876



More information about the cfe-commits mailing list