From 4142b5bd36a4f7a554196687e191a09dba9e4dcf Mon Sep 17 00:00:00 2001 From: Zahira Ammarguellat Date: Mon, 2 Dec 2024 09:09:21 -0800 Subject: [PATCH 1/4] [NFC] Fix uninitialized data member in constructor. --- clang-tools-extra/clangd/index/dex/Dex.h | 1 + 1 file changed, 1 insertion(+) diff --git a/clang-tools-extra/clangd/index/dex/Dex.h b/clang-tools-extra/clangd/index/dex/Dex.h index 69e161d51135b..f907c9a55b935 100644 --- a/clang-tools-extra/clangd/index/dex/Dex.h +++ b/clang-tools-extra/clangd/index/dex/Dex.h @@ -58,6 +58,7 @@ class Dex : public SymbolIndex { KeepAlive = std::shared_ptr( std::make_shared(std::move(BackingData)), nullptr); this->BackingDataSize = BackingDataSize; + this->IdxContents = IndexContents::All; } template Date: Mon, 2 Dec 2024 10:54:41 -0800 Subject: [PATCH 2/4] Fix uninitialized scalar field in constructor. --- clang-tools-extra/clangd/index/MemIndex.h | 1 + 1 file changed, 1 insertion(+) diff --git a/clang-tools-extra/clangd/index/MemIndex.h b/clang-tools-extra/clangd/index/MemIndex.h index fba2c1a7120a2..879d7750ac048 100644 --- a/clang-tools-extra/clangd/index/MemIndex.h +++ b/clang-tools-extra/clangd/index/MemIndex.h @@ -43,6 +43,7 @@ class MemIndex : public SymbolIndex { KeepAlive = std::shared_ptr( std::make_shared(std::move(BackingData)), nullptr); this->BackingDataSize = BackingDataSize; + this->IdxContents = IndexContents::All; } template Date: Mon, 2 Dec 2024 14:10:29 -0800 Subject: [PATCH 3/4] Put the initialization in the declaration. --- clang-tools-extra/clangd/index/MemIndex.h | 1 - clang-tools-extra/clangd/index/dex/Dex.h | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/clang-tools-extra/clangd/index/MemIndex.h b/clang-tools-extra/clangd/index/MemIndex.h index 879d7750ac048..fba2c1a7120a2 100644 --- a/clang-tools-extra/clangd/index/MemIndex.h +++ b/clang-tools-extra/clangd/index/MemIndex.h @@ -43,7 +43,6 @@ class MemIndex : public SymbolIndex { KeepAlive = std::shared_ptr( std::make_shared(std::move(BackingData)), nullptr); this->BackingDataSize = BackingDataSize; - this->IdxContents = IndexContents::All; } template ( std::make_shared(std::move(BackingData)), nullptr); this->BackingDataSize = BackingDataSize; - this->IdxContents = IndexContents::All; } template Files; // Contents of the index (symbols, references, etc.) - IndexContents IdxContents; + IndexContents IdxContents = IndexContents::None; // Size of memory retained by KeepAlive. size_t BackingDataSize = 0; }; From af9712fd94008868d18c65941abe78e24853ae8b Mon Sep 17 00:00:00 2001 From: Zahira Ammarguellat Date: Tue, 3 Dec 2024 07:56:01 -0800 Subject: [PATCH 4/4] Added the initialization of IndexContents in MemIndex. --- clang-tools-extra/clangd/index/MemIndex.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang-tools-extra/clangd/index/MemIndex.h b/clang-tools-extra/clangd/index/MemIndex.h index fba2c1a7120a2..ff427f65fdf06 100644 --- a/clang-tools-extra/clangd/index/MemIndex.h +++ b/clang-tools-extra/clangd/index/MemIndex.h @@ -93,7 +93,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 KeepAlive; // poor man's move-only std::any // Size of memory retained by KeepAlive. size_t BackingDataSize = 0;