llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clangd

Author: None (serge-sans-paille)

<details>
<summary>Changes</summary>

Moving an std::map is almost always profitable (DiagnosticToDiagRefMap).

Changes suggested by performance-use-std-move from #<!-- -->179467

---
Full diff: https://github.com/llvm/llvm-project/pull/180475.diff


1 Files Affected:

- (modified) clang-tools-extra/clangd/ClangdLSPServer.cpp (+1-1) 


``````````diff
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.

``````````

</details>


https://github.com/llvm/llvm-project/pull/180475
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to