[clang-tools-extra] 4443314 - [NFC] Fix uninitialized scalar field in constructor. (#118324)

via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 5 04:42:06 PST 2024


Author: Zahira Ammarguellat
Date: 2024-12-05T07:42:02-05:00
New Revision: 44433147d62ef0b918c8925874a407ecec15193f

URL: https://github.com/llvm/llvm-project/commit/44433147d62ef0b918c8925874a407ecec15193f
DIFF: https://github.com/llvm/llvm-project/commit/44433147d62ef0b918c8925874a407ecec15193f.diff

LOG: [NFC] Fix uninitialized scalar field in constructor. (#118324)

Non-static class field is not initialized in constructor.

Added: 
    

Modified: 
    clang-tools-extra/clangd/index/MemIndex.h
    clang-tools-extra/clangd/index/dex/Dex.h

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clangd/index/MemIndex.h b/clang-tools-extra/clangd/index/MemIndex.h
index 8f390c5028dc4d..fb1052b0c7ca85 100644
--- a/clang-tools-extra/clangd/index/MemIndex.h
+++ b/clang-tools-extra/clangd/index/MemIndex.h
@@ -97,7 +97,7 @@ class MemIndex : public SymbolIndex {
   // Set of files which were used during this index build.
   llvm::StringSet<> Files;
   // Contents of the index (symbols, references, etc.)
-  IndexContents IdxContents;
+  IndexContents IdxContents = IndexContents::None;
   std::shared_ptr<void> KeepAlive; // poor man's move-only std::any
   // Size of memory retained by KeepAlive.
   size_t BackingDataSize = 0;

diff  --git a/clang-tools-extra/clangd/index/dex/Dex.h b/clang-tools-extra/clangd/index/dex/Dex.h
index 20c0503d19b978..46efbc6c699cab 100644
--- a/clang-tools-extra/clangd/index/dex/Dex.h
+++ b/clang-tools-extra/clangd/index/dex/Dex.h
@@ -146,7 +146,7 @@ class Dex : public SymbolIndex {
   // Set of files which were used during this index build.
   llvm::StringSet<> Files;
   // Contents of the index (symbols, references, etc.)
-  IndexContents IdxContents;
+  IndexContents IdxContents = IndexContents::None;
   // Size of memory retained by KeepAlive.
   size_t BackingDataSize = 0;
 };


        


More information about the cfe-commits mailing list