[clang-tools-extra] f88e018 - [clangd] Add explicit std::move(...) to avoid a few copies (#180475)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 9 03:35:18 PST 2026
Author: serge-sans-paille
Date: 2026-02-09T11:35:13Z
New Revision: f88e0185d7333827f5342143e7c515fc8fb57020
URL: https://github.com/llvm/llvm-project/commit/f88e0185d7333827f5342143e7c515fc8fb57020
DIFF: https://github.com/llvm/llvm-project/commit/f88e0185d7333827f5342143e7c515fc8fb57020.diff
LOG: [clangd] Add explicit std::move(...) to avoid a few copies (#180475)
Moving an std::map is almost always profitable (DiagnosticToDiagRefMap).
Changes suggested by performance-use-std-move from #179467
Added:
Modified:
clang-tools-extra/clangd/ClangdLSPServer.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/clangd/ClangdLSPServer.cpp b/clang-tools-extra/clangd/ClangdLSPServer.cpp
index 761b07eceec83..ebd42abd2dd61 100644
--- a/clang-tools-extra/clangd/ClangdLSPServer.cpp
+++ b/clang-tools-extra/clangd/ClangdLSPServer.cpp
@@ -1833,7 +1833,7 @@ void ClangdLSPServer::onDiagnosticsReady(PathRef File, llvm::StringRef Version,
// Cache DiagRefMap
{
std::lock_guard<std::mutex> Lock(DiagRefMutex);
- DiagRefMap[File] = LocalDiagMap;
+ DiagRefMap[File] = std::move(LocalDiagMap);
}
// Send a notification to the LSP client.
More information about the cfe-commits
mailing list