[clang-tools-extra] 38e0f98 - [CLANGD] [NFC] Fix proposed by static analyzer. (#140116)

via cfe-commits cfe-commits at lists.llvm.org
Fri May 16 04:56:41 PDT 2025


Author: Zahira Ammarguellat
Date: 2025-05-16T07:56:36-04:00
New Revision: 38e0f983ada4cb753bcaafaf8fa9e2f2dfdef2ba

URL: https://github.com/llvm/llvm-project/commit/38e0f983ada4cb753bcaafaf8fa9e2f2dfdef2ba
DIFF: https://github.com/llvm/llvm-project/commit/38e0f983ada4cb753bcaafaf8fa9e2f2dfdef2ba.diff

LOG: [CLANGD] [NFC] Fix proposed by static analyzer. (#140116)

This fixes an issue reported by the sanitizer with the following error
message:
`copy_constructor_call: IndexOpts` is passed by value as a parameter to`
clang::index::IndexingOptions::IndexingOptions` instead of being moved.

Added: 
    

Modified: 
    clang-tools-extra/clangd/index/FileIndex.cpp

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clangd/index/FileIndex.cpp b/clang-tools-extra/clangd/index/FileIndex.cpp
index 0fe069783d64f..c49de377d54ca 100644
--- a/clang-tools-extra/clangd/index/FileIndex.cpp
+++ b/clang-tools-extra/clangd/index/FileIndex.cpp
@@ -79,7 +79,8 @@ SlabTuple indexSymbols(ASTContext &AST, Preprocessor &PP,
 
   SymbolCollector Collector(std::move(CollectorOpts));
   Collector.setPreprocessor(PP);
-  index::indexTopLevelDecls(AST, PP, DeclsToIndex, Collector, IndexOpts);
+  index::indexTopLevelDecls(AST, PP, DeclsToIndex, Collector,
+                            std::move(IndexOpts));
   if (MacroRefsToIndex)
     Collector.handleMacros(*MacroRefsToIndex);
 


        


More information about the cfe-commits mailing list