Skip to content

Commit a652979

Browse files
Default-initialize all fields of lldb_dap::protocol::Symbol. (#157150)
Co-authored-by: Jonas Devlieghere <[email protected]>
1 parent 558effa commit a652979

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

lldb/tools/lldb-dap/Handler/ModuleSymbolsRequestHandler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ ModuleSymbolsRequestHandler::Run(const ModuleSymbolsArguments &args) const {
6060
if (!symbol.IsValid())
6161
continue;
6262

63-
Symbol dap_symbol = {};
63+
Symbol dap_symbol;
6464
dap_symbol.id = symbol.GetID();
6565
dap_symbol.type = symbol.GetType();
6666
dap_symbol.isDebug = symbol.IsDebug();

lldb/tools/lldb-dap/Protocol/DAPTypes.h

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#ifndef LLDB_TOOLS_LLDB_DAP_PROTOCOL_DAP_TYPES_H
1717
#define LLDB_TOOLS_LLDB_DAP_PROTOCOL_DAP_TYPES_H
1818

19+
#include "lldb/lldb-defines.h"
1920
#include "lldb/lldb-types.h"
2021
#include "llvm/Support/JSON.h"
2122
#include <optional>
@@ -50,29 +51,29 @@ llvm::json::Value toJSON(const SourceLLDBData &);
5051

5152
struct Symbol {
5253
/// The symbol id, usually the original symbol table index.
53-
uint32_t id;
54+
uint32_t id = 0;
5455

5556
/// True if this symbol is debug information in a symbol.
56-
bool isDebug;
57+
bool isDebug = false;
5758

5859
/// True if this symbol is not actually in the symbol table, but synthesized
5960
/// from other info in the object file.
60-
bool isSynthetic;
61+
bool isSynthetic = false;
6162

6263
/// True if this symbol is globally visible.
63-
bool isExternal;
64+
bool isExternal = false;
6465

6566
/// The symbol type.
66-
lldb::SymbolType type;
67+
lldb::SymbolType type = lldb::eSymbolTypeInvalid;
6768

6869
/// The symbol file address.
69-
lldb::addr_t fileAddress;
70+
lldb::addr_t fileAddress = LLDB_INVALID_ADDRESS;
7071

7172
/// The symbol load address.
7273
std::optional<lldb::addr_t> loadAddress;
7374

7475
/// The symbol size.
75-
lldb::addr_t size;
76+
lldb::addr_t size = 0;
7677

7778
/// The symbol name.
7879
std::string name;

0 commit comments

Comments
 (0)