https://github.com/zahiraam updated https://github.com/llvm/llvm-project/pull/119741
>From 440554df79ebc7c8971c4af928f623b13c95c6ee Mon Sep 17 00:00:00 2001 From: Zahira Ammarguellat <zahira.ammarguel...@intel.com> Date: Wed, 4 Dec 2024 12:54:41 -0800 Subject: [PATCH 1/3] [NFC] Use a move instead of a copy to optimize performance. --- clang-tools-extra/clangd/ModulesBuilder.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang-tools-extra/clangd/ModulesBuilder.cpp b/clang-tools-extra/clangd/ModulesBuilder.cpp index 29508901f85bba..bee31fe51555e0 100644 --- a/clang-tools-extra/clangd/ModulesBuilder.cpp +++ b/clang-tools-extra/clangd/ModulesBuilder.cpp @@ -199,7 +199,7 @@ bool IsModuleFileUpToDate(PathRef ModuleFilePath, SourceManager SourceMgr(*Diags, FileMgr); - HeaderSearch HeaderInfo(HSOpts, SourceMgr, *Diags, LangOpts, + HeaderSearch HeaderInfo(std::move(HSOpts), SourceMgr, *Diags, LangOpts, /*Target=*/nullptr); TrivialModuleLoader ModuleLoader; >From fadfd03b9596e6751c6bda5f17d076f1884fbe29 Mon Sep 17 00:00:00 2001 From: Zahira Ammarguellat <zahira.ammarguel...@intel.com> Date: Thu, 12 Dec 2024 10:43:26 -0800 Subject: [PATCH 2/3] [NFC] Fixed a couple issues found trhough static analysis tool. --- clang-tools-extra/clangd/ModulesBuilder.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/clang-tools-extra/clangd/ModulesBuilder.cpp b/clang-tools-extra/clangd/ModulesBuilder.cpp index bee31fe51555e0..2e27d1bd287cb7 100644 --- a/clang-tools-extra/clangd/ModulesBuilder.cpp +++ b/clang-tools-extra/clangd/ModulesBuilder.cpp @@ -142,10 +142,13 @@ class ReusablePrerequisiteModules : public PrerequisiteModules { public: ReusablePrerequisiteModules() = default; - ReusablePrerequisiteModules(const ReusablePrerequisiteModules &Other) = - default; - ReusablePrerequisiteModules & - operator=(const ReusablePrerequisiteModules &) = default; + ReusablePrerequisiteModules(const ReusablePrerequisiteModules &Other) + : PrerequisiteModules(Other) { + RequiredModules = Other.RequiredModules; + BuiltModuleNames = Other.BuiltModuleNames; + } + + ReusablePrerequisiteModules &operator=(const ReusablePrerequisiteModules &) = delete; ReusablePrerequisiteModules(ReusablePrerequisiteModules &&) = delete; ReusablePrerequisiteModules operator=(ReusablePrerequisiteModules &&) = delete; @@ -310,7 +313,7 @@ bool ReusablePrerequisiteModules::canReuse( llvm::SmallVector<llvm::StringRef> BMIPaths; for (auto &MF : RequiredModules) BMIPaths.push_back(MF->getModuleFilePath()); - return IsModuleFilesUpToDate(BMIPaths, *this, VFS); + return IsModuleFilesUpToDate(std::move(BMIPaths), *this, VFS); } class ModuleFileCache { >From 273d1448401ef3686dfd7029b5a9ec117d76da84 Mon Sep 17 00:00:00 2001 From: Zahira Ammarguellat <zahira.ammarguel...@intel.com> Date: Thu, 12 Dec 2024 10:57:17 -0800 Subject: [PATCH 3/3] Fix format. --- clang-tools-extra/clangd/ModulesBuilder.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/clang-tools-extra/clangd/ModulesBuilder.cpp b/clang-tools-extra/clangd/ModulesBuilder.cpp index 2e27d1bd287cb7..58b9573281ee98 100644 --- a/clang-tools-extra/clangd/ModulesBuilder.cpp +++ b/clang-tools-extra/clangd/ModulesBuilder.cpp @@ -143,12 +143,13 @@ class ReusablePrerequisiteModules : public PrerequisiteModules { ReusablePrerequisiteModules() = default; ReusablePrerequisiteModules(const ReusablePrerequisiteModules &Other) - : PrerequisiteModules(Other) { + : PrerequisiteModules(Other) { RequiredModules = Other.RequiredModules; BuiltModuleNames = Other.BuiltModuleNames; } - ReusablePrerequisiteModules &operator=(const ReusablePrerequisiteModules &) = delete; + ReusablePrerequisiteModules & + operator=(const ReusablePrerequisiteModules &) = delete; ReusablePrerequisiteModules(ReusablePrerequisiteModules &&) = delete; ReusablePrerequisiteModules operator=(ReusablePrerequisiteModules &&) = delete; _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits