jansvoboda11 added inline comments.
================ Comment at: clang/lib/Lex/HeaderSearch.cpp:94 + // Module map parsing initiated by header search. + if (HS.CurrentSearchPathIdx != ~0U) + HS.ModuleToSearchDirIdx[M] = HS.CurrentSearchPathIdx; ---------------- ahoppen wrote: > jansvoboda11 wrote: > > ahoppen wrote: > > > When would the `moduleMapModuleCreated` be called while > > > `CurrentSearchPathIdx == ~0U`? Could this be an `assert` instead? > > This happens whenever any of the `ModuleMap` member functions that create > > new `Module` instances are called outside of `HeaderSearch`. > > > > The `MMCallback` callback is basically "global" (present for the whole > > lifetime of `ModuleMap`), so that we don't have to repeatedly > > register/deregister it in `HeaderSearch::lookupModule`. > Is there any reasonable case where module maps would be created without > `HeaderSearch` triggering the creation? I think parsing of module maps (and therefore creation of contained modules) should be triggered through `HeaderSearch`. However, there are also C++20 modules and explicit Clang modules that are not discovered by the header search mechanisms or modulemap parsing. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D113676/new/ https://reviews.llvm.org/D113676 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits