================ @@ -380,30 +381,114 @@ llvm::SmallVector<StringRef> getAllRequiredModules(ProjectModules &MDB, return ModuleNames; } +class CachingProjectModules : public ProjectModules { +public: + CachingProjectModules(const GlobalCompilationDatabase &CDB) : CDB(CDB) {} + + std::vector<std::string> getRequiredModules(PathRef File) override { + std::unique_ptr<ProjectModules> MDB = CDB.getProjectModules(File); + if (!MDB) { + elog("Failed to get Project Modules information for {0}", File); + return {}; + } + return MDB->getRequiredModules(File); + } + + std::string getModuleNameForSource(PathRef File) override { + std::unique_ptr<ProjectModules> MDB = CDB.getProjectModules(File); + if (!MDB) { + elog("Failed to get Project Modules information for {0}", File); + return {}; + } + return MDB->getModuleNameForSource(File); + } + + void setCommandMangler(CommandMangler M) override { + // GlobalCompilationDatabase::getProjectModules() will set mangler + // for the underlying ProjectModules. + } ---------------- ChuanqiXu9 wrote:
Done https://github.com/llvm/llvm-project/pull/125988 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits