Mercurial > hg > CbC > CbC_llvm
diff clang/lib/Tooling/DependencyScanning/DependencyScanningTool.cpp @ 221:79ff65ed7e25
LLVM12 Original
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 15 Jun 2021 19:15:29 +0900 |
parents | 1d019706d866 |
children | 5f17cb93ff66 |
line wrap: on
line diff
--- a/clang/lib/Tooling/DependencyScanning/DependencyScanningTool.cpp Tue Jun 15 19:13:43 2021 +0900 +++ b/clang/lib/Tooling/DependencyScanning/DependencyScanningTool.cpp Tue Jun 15 19:15:29 2021 +0900 @@ -13,17 +13,34 @@ namespace tooling{ namespace dependencies{ -std::vector<std::string> FullDependencies::getAdditionalCommandLine( - std::function<StringRef(ClangModuleDep)> LookupPCMPath, - std::function<const ModuleDeps &(ClangModuleDep)> LookupModuleDeps) const { - std::vector<std::string> Ret = AdditionalNonPathCommandLine; +std::vector<std::string> FullDependencies::getAdditionalArgs( + std::function<StringRef(ModuleID)> LookupPCMPath, + std::function<const ModuleDeps &(ModuleID)> LookupModuleDeps) const { + std::vector<std::string> Ret{ + "-fno-implicit-modules", + "-fno-implicit-module-maps", + }; - dependencies::detail::appendCommonModuleArguments( - ClangModuleDeps, LookupPCMPath, LookupModuleDeps, Ret); + std::vector<std::string> PCMPaths; + std::vector<std::string> ModMapPaths; + dependencies::detail::collectPCMAndModuleMapPaths( + ClangModuleDeps, LookupPCMPath, LookupModuleDeps, PCMPaths, ModMapPaths); + for (const std::string &PCMPath : PCMPaths) + Ret.push_back("-fmodule-file=" + PCMPath); + for (const std::string &ModMapPath : ModMapPaths) + Ret.push_back("-fmodule-map-file=" + ModMapPath); return Ret; } +std::vector<std::string> +FullDependencies::getAdditionalArgsWithoutModulePaths() const { + return { + "-fno-implicit-modules", + "-fno-implicit-module-maps", + }; +} + DependencyScanningTool::DependencyScanningTool( DependencyScanningService &Service) : Worker(Service) {} @@ -109,7 +126,7 @@ } void handleModuleDependency(ModuleDeps MD) override { - ClangModuleDeps[MD.ContextHash + MD.ModuleName] = std::move(MD); + ClangModuleDeps[MD.ID.ContextHash + MD.ID.ModuleName] = std::move(MD); } void handleContextHash(std::string Hash) override { @@ -119,14 +136,14 @@ FullDependenciesResult getFullDependencies() const { FullDependencies FD; - FD.ContextHash = std::move(ContextHash); + FD.ID.ContextHash = std::move(ContextHash); FD.FileDeps.assign(Dependencies.begin(), Dependencies.end()); for (auto &&M : ClangModuleDeps) { auto &MD = M.second; if (MD.ImportedByMainFile) - FD.ClangModuleDeps.push_back({MD.ModuleName, ContextHash}); + FD.ClangModuleDeps.push_back(MD.ID); } FullDependenciesResult FDR;