ahoppen added inline comments.
================ Comment at: clang/lib/Lex/HeaderSearch.cpp:95 + if (HS.CurrentSearchPathIdx != ~0U) + HS.ModuleToSearchDirIdx[M] = HS.CurrentSearchPathIdx; + } ---------------- These indices will be out of date if the search paths are changed via `HeaderSearch::SetSearchPaths` or `HeaderSearch::AddSearchPath` after the first module map has been loaded. One could probably adjust the indices in `AddSearchPath` but maybe it’s easier to not use the index into `SearchDirs` as the key. An alternative suggestion would be to use `std::shared_ptr<DirectoryLookup>` instead, changing some of the data structures as follows: ``` - std::vector<DirectoryLookup> SearchDirs + std::vector<std::shared_ptr<DirectoryLookup>> SearchDirs - std::vector<bool> SearchDirsUsage; + std::map<std::shared_ptr<DirectoryLookup>, bool> SearchDirsUsage; - llvm::DenseMap<Module *, unsigned> ModuleToSearchDirIdx; + llvm::DenseMap<Module *, std::shared_ptr<DirectoryLookup>> ModuleToSearchDirIdx; - llvm::DenseMap<unsigned, unsigned> SearchDirToHSEntry; + llvm::DenseMap<std::shared_ptr<DirectoryLookup>, unsigned> SearchDirToHSEntry; ``` 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