diff options
author | Shafik Yaghmour <syaghmour@apple.com> | 2022-03-14 13:32:03 -0700 |
---|---|---|
committer | Shafik Yaghmour <syaghmour@apple.com> | 2022-03-14 13:32:03 -0700 |
commit | 28c878aeb29a7e7a9ae8f748de6a3c41482b97be (patch) | |
tree | 6d057edb2aacc7705718950dedbf5c40cb758838 /lldb/source | |
parent | c79ab1065e89872668b8d43c747ff3e5974b0d96 (diff) | |
download | llvm-28c878aeb29a7e7a9ae8f748de6a3c41482b97be.zip llvm-28c878aeb29a7e7a9ae8f748de6a3c41482b97be.tar.gz llvm-28c878aeb29a7e7a9ae8f748de6a3c41482b97be.tar.bz2 |
[LLDB] Applying clang-tidy modernize-use-default-member-init over LLDB
Applied modernize-use-default-member-init clang-tidy check over LLDB.
It appears in many files we had already switched to in class member init but
never updated the constructors to reflect that. This check is already present in
the lldb/.clang-tidy config.
Differential Revision: https://reviews.llvm.org/D121481
Diffstat (limited to 'lldb/source')
56 files changed, 246 insertions, 325 deletions
diff --git a/lldb/source/API/SBBroadcaster.cpp b/lldb/source/API/SBBroadcaster.cpp index f145bc6..5892093 100644 --- a/lldb/source/API/SBBroadcaster.cpp +++ b/lldb/source/API/SBBroadcaster.cpp @@ -19,7 +19,7 @@ using namespace lldb_private; SBBroadcaster::SBBroadcaster() { LLDB_INSTRUMENT_VA(this); } SBBroadcaster::SBBroadcaster(const char *name) - : m_opaque_sp(new Broadcaster(nullptr, name)), m_opaque_ptr(nullptr) { + : m_opaque_sp(new Broadcaster(nullptr, name)) { LLDB_INSTRUMENT_VA(this, name); m_opaque_ptr = m_opaque_sp.get(); diff --git a/lldb/source/API/SBListener.cpp b/lldb/source/API/SBListener.cpp index 2ce17a5..a7008dc 100644 --- a/lldb/source/API/SBListener.cpp +++ b/lldb/source/API/SBListener.cpp @@ -23,12 +23,11 @@ using namespace lldb_private; SBListener::SBListener() { LLDB_INSTRUMENT_VA(this); } SBListener::SBListener(const char *name) - : m_opaque_sp(Listener::MakeListener(name)), m_unused_ptr(nullptr) { + : m_opaque_sp(Listener::MakeListener(name)) { LLDB_INSTRUMENT_VA(this, name); } -SBListener::SBListener(const SBListener &rhs) - : m_opaque_sp(rhs.m_opaque_sp), m_unused_ptr(nullptr) { +SBListener::SBListener(const SBListener &rhs) : m_opaque_sp(rhs.m_opaque_sp) { LLDB_INSTRUMENT_VA(this, rhs); } @@ -43,7 +42,7 @@ const lldb::SBListener &SBListener::operator=(const lldb::SBListener &rhs) { } SBListener::SBListener(const lldb::ListenerSP &listener_sp) - : m_opaque_sp(listener_sp), m_unused_ptr(nullptr) {} + : m_opaque_sp(listener_sp) {} SBListener::~SBListener() = default; diff --git a/lldb/source/API/SBPlatform.cpp b/lldb/source/API/SBPlatform.cpp index eeb56e9..15a6966 100644 --- a/lldb/source/API/SBPlatform.cpp +++ b/lldb/source/API/SBPlatform.cpp @@ -48,8 +48,7 @@ struct PlatformConnectOptions { // PlatformShellCommand struct PlatformShellCommand { PlatformShellCommand(llvm::StringRef shell_interpreter, - llvm::StringRef shell_command) - : m_status(0), m_signo(0) { + llvm::StringRef shell_command) { if (!shell_interpreter.empty()) m_shell = shell_interpreter.str(); diff --git a/lldb/source/API/SBQueue.cpp b/lldb/source/API/SBQueue.cpp index b2c143f..1aeede4 100644 --- a/lldb/source/API/SBQueue.cpp +++ b/lldb/source/API/SBQueue.cpp @@ -29,10 +29,7 @@ class QueueImpl { public: QueueImpl() {} - QueueImpl(const lldb::QueueSP &queue_sp) - : m_thread_list_fetched(false), m_pending_items_fetched(false) { - m_queue_wp = queue_sp; - } + QueueImpl(const lldb::QueueSP &queue_sp) { m_queue_wp = queue_sp; } QueueImpl(const QueueImpl &rhs) { if (&rhs == this) diff --git a/lldb/source/Commands/CommandObjectCommands.cpp b/lldb/source/Commands/CommandObjectCommands.cpp index a828ba1..7998c1f 100644 --- a/lldb/source/Commands/CommandObjectCommands.cpp +++ b/lldb/source/Commands/CommandObjectCommands.cpp @@ -1076,7 +1076,7 @@ public: std::string funct, std::string help, ScriptedCommandSynchronicity synch) : CommandObjectRaw(interpreter, name), m_function_name(funct), - m_synchro(synch), m_fetched_help_long(false) { + m_synchro(synch) { if (!help.empty()) SetHelp(help); else { @@ -1139,7 +1139,7 @@ protected: private: std::string m_function_name; ScriptedCommandSynchronicity m_synchro; - bool m_fetched_help_long; + bool m_fetched_help_long = false; }; class CommandObjectScriptingObject : public CommandObjectRaw { diff --git a/lldb/source/Commands/CommandObjectMemory.cpp b/lldb/source/Commands/CommandObjectMemory.cpp index fe33dfa..bb59fee 100644 --- a/lldb/source/Commands/CommandObjectMemory.cpp +++ b/lldb/source/Commands/CommandObjectMemory.cpp @@ -295,7 +295,6 @@ public: eCommandRequiresTarget | eCommandProcessMustBePaused), m_format_options(eFormatBytesWithASCII, 1, 8), - m_next_addr(LLDB_INVALID_ADDRESS), m_prev_byte_size(0), m_prev_format_options(eFormatBytesWithASCII, 1, 8) { CommandArgumentEntry arg1; CommandArgumentEntry arg2; @@ -877,8 +876,8 @@ protected: OptionGroupReadMemory m_memory_options; OptionGroupOutputFile m_outfile_options; OptionGroupValueObjectDisplay m_varobj_options; - lldb::addr_t m_next_addr; - lldb::addr_t m_prev_byte_size; + lldb::addr_t m_next_addr = LLDB_INVALID_ADDRESS; + lldb::addr_t m_prev_byte_size = 0; OptionGroupFormat m_prev_format_options; OptionGroupReadMemory m_prev_memory_options; OptionGroupOutputFile m_prev_outfile_options; @@ -986,7 +985,7 @@ protected: class ProcessMemoryIterator { public: ProcessMemoryIterator(ProcessSP process_sp, lldb::addr_t base) - : m_process_sp(process_sp), m_base_addr(base), m_is_valid(true) { + : m_process_sp(process_sp), m_base_addr(base) { lldbassert(process_sp.get() != nullptr); } @@ -1010,7 +1009,7 @@ protected: private: ProcessSP m_process_sp; lldb::addr_t m_base_addr; - bool m_is_valid; + bool m_is_valid = true; }; bool DoExecute(Args &command, CommandReturnObject &result) override { // No need to check "process" for validity as eCommandRequiresProcess @@ -1646,8 +1645,7 @@ public: "an address in the current target process.", "memory region ADDR", eCommandRequiresProcess | eCommandTryTargetAPILock | - eCommandProcessMustBeLaunched), - m_prev_end_addr(LLDB_INVALID_ADDRESS) {} + eCommandProcessMustBeLaunched) {} ~CommandObjectMemoryRegion() override = default; @@ -1757,7 +1755,7 @@ protected: return m_cmd_name; } - lldb::addr_t m_prev_end_addr; + lldb::addr_t m_prev_end_addr = LLDB_INVALID_ADDRESS; }; // CommandObjectMemory diff --git a/lldb/source/Commands/CommandObjectMemoryTag.cpp b/lldb/source/Commands/CommandObjectMemoryTag.cpp index d108cf58..3ad5774 100644 --- a/lldb/source/Commands/CommandObjectMemoryTag.cpp +++ b/lldb/source/Commands/CommandObjectMemoryTag.cpp @@ -138,7 +138,7 @@ class CommandObjectMemoryTagWrite : public CommandObjectParsed { public: class OptionGroupTagWrite : public OptionGroup { public: - OptionGroupTagWrite() : m_end_addr(LLDB_INVALID_ADDRESS) {} + OptionGroupTagWrite() {} ~OptionGroupTagWrite() override = default; @@ -168,7 +168,7 @@ public: m_end_addr = LLDB_INVALID_ADDRESS; } - lldb::addr_t m_end_addr; + lldb::addr_t m_end_addr = LLDB_INVALID_ADDRESS; }; CommandObjectMemoryTagWrite(CommandInterpreter &interpreter) diff --git a/lldb/source/Commands/CommandObjectProcess.cpp b/lldb/source/Commands/CommandObjectProcess.cpp index 459aef6..41410f5c 100644 --- a/lldb/source/Commands/CommandObjectProcess.cpp +++ b/lldb/source/Commands/CommandObjectProcess.cpp @@ -1214,7 +1214,7 @@ public: class CommandOptions : public Options { public: - CommandOptions() : m_requested_save_core_style(eSaveCoreUnspecified) {} + CommandOptions() {} ~CommandOptions() override = default; @@ -1250,7 +1250,7 @@ public: } // Instance variables to hold the values for command options. - SaveCoreStyle m_requested_save_core_style; + SaveCoreStyle m_requested_save_core_style = eSaveCoreUnspecified; std::string m_requested_plugin_name; }; diff --git a/lldb/source/Commands/CommandObjectThread.cpp b/lldb/source/Commands/CommandObjectThread.cpp index bd491e5..0ad3cc0 100644 --- a/lldb/source/Commands/CommandObjectThread.cpp +++ b/lldb/source/Commands/CommandObjectThread.cpp @@ -2184,8 +2184,7 @@ public: nullptr, eCommandRequiresProcess | eCommandTryTargetAPILock | eCommandProcessMustBeLaunched | eCommandProcessMustBePaused | - eCommandProcessMustBeTraced), - m_create_repeat_command_just_invoked(false) {} + eCommandProcessMustBeTraced) {} ~CommandObjectTraceDumpInstructions() override = default; @@ -2253,7 +2252,7 @@ protected: // Repeat command helpers std::string m_repeat_command; - bool m_create_repeat_command_just_invoked; + bool m_create_repeat_command_just_invoked = false; std::map<lldb::tid_t, std::unique_ptr<TraceInstructionDumper>> m_dumpers; }; diff --git a/lldb/source/Core/Address.cpp b/lldb/source/Core/Address.cpp index 0d4808a..b84e1ac 100644 --- a/lldb/source/Core/Address.cpp +++ b/lldb/source/Core/Address.cpp @@ -233,7 +233,7 @@ static size_t ReadCStringFromMemory(ExecutionContextScope *exe_scope, Address::Address(lldb::addr_t abs_addr) : m_section_wp(), m_offset(abs_addr) {} Address::Address(addr_t address, const SectionList *section_list) - : m_section_wp(), m_offset(LLDB_INVALID_ADDRESS) { + : m_section_wp() { ResolveAddressUsingFileSections(address, section_list); } diff --git a/lldb/source/Core/FormatEntity.cpp b/lldb/source/Core/FormatEntity.cpp index 2c5b1cc..6e7f44e 100644 --- a/lldb/source/Core/FormatEntity.cpp +++ b/lldb/source/Core/FormatEntity.cpp @@ -263,11 +263,10 @@ constexpr Definition g_root = Entry::DefinitionWithChildren( FormatEntity::Entry::Entry(llvm::StringRef s) : string(s.data(), s.size()), printf_format(), children(), - type(Type::String), fmt(lldb::eFormatDefault), number(0), deref(false) {} + type(Type::String) {} FormatEntity::Entry::Entry(char ch) - : string(1, ch), printf_format(), children(), type(Type::String), - fmt(lldb::eFormatDefault), number(0), deref(false) {} + : string(1, ch), printf_format(), children(), type(Type::String) {} void FormatEntity::Entry::AppendChar(char ch) { if (children.empty() || children.back().type != Entry::Type::String) diff --git a/lldb/source/Core/IOHandlerCursesGUI.cpp b/lldb/source/Core/IOHandlerCursesGUI.cpp index fd8cd51..7fbf382 100644 --- a/lldb/source/Core/IOHandlerCursesGUI.cpp +++ b/lldb/source/Core/IOHandlerCursesGUI.cpp @@ -341,7 +341,7 @@ public: protected: StringList m_text; - int m_first_visible_line; + int m_first_visible_line = 0; }; // A surface is an abstraction for something than can be drawn on. The surface @@ -352,7 +352,7 @@ class Surface { public: enum class Type { Window, Pad }; - Surface(Surface::Type type) : m_type(type), m_window(nullptr) {} + Surface(Surface::Type type) : m_type(type) {} WINDOW *get() { return m_window; } @@ -555,7 +555,7 @@ public: protected: Type m_type; - WINDOW *m_window; + WINDOW *m_window = nullptr; }; class Pad : public Surface { @@ -1076,8 +1076,7 @@ typedef std::unique_ptr<FieldDelegate> FieldDelegateUP; class TextFieldDelegate : public FieldDelegate { public: TextFieldDelegate(const char *label, const char *content, bool required) - : m_label(label), m_required(required), m_cursor_position(0), - m_first_visibile_char(0) { + : m_label(label), m_required(required) { if (content) m_content = content; } @@ -1325,9 +1324,9 @@ protected: std::string m_content; // The cursor position in the content string itself. Can be in the range // [0, GetContentLength()]. - int m_cursor_position; + int m_cursor_position = 0; // The index of the first visible character in the content. - int m_first_visibile_char; + int m_first_visibile_char = 0; // Optional error message. If empty, field is considered to have no error. std::string m_error; }; @@ -1515,7 +1514,7 @@ public: ChoicesFieldDelegate(const char *label, int number_of_visible_choices, std::vector<std::string> choices) : m_label(label), m_number_of_visible_choices(number_of_visible_choices), - m_choices(choices), m_choice(0), m_first_visibile_choice(0) {} + m_choices(choices) {} // Choices fields are drawn as titles boxses of a number of visible choices. // The rest of the choices become visible as the user scroll. The selected @@ -1623,9 +1622,9 @@ protected: int m_number_of_visible_choices; std::vector<std::string> m_choices; // The index of the selected choice. - int m_choice; + int m_choice = 0; // The index of the first visible choice in the field. - int m_first_visibile_choice; + int m_first_visibile_choice = 0; }; class PlatformPluginFieldDelegate : public ChoicesFieldDelegate { @@ -1707,7 +1706,7 @@ public: template <class T> class ListFieldDelegate : public FieldDelegate { public: ListFieldDelegate(const char *label, T default_field) - : m_label(label), m_default_field(default_field), m_selection_index(0), + : m_label(label), m_default_field(default_field), m_selection_type(SelectionType::NewButton) {} // Signify which element is selected. If a field or a remove button is @@ -2011,7 +2010,7 @@ protected: // created though a copy. T m_default_field; std::vector<T> m_fields; - int m_selection_index; + int m_selection_index = 0; // See SelectionType class enum. SelectionType m_selection_type; }; @@ -2465,9 +2464,7 @@ typedef std::shared_ptr<FormDelegate> FormDelegateSP; class FormWindowDelegate : public WindowDelegate { public: - FormWindowDelegate(FormDelegateSP &delegate_sp) - : m_delegate_sp(delegate_sp), m_selection_index(0), - m_first_visible_line(0) { + FormWindowDelegate(FormDelegateSP &delegate_sp) : m_delegate_sp(delegate_sp) { assert(m_delegate_sp->GetNumberOfActions() > 0); if (m_delegate_sp->GetNumberOfFields() > 0) m_selection_type = SelectionType::Field; @@ -2856,11 +2853,11 @@ public: protected: FormDelegateSP m_delegate_sp; // The index of the currently selected SelectionType. - int m_selection_index; + int m_selection_index = 0; // See SelectionType class enum. SelectionType m_selection_type; // The first visible line from the pad. - int m_first_visible_line; + int m_first_visible_line = 0; }; /////////////////////////// @@ -3670,8 +3667,7 @@ typedef std::shared_ptr<SearcherDelegate> SearcherDelegateSP; class SearcherWindowDelegate : public WindowDelegate { public: SearcherWindowDelegate(SearcherDelegateSP &delegate_sp) - : m_delegate_sp(delegate_sp), m_text_field("Search", "", false), - m_selected_match(0), m_first_visible_match(0) { + : m_delegate_sp(delegate_sp), m_text_field("Search", "", false) { ; } @@ -3811,9 +3807,9 @@ protected: SearcherDelegateSP m_delegate_sp; TextFieldDelegate m_text_field; // The index of the currently selected match. - int m_selected_match; + int m_selected_match = 0; // The index of the first visible match. - int m_first_visible_match; + int m_first_visible_match = 0; }; ////////////////////////////// @@ -4266,8 +4262,7 @@ HandleCharResult Menu::WindowDelegateHandleChar(Window &window, int key) { class Application { public: - Application(FILE *in, FILE *out) - : m_window_sp(), m_screen(nullptr), m_in(in), m_out(out) {} + Application(FILE *in, FILE *out) : m_window_sp(), m_in(in), m_out(out) {} ~Application() { m_window_delegates.clear(); @@ -4475,7 +4470,7 @@ public: protected: WindowSP m_window_sp; WindowDelegates m_window_delegates; - SCREEN *m_screen; + SCREEN *m_screen = nullptr; FILE *m_in; FILE *m_out; bool m_update_screen = false; @@ -4619,9 +4614,8 @@ typedef std::shared_ptr<TreeDelegate> TreeDelegateSP; class TreeItem { public: TreeItem(TreeItem *parent, TreeDelegate &delegate, bool might_have_children) - : m_parent(parent), m_delegate(delegate), m_user_data(nullptr), - m_identifier(0), m_row_idx(-1), m_children(), - m_might_have_children(might_have_children), m_is_expanded(false) { + : m_parent(parent), m_delegate(delegate), m_children(), + m_might_have_children(might_have_children) { if (m_parent == nullptr) m_is_expanded = m_delegate.TreeDelegateExpandRootByDefault(); } @@ -4816,23 +4810,21 @@ public: protected: TreeItem *m_parent; TreeDelegate &m_delegate; - void *m_user_data; - uint64_t m_identifier; + void *m_user_data = nullptr; + uint64_t m_identifier = 0; std::string m_text; - int m_row_idx; // Zero based visible row index, -1 if not visible or for the - // root item + int m_row_idx = -1; // Zero based visible row index, -1 if not visible or for + // the root item std::vector<TreeItem> m_children; bool m_might_have_children; - bool m_is_expanded; + bool m_is_expanded = false; }; class TreeWindowDelegate : public WindowDelegate { public: TreeWindowDelegate(Debugger &debugger, const TreeDelegateSP &delegate_sp) : m_debugger(debugger), m_delegate_sp(delegate_sp), - m_root(nullptr, *delegate_sp, true), m_selected_item(nullptr), - m_num_rows(0), m_selected_row_idx(0), m_first_visible_row(0), - m_min_x(0), m_min_y(0), m_max_x(0), m_max_y(0) {} + m_root(nullptr, *delegate_sp, true) {} int NumVisibleRows() const { return m_max_y - m_min_y; } @@ -4992,14 +4984,14 @@ protected: Debugger &m_debugger; TreeDelegateSP m_delegate_sp; TreeItem m_root; - TreeItem *m_selected_item; - int m_num_rows; - int m_selected_row_idx; - int m_first_visible_row; - int m_min_x; - int m_min_y; - int m_max_x; - int m_max_y; + TreeItem *m_selected_item = nullptr; + int m_num_rows = 0; + int m_selected_row_idx = 0; + int m_first_visible_row = 0; + int m_min_x = 0; + int m_min_y = 0; + int m_max_x = 0; + int m_max_y = 0; }; // A tree delegate that just draws the text member of the tree item, it doesn't @@ -5071,8 +5063,7 @@ protected: class ThreadTreeDelegate : public TreeDelegate { public: ThreadTreeDelegate(Debugger &debugger) - : TreeDelegate(), m_debugger(debugger), m_tid(LLDB_INVALID_THREAD_ID), - m_stop_id(UINT32_MAX) { + : TreeDelegate(), m_debugger(debugger) { FormatEntity::Parse("thread #${thread.index}: tid = ${thread.id}{, stop " "reason = ${thread.stop-reason}}", m_format); @@ -5161,16 +5152,15 @@ public: protected: Debugger &m_debugger; std::shared_ptr<FrameTreeDelegate> m_frame_delegate_sp; - lldb::user_id_t m_tid; - uint32_t m_stop_id; + lldb::user_id_t m_tid = LLDB_INVALID_THREAD_ID; + uint32_t m_stop_id = UINT32_MAX; FormatEntity::Entry m_format; }; class ThreadsTreeDelegate : public TreeDelegate { public: ThreadsTreeDelegate(Debugger &debugger) - : TreeDelegate(), m_thread_delegate_sp(), m_debugger(debugger), - m_stop_id(UINT32_MAX), m_update_selection(false) { + : TreeDelegate(), m_thread_delegate_sp(), m_debugger(debugger) { FormatEntity::Parse("process ${process.id}{, name = ${process.name}}", m_format); } @@ -5280,8 +5270,8 @@ public: protected: std::shared_ptr<ThreadTreeDelegate> m_thread_delegate_sp; Debugger &m_debugger; - uint32_t m_stop_id; - bool m_update_selection; + uint32_t m_stop_id = UINT32_MAX; + bool m_update_selection = false; FormatEntity::Entry m_format; }; @@ -5523,9 +5513,7 @@ class ValueObjectListDelegate : public WindowDelegate { public: ValueObjectListDelegate() : m_rows() {} - ValueObjectListDelegate(ValueObjectList &valobj_list) - : m_rows(), m_selected_row(nullptr), m_selected_row_idx(0), - m_first_visible_row(0), m_num_rows(0), m_max_x(0), m_max_y(0) { + ValueObjectListDelegate(ValueObjectList &valobj_list) : m_rows() { SetValues(valobj_list); } @@ -5882,8 +5870,7 @@ protected: class FrameVariablesWindowDelegate : public ValueObjectListDelegate { public: FrameVariablesWindowDelegate(Debugger &debugger) - : ValueObjectListDelegate(), m_debugger(debugger), - m_frame_block(nullptr) {} + : ValueObjectListDelegate(), m_debugger(debugger) {} ~FrameVariablesWindowDelegate() override = default; @@ -5944,7 +5931,7 @@ public: protected: Debugger &m_debugger; - Block *m_frame_block; + Block *m_frame_block = nullptr; }; class RegistersWindowDelegate : public ValueObjectListDelegate { @@ -6198,7 +6185,7 @@ static const char *CursesKeyToCString(int ch) { HelpDialogDelegate::HelpDialogDelegate(const char *text, KeyHelp *key_help_array) - : m_text(), m_first_visible_line(0) { + : m_text() { if (text && text[0]) { m_text.SplitIntoLines(text); m_text.AppendString(""); @@ -6762,11 +6749,7 @@ class SourceFileWindowDelegate : public WindowDelegate { public: SourceFileWindowDelegate(Debugger &debugger) : WindowDelegate(), m_debugger(debugger), m_sc(), m_file_sp(), - m_disassembly_scope(nullptr), m_disassembly_sp(), m_disassembly_range(), - m_title(), m_tid(LLDB_INVALID_THREAD_ID), m_line_width(4), - m_selected_line(0), m_pc_line(0), m_stop_id(0), m_frame_idx(UINT32_MAX), - m_first_visible_line(0), m_first_visible_column(0), m_min_x(0), - m_min_y(0), m_max_x(0), m_max_y(0) {} + m_disassembly_sp(), m_disassembly_range(), m_title() {} ~SourceFileWindowDelegate() override = default; @@ -7524,22 +7507,22 @@ protected: Debugger &m_debugger; SymbolContext m_sc; SourceManager::FileSP m_file_sp; - SymbolContextScope *m_disassembly_scope; + SymbolContextScope *m_disassembly_scope = nullptr; lldb::DisassemblerSP m_disassembly_sp; AddressRange m_disassembly_range; StreamString m_title; - lldb::user_id_t m_tid; - int m_line_width; - uint32_t m_selected_line; // The selected line - uint32_t m_pc_line; // The line with the PC - uint32_t m_stop_id; - uint32_t m_frame_idx; - int m_first_visible_line; - int m_first_visible_column; - int m_min_x; - int m_min_y; - int m_max_x; - int m_max_y; + lldb::user_id_t m_tid = LLDB_INVALID_THREAD_ID; + int m_line_width = 4; + uint32_t m_selected_line = 0; // The selected line + uint32_t m_pc_line = 0; // The line with the PC + uint32_t m_stop_id = 0; + uint32_t m_frame_idx = UINT32_MAX; + int m_first_visible_line = 0; + int m_first_visible_column = 0; + int m_min_x = 0; + int m_min_y = 0; + int m_max_x = 0; + int m_max_y = 0; }; DisplayOptions ValueObjectListDelegate::g_options = {true}; diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp index 7d24595..8dbbac7 100644 --- a/lldb/source/Core/Module.cpp +++ b/lldb/source/Core/Module.cpp @@ -129,8 +129,7 @@ Module *Module::GetAllocatedModuleAtIndex(size_t idx) { } Module::Module(const ModuleSpec &module_spec) - : m_object_offset(0), m_file_has_changed(false), - m_first_file_changed_log(false) { + : m_file_has_changed(false), m_first_file_changed_log(false) { // Scope for locker below... { std::lock_guard<std::recursive_mutex> guard( @@ -636,9 +635,7 @@ void Module::FindCompileUnits(const FileSpec &path, Module::LookupInfo::LookupInfo(ConstString name, FunctionNameType name_type_mask, LanguageType language) - : m_name(name), m_lookup_name(), m_language(language), - m_name_type_mask(eFunctionNameTypeNone), - m_match_name_after_lookup(false) { + : m_name(name), m_lookup_name(), m_language(language) { const char *name_cstr = name.GetCString(); llvm::StringRef basename; llvm::StringRef context; diff --git a/lldb/source/Core/ModuleList.cpp b/lldb/source/Core/ModuleList.cpp index 620ca93..e30764f 100644 --- a/lldb/source/Core/ModuleList.cpp +++ b/lldb/source/Core/ModuleList.cpp @@ -182,8 +182,7 @@ PathMappingList ModuleListProperties::GetSymlinkMappings() const { ModuleList::ModuleList() : m_modules(), m_modules_mutex() {} -ModuleList::ModuleList(const ModuleList &rhs) - : m_modules(), m_modules_mutex(), m_notifier(nullptr) { +ModuleList::ModuleList(const ModuleList &rhs) : m_modules(), m_modules_mutex() { std::lock_guard<std::recursive_mutex> lhs_guard(m_modules_mutex); std::lock_guard<std::recursive_mutex> rhs_guard(rhs.m_modules_mutex); m_modules = rhs.m_modules; diff --git a/lldb/source/Core/Value.cpp b/lldb/source/Core/Value.cpp index fb57c0f..2dec337 100644 --- a/lldb/source/Core/Value.cpp +++ b/lldb/source/Core/Value.cpp @@ -41,13 +41,10 @@ using namespace lldb_private; Value::Value() : m_value(), m_compiler_type(), m_data_buffer() {} Value::Value(const Scalar &scalar) - : m_value(scalar), m_compiler_type(), m_context(nullptr), - m_value_type(ValueType::Scalar), m_context_type(ContextType::Invalid), - m_data_buffer() {} + : m_value(scalar), m_compiler_type(), m_data_buffer() {} Value::Value(const void *bytes, int len) - : m_value(), m_compiler_type(), m_context(nullptr), - m_value_type(ValueType::HostAddress), m_context_type(ContextType::Invalid), + : m_value(), m_compiler_type(), m_value_type(ValueType::HostAddress), m_data_buffer() { SetBytes(bytes, len); } diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp index 8af7c3f..ddc2c32 100644 --- a/lldb/source/Core/ValueObject.cpp +++ b/lldb/source/Core/ValueObject.cpp @@ -2803,7 +2803,7 @@ ValueObject::EvaluationPoint::EvaluationPoint() : m_mod_id(), m_exe_ctx_ref() {} ValueObject::EvaluationPoint::EvaluationPoint(ExecutionContextScope *exe_scope, bool use_selected) - : m_mod_id(), m_exe_ctx_ref(), m_needs_update(true) { + : m_mod_id(), m_exe_ctx_ref() { ExecutionContext exe_ctx(exe_scope); TargetSP target_sp(exe_ctx.GetTargetSP()); if (target_sp) { @@ -2840,7 +2840,7 @@ ValueObject::EvaluationPoint::EvaluationPoint(ExecutionContextScope *exe_scope, ValueObject::EvaluationPoint::EvaluationPoint( const ValueObject::EvaluationPoint &rhs) - : m_mod_id(), m_exe_ctx_ref(rhs.m_exe_ctx_ref), m_needs_update(true) {} + : m_mod_id(), m_exe_ctx_ref(rhs.m_exe_ctx_ref) {} ValueObject::EvaluationPoint::~EvaluationPoint() = default; diff --git a/lldb/source/DataFormatters/VectorType.cpp b/lldb/source/DataFormatters/VectorType.cpp index 1137191..e35ed88 100644 --- a/lldb/source/DataFormatters/VectorType.cpp +++ b/lldb/source/DataFormatters/VectorType.cpp @@ -189,8 +189,7 @@ namespace formatters { class VectorTypeSyntheticFrontEnd : public SyntheticChildrenFrontEnd { public: VectorTypeSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp) - : SyntheticChildrenFrontEnd(*valobj_sp), m_parent_format(eFormatInvalid), - m_item_format(eFormatInvalid), m_child_type(), m_num_children(0) {} + : SyntheticChildrenFrontEnd(*valobj_sp), m_child_type() {} ~VectorTypeSyntheticFrontEnd() override = default; @@ -238,10 +237,10 @@ public: } private: - lldb::Format m_parent_format; - lldb::Format m_item_format; + lldb::Format m_parent_format = eFormatInvalid; + lldb::Format m_item_format = eFormatInvalid; CompilerType m_child_type; - size_t m_num_children; + size_t m_num_children = 0; }; } // namespace formatters diff --git a/lldb/source/Expression/DWARFExpression.cpp b/lldb/source/Expression/DWARFExpression.cpp index 7c99743..8fa8248 100644 --- a/lldb/source/Expression/DWARFExpression.cpp +++ b/lldb/source/Expression/DWARFExpression.cpp @@ -64,8 +64,7 @@ DWARFExpression::DWARFExpression() : m_module_wp(), m_data() {} DWARFExpression::DWARFExpression(lldb::ModuleSP module_sp, const DataExtractor &data, const DWARFUnit *dwarf_cu) - : m_module_wp(), m_data(data), m_dwarf_cu(dwarf_cu), - m_reg_kind(eRegisterKindDWARF) { + : m_module_wp(), m_data(data), m_dwarf_cu(dwarf_cu) { if (module_sp) m_module_wp = module_sp; } diff --git a/lldb/source/Expression/IRInterpreter.cpp b/lldb/source/Expression/IRInterpreter.cpp index 42da0e1..a6efeb3 100644 --- a/lldb/source/Expression/IRInterpreter.cpp +++ b/lldb/source/Expression/IRInterpreter.cpp @@ -97,8 +97,8 @@ public: ValueMap m_values; DataLayout &m_target_data; lldb_private::IRExecutionUnit &m_execution_unit; - const BasicBlock *m_bb; - const BasicBlock *m_prev_bb; + const BasicBlock *m_bb = nullptr; + const BasicBlock *m_prev_bb = nullptr; BasicBlock::const_iterator m_ii; BasicBlock::const_iterator m_ie; @@ -113,8 +113,7 @@ public: lldb_private::IRExecutionUnit &execution_unit, lldb::addr_t stack_frame_bottom, lldb::addr_t stack_frame_top) - : m_target_data(target_data), m_execution_unit(execution_unit), - m_bb(nullptr), m_prev_bb(nullptr) { + : m_target_data(target_data), m_execution_unit(execution_unit) { m_byte_order = (target_data.isLittleEndian() ? lldb::eByteOrderLittle : lldb::eByteOrderBig); m_addr_byte_size = (target_data.getPointerSize(0)); diff --git a/lldb/source/Expression/Materializer.cpp b/lldb/source/Expression/Materializer.cpp index e0a91e5..feabfd4 100644 --- a/lldb/source/Expression/Materializer.cpp +++ b/lldb/source/Expression/Materializer.cpp @@ -413,9 +413,7 @@ uint32_t Materializer::AddPersistentVariable( class EntityVariable : public Materializer::Entity { public: EntityVariable(lldb::VariableSP &variable_sp) - : Entity(), m_variable_sp(variable_sp), m_is_reference(false), - m_temporary_allocation(LLDB_INVALID_ADDRESS), - m_temporary_allocation_size(0) { + : Entity(), m_variable_sp(variable_sp) { // Hard-coding to maximum size of a pointer since all variables are // materialized by reference m_size = 8; @@ -749,9 +747,9 @@ public: private: lldb::VariableSP m_variable_sp; - bool m_is_reference; - lldb::addr_t m_temporary_allocation; - size_t m_temporary_allocation_size; + bool m_is_reference = false; + lldb::addr_t m_temporary_allocation = LLDB_INVALID_ADDRESS; + size_t m_temporary_allocation_size = 0; lldb::DataBufferSP m_original_data; }; @@ -769,9 +767,7 @@ public: bool keep_in_memory, Materializer::PersistentVariableDelegate *delegate) : Entity(), m_type(type), m_is_program_reference(is_program_reference), - m_keep_in_memory(keep_in_memory), - m_temporary_allocation(LLDB_INVALID_ADDRESS), - m_temporary_allocation_size(0), m_delegate(delegate) { + m_keep_in_memory(keep_in_memory), m_delegate(delegate) { // Hard-coding to maximum size of a pointer since all results are // materialized by reference m_size = 8; @@ -1030,8 +1026,8 @@ private: bool m_is_program_reference; bool m_keep_in_memory; - lldb::addr_t m_temporary_allocation; - size_t m_temporary_allocation_size; + lldb::addr_t m_temporary_allocation = LLDB_INVALID_ADDRESS; + size_t m_temporary_allocation_size = 0; Materializer::PersistentVariableDelegate *m_delegate; }; diff --git a/lldb/source/Host/common/HostNativeThreadBase.cpp b/lldb/source/Host/common/HostNativeThreadBase.cpp index 5814a7f..a9cbb69 100644 --- a/lldb/source/Host/common/HostNativeThreadBase.cpp +++ b/lldb/source/Host/common/HostNativeThreadBase.cpp @@ -19,7 +19,7 @@ using namespace lldb; using namespace lldb_private; HostNativeThreadBase::HostNativeThreadBase(thread_t thread) - : m_thread(thread), m_result(0) {} // NOLINT(modernize-use-nullptr) + : m_thread(thread) {} lldb::thread_t HostNativeThreadBase::GetSystemHandle() const { return m_thread; diff --git a/lldb/source/Host/common/ProcessLaunchInfo.cpp b/lldb/source/Host/common/ProcessLaunchInfo.cpp index 3613eae..b882799 100644 --- a/lldb/source/Host/common/ProcessLaunchInfo.cpp +++ b/lldb/source/Host/common/ProcessLaunchInfo.cpp @@ -41,7 +41,7 @@ ProcessLaunchInfo::ProcessLaunchInfo(const FileSpec &stdin_file_spec, const FileSpec &working_directory, uint32_t launch_flags) : ProcessInfo(), m_working_dir(), m_plugin_name(), m_flags(launch_flags), - m_file_actions(), m_pty(new PseudoTerminal), m_resume_count(0), + m_file_actions(), m_pty(new PseudoTerminal), m_scripted_process_class_name(), m_scripted_process_dictionary_sp() { if (stdin_file_spec) { FileAction file_action; diff --git a/lldb/source/Interpreter/OptionValueFileColonLine.cpp b/lldb/source/Interpreter/OptionValueFileColonLine.cpp index fb0b516..e500005 100644 --- a/lldb/source/Interpreter/OptionValueFileColonLine.cpp +++ b/lldb/source/Interpreter/OptionValueFileColonLine.cpp @@ -24,9 +24,8 @@ using namespace lldb_private; OptionValueFileColonLine::OptionValueFileColonLine() = default; OptionValueFileColonLine::OptionValueFileColonLine(llvm::StringRef input) - : m_line_number(LLDB_INVALID_LINE_NUMBER), - m_column_number(LLDB_INVALID_COLUMN_NUMBER), - m_completion_mask(CommandCompletions::eSourceFileCompletion) { + +{ SetValueFromString(input, eVarSetOperationAssign); } diff --git a/lldb/source/Interpreter/OptionValueFileSpec.cpp b/lldb/source/Interpreter/OptionValueFileSpec.cpp index 3987a36..f35a6b8 100644 --- a/lldb/source/Interpreter/OptionValueFileSpec.cpp +++ b/lldb/source/Interpreter/OptionValueFileSpec.cpp @@ -22,14 +22,14 @@ OptionValueFileSpec::OptionValueFileSpec(bool resolve) : m_resolve(resolve) {} OptionValueFileSpec::OptionValueFileSpec(const FileSpec &value, bool resolve) : m_current_value(value), m_default_value(value), - m_completion_mask(CommandCompletions::eDiskFileCompletion), + m_resolve(resolve) {} OptionValueFileSpec::OptionValueFileSpec(const FileSpec ¤t_value, const FileSpec &default_value, bool resolve) : m_current_value(current_value), m_default_value(default_value), - m_completion_mask(CommandCompletions::eDiskFileCompletion), + m_resolve(resolve) {} void OptionValueFileSpec::DumpValue(const ExecutionContext *exe_ctx, diff --git a/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp b/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp index ee6ae3f..2777f77 100644 --- a/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp +++ b/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp @@ -90,8 +90,7 @@ public: AddressClass addr_class) : Instruction(address, addr_class), m_disasm_wp(std::static_pointer_cast<DisassemblerLLVMC>( - disasm.shared_from_this())), - m_using_file_addr(false) {} + disasm.shared_from_this())) {} ~InstructionLLVMC() override = default; @@ -822,7 +821,7 @@ protected: std::weak_ptr<DisassemblerLLVMC> m_disasm_wp; bool m_is_valid = false; - bool m_using_file_addr; + bool m_using_file_addr = false; bool m_has_visited_instruction = false; // Be conservative. If we didn't understand the instruction, say it: diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp index 977a461..5168f63 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp @@ -88,8 +88,7 @@ class AddMacroState { public: AddMacroState(const FileSpec ¤t_file, const uint32_t current_file_line) - : m_state(CURRENT_FILE_NOT_YET_PUSHED), m_current_file(current_file), - m_current_file_line(current_file_line) {} + : m_current_file(current_file), m_current_file_line(current_file_line) {} void StartFile(const FileSpec &file) { m_file_stack.push_back(file); @@ -127,7 +126,7 @@ public: private: std::vector<FileSpec> m_file_stack; - State m_state; + State m_state = CURRENT_FILE_NOT_YET_PUSHED; FileSpec m_current_file; uint32_t m_current_file_line; }; diff --git a/lldb/source/Plugins/ExpressionParser/Clang/IRDynamicChecks.cpp b/lldb/source/Plugins/ExpressionParser/Clang/IRDynamicChecks.cpp index 4b7ba57..0a4af19 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/IRDynamicChecks.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/IRDynamicChecks.cpp @@ -137,8 +137,7 @@ public: /// The module being instrumented. Instrumenter(llvm::Module &module, std::shared_ptr<UtilityFunction> checker_function) - : m_module(module), m_checker_function(checker_function), - m_i8ptr_ty(nullptr), m_intptr_ty(nullptr) {} + : m_module(module), m_checker_function(checker_function) {} virtual ~Instrumenter() = default; @@ -302,8 +301,8 @@ protected: m_checker_function; ///< The dynamic checker function for the process private: - PointerType *m_i8ptr_ty; - IntegerType *m_intptr_ty; + PointerType *m_i8ptr_ty = nullptr; + IntegerType *m_intptr_ty = nullptr; }; class ValidPointerChecker : public Instrumenter { diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxAtomic.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxAtomic.cpp index 45d4322..4eec79a 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxAtomic.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxAtomic.cpp @@ -102,14 +102,14 @@ public: size_t GetIndexOfChildWithName(ConstString name) override; private: - ValueObject *m_real_child; + ValueObject *m_real_child = nullptr; }; } // namespace formatters } // namespace lldb_private lldb_private::formatters::LibcxxStdAtomicSyntheticFrontEnd:: LibcxxStdAtomicSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp) - : SyntheticChildrenFrontEnd(*valobj_sp), m_real_child(nullptr) {} + : SyntheticChildrenFrontEnd(*valobj_sp) {} bool lldb_private::formatters::LibcxxStdAtomicSyntheticFrontEnd::Update() { ValueObjectSP atomic_value = GetLibCxxAtomicValue(m_backend); diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxInitializerList.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxInitializerList.cpp index 94ab014..d3be56e3 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxInitializerList.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxInitializerList.cpp @@ -36,18 +36,17 @@ public: size_t GetIndexOfChildWithName(ConstString name) override; private: - ValueObject *m_start; + ValueObject *m_start = nullptr; CompilerType m_element_type; - uint32_t m_element_size; - size_t m_num_elements; + uint32_t m_element_size = 0; + size_t m_num_elements = 0; }; } // namespace formatters } // namespace lldb_private lldb_private::formatters::LibcxxInitializerListSyntheticFrontEnd:: LibcxxInitializerListSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp) - : SyntheticChildrenFrontEnd(*valobj_sp), m_start(nullptr), m_element_type(), - m_element_size(0), m_num_elements(0) { + : SyntheticChildrenFrontEnd(*valobj_sp), m_element_type() { if (valobj_sp) Update(); } diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp index 47c6634..9f5624d 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp @@ -158,8 +158,8 @@ public: bool Update() override; private: - lldb::addr_t m_node_address; - ValueObject *m_tail; + lldb::addr_t m_node_address = 0; + ValueObject *m_tail = nullptr; }; } // end anonymous namespace @@ -308,7 +308,7 @@ bool ForwardListFrontEnd::Update() { } ListFrontEnd::ListFrontEnd(lldb::ValueObjectSP valobj_sp) - : AbstractListFrontEnd(*valobj_sp), m_node_address(), m_tail(nullptr) { + : AbstractListFrontEnd(*valobj_sp) { if (valobj_sp) Update(); } diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp index d3c0bd2e..4aae524 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp @@ -192,11 +192,11 @@ private: void GetValueOffset(const lldb::ValueObjectSP &node); - ValueObject *m_tree; - ValueObject *m_root_node; + ValueObject *m_tree = nullptr; + ValueObject *m_root_node = nullptr; CompilerType m_element_type; - uint32_t m_skip_size; - size_t m_count; + uint32_t m_skip_size = UINT32_MAX; + size_t m_count = UINT32_MAX; std::map<size_t, MapIterator> m_iterators; }; } // namespace formatters @@ -204,9 +204,7 @@ private: lldb_private::formatters::LibcxxStdMapSyntheticFrontEnd:: LibcxxStdMapSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp) - : SyntheticChildrenFrontEnd(*valobj_sp), m_tree(nullptr), - m_root_node(nullptr), m_element_type(), m_skip_size(UINT32_MAX), - m_count(UINT32_MAX), m_iterators() { + : SyntheticChildrenFrontEnd(*valobj_sp), m_element_type(), m_iterators() { if (valobj_sp) Update(); } diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp index 57c5ba8..85c04ea 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp @@ -44,9 +44,9 @@ public: private: CompilerType m_element_type; CompilerType m_node_type; - ValueObject *m_tree; - size_t m_num_elements; - ValueObject *m_next_element; + ValueObject *m_tree = nullptr; + size_t m_num_elements = 0; + ValueObject *m_next_element = nullptr; std::vector<std::pair<ValueObject *, uint64_t>> m_elements_cache; }; } // namespace formatters @@ -54,8 +54,8 @@ private: lldb_private::formatters::LibcxxStdUnorderedMapSyntheticFrontEnd:: LibcxxStdUnorderedMapSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp) - : SyntheticChildrenFrontEnd(*valobj_sp), m_element_type(), m_tree(nullptr), - m_num_elements(0), m_next_element(nullptr), m_elements_cache() { + : SyntheticChildrenFrontEnd(*valobj_sp), m_element_type(), + m_elements_cache() { if (valobj_sp) Update(); } diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp index 43f76b0..81eae93 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp @@ -35,10 +35,10 @@ public: size_t GetIndexOfChildWithName(ConstString name) override; private: - ValueObject *m_start; - ValueObject *m_finish; + ValueObject *m_start = nullptr; + ValueObject *m_finish = nullptr; CompilerType m_element_type; - uint32_t m_element_size; + uint32_t m_element_size = 0; }; class LibcxxVectorBoolSyntheticFrontEnd : public SyntheticChildrenFrontEnd { @@ -58,8 +58,8 @@ public: private: CompilerType m_bool_type; ExecutionContextRef m_exe_ctx_ref; - uint64_t m_count; - lldb::addr_t m_base_data_address; + uint64_t m_count = 0; + lldb::addr_t m_base_data_address = 0; std::map<size_t, lldb::ValueObjectSP> m_children; }; @@ -68,8 +68,7 @@ private: lldb_private::formatters::LibcxxStdVectorSyntheticFrontEnd:: LibcxxStdVectorSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp) - : SyntheticChildrenFrontEnd(*valobj_sp), m_start(nullptr), - m_finish(nullptr), m_element_type(), m_element_size(0) { + : SyntheticChildrenFrontEnd(*valobj_sp), m_element_type() { if (valobj_sp) Update(); } @@ -173,7 +172,7 @@ size_t lldb_private::formatters::LibcxxStdVectorSyntheticFrontEnd:: lldb_private::formatters::LibcxxVectorBoolSyntheticFrontEnd:: LibcxxVectorBoolSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp) : SyntheticChildrenFrontEnd(*valobj_sp), m_bool_type(), m_exe_ctx_ref(), - m_count(0), m_base_data_address(0), m_children() { + m_children() { if (valobj_sp) { Update(); m_bool_type = diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp index 9e248d1..d862364 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp @@ -53,7 +53,7 @@ public: private: ExecutionContextRef m_exe_ctx_ref; - lldb::addr_t m_pair_address; + lldb::addr_t m_pair_address = 0; CompilerType m_pair_type; lldb::ValueObjectSP m_pair_sp; }; @@ -77,8 +77,8 @@ public: LibstdcppMapIteratorSyntheticFrontEnd::LibstdcppMapIteratorSyntheticFrontEnd( lldb::ValueObjectSP valobj_sp) - : SyntheticChildrenFrontEnd(*valobj_sp), m_exe_ctx_ref(), m_pair_address(0), - m_pair_type(), m_pair_sp() { + : SyntheticChildrenFrontEnd(*valobj_sp), m_exe_ctx_ref(), m_pair_type(), + m_pair_sp() { if (valobj_sp) Update(); } diff --git a/lldb/source/Plugins/Language/ObjC/NSArray.cpp b/lldb/source/Plugins/Language/ObjC/NSArray.cpp index f18b59f..adda04e 100644 --- a/lldb/source/Plugins/Language/ObjC/NSArray.cpp +++ b/lldb/source/Plugins/Language/ObjC/NSArray.cpp @@ -70,7 +70,7 @@ protected: virtual uint64_t GetSize() = 0; ExecutionContextRef m_exe_ctx_ref; - uint8_t m_ptr_size; + uint8_t m_ptr_size = 8; CompilerType m_id_type; }; @@ -226,7 +226,7 @@ public: private: ExecutionContextRef m_exe_ctx_ref; - uint8_t m_ptr_size; + uint8_t m_ptr_size = 8; D32 *m_data_32; D64 *m_data_64; @@ -459,10 +459,9 @@ bool lldb_private::formatters::NSArraySummaryProvider( return true; } -lldb_private::formatters::NSArrayMSyntheticFrontEndBase::NSArrayMSyntheticFrontEndBase( - lldb::ValueObjectSP valobj_sp) - : SyntheticChildrenFrontEnd(*valobj_sp), m_exe_ctx_ref(), m_ptr_size(8), - m_id_type() { +lldb_private::formatters::NSArrayMSyntheticFrontEndBase:: + NSArrayMSyntheticFrontEndBase(lldb::ValueObjectSP valobj_sp) + : SyntheticChildrenFrontEnd(*valobj_sp), m_exe_ctx_ref(), m_id_type() { if (valobj_sp) { auto *clang_ast_context = ScratchTypeSystemClang::GetForTarget( *valobj_sp->GetExecutionContextRef().GetTargetSP()); @@ -605,9 +604,8 @@ lldb_private::formatters:: template <typename D32, typename D64, bool Inline> lldb_private::formatters::GenericNSArrayISyntheticFrontEnd<D32, D64, Inline>:: - GenericNSArrayISyntheticFrontEnd( - lldb::ValueObjectSP valobj_sp) - : SyntheticChildrenFrontEnd(*valobj_sp), m_exe_ctx_ref(), m_ptr_size(8), + GenericNSArrayISyntheticFrontEnd(lldb::ValueObjectSP valobj_sp) + : SyntheticChildrenFrontEnd(*valobj_sp), m_exe_ctx_ref(), m_data_32(nullptr), m_data_64(nullptr) { if (valobj_sp) { CompilerType type = valobj_sp->GetCompilerType(); diff --git a/lldb/source/Plugins/Language/ObjC/NSDictionary.cpp b/lldb/source/Plugins/Language/ObjC/NSDictionary.cpp index 704e2bc..cde925d 100644 --- a/lldb/source/Plugins/Language/ObjC/NSDictionary.cpp +++ b/lldb/source/Plugins/Language/ObjC/NSDictionary.cpp @@ -133,10 +133,10 @@ private: }; ExecutionContextRef m_exe_ctx_ref; - uint8_t m_ptr_size; - lldb::ByteOrder m_order; - DataDescriptor_32 *m_data_32; - DataDescriptor_64 *m_data_64; + uint8_t m_ptr_size = 8; + lldb::ByteOrder m_order = lldb::eByteOrderInvalid; + DataDescriptor_32 *m_data_32 = nullptr; + DataDescriptor_64 *m_data_64 = nullptr; lldb::addr_t m_data_ptr; CompilerType m_pair_type; std::vector<DictionaryItemDescriptor> m_children; @@ -196,8 +196,8 @@ private: }; ExecutionContextRef m_exe_ctx_ref; - uint8_t m_ptr_size; - lldb::ByteOrder m_order; + uint8_t m_ptr_size = 8; + lldb::ByteOrder m_order = lldb::eByteOrderInvalid; CFBasicHash m_hashtable; @@ -250,8 +250,8 @@ private: }; ExecutionContextRef m_exe_ctx_ref; - uint8_t m_ptr_size; - lldb::ByteOrder m_order; + uint8_t m_ptr_size = 8; + lldb::ByteOrder m_order = lldb::eByteOrderInvalid; D32 *m_data_32; D64 *m_data_64; CompilerType m_pair_type; @@ -301,10 +301,10 @@ namespace Foundation1100 { }; ExecutionContextRef m_exe_ctx_ref; - uint8_t m_ptr_size; - lldb::ByteOrder m_order; - DataDescriptor_32 *m_data_32; - DataDescriptor_64 *m_data_64; + uint8_t m_ptr_size = 8; + lldb::ByteOrder m_order = lldb::eByteOrderInvalid; + DataDescriptor_32 *m_data_32 = nullptr; + DataDescriptor_64 *m_data_64 = nullptr; CompilerType m_pair_type; std::vector<DictionaryItemDescriptor> m_children; }; @@ -592,9 +592,7 @@ lldb_private::formatters::NSDictionarySyntheticFrontEndCreator( lldb_private::formatters::NSDictionaryISyntheticFrontEnd:: NSDictionaryISyntheticFrontEnd(lldb::ValueObjectSP valobj_sp) - : SyntheticChildrenFrontEnd(*valobj_sp), m_exe_ctx_ref(), m_ptr_size(8), - m_order(lldb::eByteOrderInvalid), m_data_32(nullptr), m_data_64(nullptr), - m_pair_type() {} + : SyntheticChildrenFrontEnd(*valobj_sp), m_exe_ctx_ref(), m_pair_type() {} lldb_private::formatters::NSDictionaryISyntheticFrontEnd:: ~NSDictionaryISyntheticFrontEnd() { @@ -738,8 +736,8 @@ lldb_private::formatters::NSDictionaryISyntheticFrontEnd::GetChildAtIndex( lldb_private::formatters::NSCFDictionarySyntheticFrontEnd:: NSCFDictionarySyntheticFrontEnd(lldb::ValueObjectSP valobj_sp) - : SyntheticChildrenFrontEnd(*valobj_sp), m_exe_ctx_ref(), m_ptr_size(8), - m_order(lldb::eByteOrderInvalid), m_hashtable(), m_pair_type() {} + : SyntheticChildrenFrontEnd(*valobj_sp), m_exe_ctx_ref(), m_hashtable(), + m_pair_type() {} size_t lldb_private::formatters::NSCFDictionarySyntheticFrontEnd:: GetIndexOfChildWithName(ConstString name) { @@ -1060,11 +1058,10 @@ lldb_private::formatters::NSDictionary1SyntheticFrontEnd::GetChildAtIndex( } template <typename D32, typename D64> -lldb_private::formatters::GenericNSDictionaryMSyntheticFrontEnd<D32,D64>:: +lldb_private::formatters::GenericNSDictionaryMSyntheticFrontEnd<D32, D64>:: GenericNSDictionaryMSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp) - : SyntheticChildrenFrontEnd(*valobj_sp), m_exe_ctx_ref(), m_ptr_size(8), - m_order(lldb::eByteOrderInvalid), m_data_32(nullptr), m_data_64(nullptr), - m_pair_type() {} + : SyntheticChildrenFrontEnd(*valobj_sp), m_exe_ctx_ref(), + m_data_32(nullptr), m_data_64(nullptr), m_pair_type() {} template <typename D32, typename D64> lldb_private::formatters::GenericNSDictionaryMSyntheticFrontEnd<D32,D64>:: @@ -1227,12 +1224,9 @@ lldb_private::formatters::GenericNSDictionaryMSyntheticFrontEnd< return dict_item.valobj_sp; } -lldb_private::formatters::Foundation1100:: - NSDictionaryMSyntheticFrontEnd:: +lldb_private::formatters::Foundation1100::NSDictionaryMSyntheticFrontEnd:: NSDictionaryMSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp) - : SyntheticChildrenFrontEnd(*valobj_sp), m_exe_ctx_ref(), m_ptr_size(8), - m_order(lldb::eByteOrderInvalid), m_data_32(nullptr), m_data_64(nullptr), - m_pair_type() {} + : SyntheticChildrenFrontEnd(*valobj_sp), m_exe_ctx_ref(), m_pair_type() {} lldb_private::formatters::Foundation1100:: NSDictionaryMSyntheticFrontEnd::~NSDictionaryMSyntheticFrontEnd() { diff --git a/lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp b/lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp index 068bca9..8db7571 100644 --- a/lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp +++ b/lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp @@ -33,7 +33,7 @@ class NSIndexPathSyntheticFrontEnd : public SyntheticChildrenFrontEnd { public: NSIndexPathSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp) : SyntheticChildrenFrontEnd(*valobj_sp.get()), m_descriptor_sp(nullptr), - m_impl(), m_ptr_size(0), m_uint_star_type() { + m_impl(), m_uint_star_type() { m_ptr_size = m_backend.GetTargetSP()->GetArchitecture().GetAddressByteSize(); } @@ -292,7 +292,7 @@ protected: Mode m_mode = Mode::Invalid; } m_impl; - uint32_t m_ptr_size; + uint32_t m_ptr_size = 0; CompilerType m_uint_star_type; }; diff --git a/lldb/source/Plugins/Language/ObjC/NSSet.cpp b/lldb/source/Plugins/Language/ObjC/NSSet.cpp index 43ef7b6..671d391 100644 --- a/lldb/source/Plugins/Language/ObjC/NSSet.cpp +++ b/lldb/source/Plugins/Language/ObjC/NSSet.cpp @@ -73,9 +73,9 @@ private: }; ExecutionContextRef m_exe_ctx_ref; - uint8_t m_ptr_size; - DataDescriptor_32 *m_data_32; - DataDescriptor_64 *m_data_64; + uint8_t m_ptr_size = 8; + DataDescriptor_32 *m_data_32 = nullptr; + DataDescriptor_64 *m_data_64 = nullptr; lldb::addr_t m_data_ptr; std::vector<SetItemDescriptor> m_children; }; @@ -101,8 +101,8 @@ private: }; ExecutionContextRef m_exe_ctx_ref; - uint8_t m_ptr_size; - lldb::ByteOrder m_order; + uint8_t m_ptr_size = 8; + lldb::ByteOrder m_order = lldb::eByteOrderInvalid; CFBasicHash m_hashtable; @@ -135,7 +135,7 @@ private: }; ExecutionContextRef m_exe_ctx_ref; - uint8_t m_ptr_size; + uint8_t m_ptr_size = 8; D32 *m_data_32; D64 *m_data_64; std::vector<SetItemDescriptor> m_children; @@ -401,8 +401,7 @@ lldb_private::formatters::NSSetSyntheticFrontEndCreator( lldb_private::formatters::NSSetISyntheticFrontEnd::NSSetISyntheticFrontEnd( lldb::ValueObjectSP valobj_sp) - : SyntheticChildrenFrontEnd(*valobj_sp), m_exe_ctx_ref(), m_ptr_size(8), - m_data_32(nullptr), m_data_64(nullptr) { + : SyntheticChildrenFrontEnd(*valobj_sp), m_exe_ctx_ref() { if (valobj_sp) Update(); } @@ -546,8 +545,8 @@ lldb_private::formatters::NSSetISyntheticFrontEnd::GetChildAtIndex(size_t idx) { lldb_private::formatters::NSCFSetSyntheticFrontEnd::NSCFSetSyntheticFrontEnd( lldb::ValueObjectSP valobj_sp) - : SyntheticChildrenFrontEnd(*valobj_sp), m_exe_ctx_ref(), m_ptr_size(8), - m_order(lldb::eByteOrderInvalid), m_hashtable(), m_pair_type() {} + : SyntheticChildrenFrontEnd(*valobj_sp), m_exe_ctx_ref(), m_hashtable(), + m_pair_type() {} size_t lldb_private::formatters::NSCFSetSyntheticFrontEnd::GetIndexOfChildWithName( @@ -667,10 +666,9 @@ lldb_private::formatters::NSCFSetSyntheticFrontEnd::GetChildAtIndex( } template <typename D32, typename D64> -lldb_private::formatters:: - GenericNSSetMSyntheticFrontEnd<D32, D64>::GenericNSSetMSyntheticFrontEnd( - lldb::ValueObjectSP valobj_sp) - : SyntheticChildrenFrontEnd(*valobj_sp), m_exe_ctx_ref(), m_ptr_size(8), +lldb_private::formatters::GenericNSSetMSyntheticFrontEnd< + D32, D64>::GenericNSSetMSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp) + : SyntheticChildrenFrontEnd(*valobj_sp), m_exe_ctx_ref(), m_data_32(nullptr), m_data_64(nullptr) { if (valobj_sp) Update(); diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp index 790595d..5f3ae3b 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp @@ -181,7 +181,7 @@ AppleObjCDeclVendor::GetDeclForISA(ObjCLanguageRuntime::ObjCISA isa) { class ObjCRuntimeMethodType { public: - ObjCRuntimeMethodType(const char *types) : m_is_valid(false) { + ObjCRuntimeMethodType(const char *types) { const char *cursor = types; enum ParserState { Start = 0, InType, InPos } state = Start; const char *type = nullptr; @@ -391,7 +391,7 @@ private: typedef std::vector<std::string> TypeVector; TypeVector m_type_vector; - bool m_is_valid; + bool m_is_valid = false; }; bool AppleObjCDeclVendor::FinishDecl(clang::ObjCInterfaceDecl *interface_decl) { diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp index fde099c..b1d6d6b 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp @@ -281,8 +281,7 @@ extern \"C\" void * __lldb_objc_find_implementation_for_selector (void *object, AppleObjCTrampolineHandler::AppleObjCVTables::VTableRegion::VTableRegion( AppleObjCVTables *owner, lldb::addr_t header_addr) - : m_valid(true), m_owner(owner), m_header_addr(header_addr), - m_code_start_addr(0), m_code_end_addr(0), m_next_region(0) { + : m_valid(true), m_owner(owner), m_header_addr(header_addr) { SetUpRegion(); } diff --git a/lldb/source/Plugins/ObjectFile/PECOFF/PECallFrameInfo.cpp b/lldb/source/Plugins/ObjectFile/PECOFF/PECallFrameInfo.cpp index 522c9a6..ae434e2 100644 --- a/lldb/source/Plugins/ObjectFile/PECOFF/PECallFrameInfo.cpp +++ b/lldb/source/Plugins/ObjectFile/PECOFF/PECallFrameInfo.cpp @@ -46,25 +46,23 @@ public: private: ObjectFilePECOFF &m_object_file; - bool m_error; + bool m_error = false; uint32_t m_unwind_info_rva; DataExtractor m_unwind_info_data; - const UnwindInfo *m_unwind_info; + const UnwindInfo *m_unwind_info = nullptr; DataExtractor m_unwind_code_data; offset_t m_unwind_code_offset; - const UnwindCode *m_unwind_code; + const UnwindCode *m_unwind_code = nullptr; - bool m_chained; + bool m_chained = false; }; UnwindCodesIterator::UnwindCodesIterator(ObjectFilePECOFF &object_file, uint32_t unwind_info_rva) - : m_object_file(object_file), m_error(false), - m_unwind_info_rva(unwind_info_rva), - m_unwind_info(nullptr), m_unwind_code_offset{}, m_unwind_code(nullptr), - m_chained(false) {} + : m_object_file(object_file), + m_unwind_info_rva(unwind_info_rva), m_unwind_code_offset{} {} bool UnwindCodesIterator::GetNext() { static constexpr int UNWIND_INFO_SIZE = 4; diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.cpp index 21dbd3f..62d75c6 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.cpp @@ -22,8 +22,7 @@ DWARFAbbreviationDeclaration::DWARFAbbreviationDeclaration() : m_attributes() {} DWARFAbbreviationDeclaration::DWARFAbbreviationDeclaration(dw_tag_t tag, uint8_t has_children) - : m_code(InvalidCode), m_tag(tag), m_has_children(has_children), - m_attributes() {} + : m_tag(tag), m_has_children(has_children), m_attributes() {} llvm::Expected<DWARFEnumState> DWARFAbbreviationDeclaration::extract(const DWARFDataExtractor &data, diff --git a/lldb/source/Symbol/Symbol.cpp b/lldb/source/Symbol/Symbol.cpp index 5ee5b0f..9ec7f26 100644 --- a/lldb/source/Symbol/Symbol.cpp +++ b/lldb/source/Symbol/Symbol.cpp @@ -31,19 +31,18 @@ Symbol::Symbol() m_is_weak(false), m_type(eSymbolTypeInvalid), m_mangled(), m_addr_range() {} -Symbol::Symbol(uint32_t symID, llvm::StringRef name, SymbolType type, bool external, - bool is_debug, bool is_trampoline, bool is_artificial, - const lldb::SectionSP §ion_sp, addr_t offset, addr_t size, - bool size_is_valid, bool contains_linker_annotations, - uint32_t flags) - : SymbolContextScope(), m_uid(symID), m_type_data(0), - m_type_data_resolved(false), m_is_synthetic(is_artificial), - m_is_debug(is_debug), m_is_external(external), m_size_is_sibling(false), +Symbol::Symbol(uint32_t symID, llvm::StringRef name, SymbolType type, + bool external, bool is_debug, bool is_trampoline, + bool is_artificial, const lldb::SectionSP §ion_sp, + addr_t offset, addr_t size, bool size_is_valid, + bool contains_linker_annotations, uint32_t flags) + : SymbolContextScope(), m_uid(symID), m_type_data_resolved(false), + m_is_synthetic(is_artificial), m_is_debug(is_debug), + m_is_external(external), m_size_is_sibling(false), m_size_is_synthesized(false), m_size_is_valid(size_is_valid || size > 0), m_demangled_is_synthesized(false), m_contains_linker_annotations(contains_linker_annotations), - m_is_weak(false), m_type(type), - m_mangled(name), + m_is_weak(false), m_type(type), m_mangled(name), m_addr_range(section_sp, offset, size), m_flags(flags) {} Symbol::Symbol(uint32_t symID, const Mangled &mangled, SymbolType type, @@ -51,9 +50,9 @@ Symbol::Symbol(uint32_t symID, const Mangled &mangled, SymbolType type, bool is_artificial, const AddressRange &range, bool size_is_valid, bool contains_linker_annotations, uint32_t flags) - : SymbolContextScope(), m_uid(symID), m_type_data(0), - m_type_data_resolved(false), m_is_synthetic(is_artificial), - m_is_debug(is_debug), m_is_external(external), m_size_is_sibling(false), + : SymbolContextScope(), m_uid(symID), m_type_data_resolved(false), + m_is_synthetic(is_artificial), m_is_debug(is_debug), + m_is_external(external), m_size_is_sibling(false), m_size_is_synthesized(false), m_size_is_valid(size_is_valid || range.GetByteSize() > 0), m_demangled_is_synthesized(false), diff --git a/lldb/source/Symbol/SymbolContext.cpp b/lldb/source/Symbol/SymbolContext.cpp index 046b290..2985a39 100644 --- a/lldb/source/Symbol/SymbolContext.cpp +++ b/lldb/source/Symbol/SymbolContext.cpp @@ -31,7 +31,7 @@ SymbolContext::SymbolContext() : target_sp(), module_sp(), line_entry() {} SymbolContext::SymbolContext(const ModuleSP &m, CompileUnit *cu, Function *f, Block *b, LineEntry *le, Symbol *s) : target_sp(), module_sp(m), comp_unit(cu), function(f), block(b), - line_entry(), symbol(s), variable(nullptr) { + line_entry(), symbol(s) { if (le) line_entry = *le; } @@ -40,14 +40,13 @@ SymbolContext::SymbolContext(const TargetSP &t, const ModuleSP &m, CompileUnit *cu, Function *f, Block *b, LineEntry *le, Symbol *s) : target_sp(t), module_sp(m), comp_unit(cu), function(f), block(b), - line_entry(), symbol(s), variable(nullptr) { + line_entry(), symbol(s) { if (le) line_entry = *le; } SymbolContext::SymbolContext(SymbolContextScope *sc_scope) - : target_sp(), module_sp(), comp_unit(nullptr), function(nullptr), - block(nullptr), line_entry(), symbol(nullptr), variable(nullptr) { + : target_sp(), module_sp(), line_entry() { sc_scope->CalculateSymbolContext(this); } diff --git a/lldb/source/Symbol/Type.cpp b/lldb/source/Symbol/Type.cpp index c5d37c8..ac88163 100644 --- a/lldb/source/Symbol/Type.cpp +++ b/lldb/source/Symbol/Type.cpp @@ -146,7 +146,7 @@ Type::Type(lldb::user_id_t uid, SymbolFile *symbol_file, ConstString name, const Declaration &decl, const CompilerType &compiler_type, ResolveState compiler_type_resolve_state, uint32_t opaque_payload) : std::enable_shared_from_this<Type>(), UserID(uid), m_name(name), - m_symbol_file(symbol_file), m_context(context), m_encoding_type(nullptr), + m_symbol_file(symbol_file), m_context(context), m_encoding_uid(encoding_uid), m_encoding_uid_type(encoding_uid_type), m_decl(decl), m_compiler_type(compiler_type), m_compiler_type_resolve_state(compiler_type ? compiler_type_resolve_state diff --git a/lldb/source/Target/ExecutionContext.cpp b/lldb/source/Target/ExecutionContext.cpp index b5cf135..977dec6 100644 --- a/lldb/source/Target/ExecutionContext.cpp +++ b/lldb/source/Target/ExecutionContext.cpp @@ -398,21 +398,18 @@ ExecutionContextRef::ExecutionContextRef() : m_target_wp(), m_process_wp(), m_thread_wp(), m_stack_id() {} ExecutionContextRef::ExecutionContextRef(const ExecutionContext *exe_ctx) - : m_target_wp(), m_process_wp(), m_thread_wp(), - m_tid(LLDB_INVALID_THREAD_ID), m_stack_id() { + : m_target_wp(), m_process_wp(), m_thread_wp(), m_stack_id() { if (exe_ctx) *this = *exe_ctx; } ExecutionContextRef::ExecutionContextRef(const ExecutionContext &exe_ctx) - : m_target_wp(), m_process_wp(), m_thread_wp(), - m_tid(LLDB_INVALID_THREAD_ID), m_stack_id() { + : m_target_wp(), m_process_wp(), m_thread_wp(), m_stack_id() { *this = exe_ctx; } ExecutionContextRef::ExecutionContextRef(Target *target, bool adopt_selected) - : m_target_wp(), m_process_wp(), m_thread_wp(), - m_tid(LLDB_INVALID_THREAD_ID), m_stack_id() { + : m_target_wp(), m_process_wp(), m_thread_wp(), m_stack_id() { SetTargetPtr(target, adopt_selected); } diff --git a/lldb/source/Target/LanguageRuntime.cpp b/lldb/source/Target/LanguageRuntime.cpp index be878d6..ce3646c 100644 --- a/lldb/source/Target/LanguageRuntime.cpp +++ b/lldb/source/Target/LanguageRuntime.cpp @@ -104,8 +104,7 @@ public: ExceptionBreakpointResolver(lldb::LanguageType language, bool catch_bp, bool throw_bp) : BreakpointResolver(nullptr, BreakpointResolver::ExceptionResolver), - m_language(language), m_language_runtime(nullptr), m_catch_bp(catch_bp), - m_throw_bp(throw_bp) {} + m_language(language), m_catch_bp(catch_bp), m_throw_bp(throw_bp) {} ~ExceptionBreakpointResolver() override = default; @@ -195,7 +194,7 @@ protected: lldb::BreakpointResolverSP m_actual_resolver_sp; lldb::LanguageType m_language; - LanguageRuntime *m_language_runtime; + LanguageRuntime *m_language_runtime = nullptr; bool m_catch_bp; bool m_throw_bp; }; diff --git a/lldb/source/Target/PathMappingList.cpp b/lldb/source/Target/PathMappingList.cpp index e49f621..f699b8b 100644 --- a/lldb/source/Target/PathMappingList.cpp +++ b/lldb/source/Target/PathMappingList.cpp @@ -40,12 +40,10 @@ std::string NormalizePath(llvm::StringRef path) { PathMappingList::PathMappingList() : m_pairs() {} PathMappingList::PathMappingList(ChangedCallback callback, void *callback_baton) - : m_pairs(), m_callback(callback), m_callback_baton(callback_baton), - m_mod_id(0) {} + : m_pairs(), m_callback(callback), m_callback_baton(callback_baton) {} PathMappingList::PathMappingList(const PathMappingList &rhs) - : m_pairs(rhs.m_pairs), m_callback(nullptr), m_callback_baton(nullptr), - m_mod_id(0) {} + : m_pairs(rhs.m_pairs) {} const PathMappingList &PathMappingList::operator=(const PathMappingList &rhs) { if (this != &rhs) { diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index 4718f833..122f20b 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -3862,8 +3862,7 @@ Process::ProcessEventData::ProcessEventData() : EventData(), m_process_wp() {} Process::ProcessEventData::ProcessEventData(const ProcessSP &process_sp, StateType state) - : EventData(), m_process_wp(), m_state(state), m_restarted(false), - m_update_state(0), m_interrupted(false) { + : EventData(), m_process_wp(), m_state(state) { if (process_sp) m_process_wp = process_sp; } @@ -4507,7 +4506,7 @@ namespace { class RestorePlanState { public: RestorePlanState(lldb::ThreadPlanSP thread_plan_sp) - : m_thread_plan_sp(thread_plan_sp), m_already_reset(false) { + : m_thread_plan_sp(thread_plan_sp) { if (m_thread_plan_sp) { m_private = m_thread_plan_sp->GetPrivate(); m_is_controlling = m_thread_plan_sp->IsControllingPlan(); @@ -4528,7 +4527,7 @@ public: private: lldb::ThreadPlanSP m_thread_plan_sp; - bool m_already_reset; + bool m_already_reset = false; bool m_private; bool m_is_controlling; bool m_okay_to_discard; diff --git a/lldb/source/Target/StopInfo.cpp b/lldb/source/Target/StopInfo.cpp index 5d9a010..180c129 100644 --- a/lldb/source/Target/StopInfo.cpp +++ b/lldb/source/Target/StopInfo.cpp @@ -656,8 +656,7 @@ public: StopInfoWatchpoint(Thread &thread, break_id_t watch_id, lldb::addr_t watch_hit_addr) - : StopInfo(thread, watch_id), m_should_stop(false), - m_should_stop_is_valid(false), m_watch_hit_addr(watch_hit_addr) {} + : StopInfo(thread, watch_id), m_watch_hit_addr(watch_hit_addr) {} ~StopInfoWatchpoint() override = default; @@ -931,8 +930,8 @@ protected: } private: - bool m_should_stop; - bool m_should_stop_is_valid; + bool m_should_stop = false; + bool m_should_stop_is_valid = false; lldb::addr_t m_watch_hit_addr; }; @@ -1122,8 +1121,7 @@ private: class StopInfoExec : public StopInfo { public: - StopInfoExec(Thread &thread) - : StopInfo(thread, LLDB_INVALID_UID), m_performed_action(false) {} + StopInfoExec(Thread &thread) : StopInfo(thread, LLDB_INVALID_UID) {} ~StopInfoExec() override = default; @@ -1149,7 +1147,7 @@ protected: thread_sp->GetProcess()->DidExec(); } - bool m_performed_action; + bool m_performed_action = false; }; // StopInfoFork @@ -1157,8 +1155,8 @@ protected: class StopInfoFork : public StopInfo { public: StopInfoFork(Thread &thread, lldb::pid_t child_pid, lldb::tid_t child_tid) - : StopInfo(thread, child_pid), m_performed_action(false), - m_child_pid(child_pid), m_child_tid(child_tid) {} + : StopInfo(thread, child_pid), m_child_pid(child_pid), + m_child_tid(child_tid) {} ~StopInfoFork() override = default; @@ -1179,7 +1177,7 @@ protected: thread_sp->GetProcess()->DidFork(m_child_pid, m_child_tid); } - bool m_performed_action; + bool m_performed_action = false; private: lldb::pid_t m_child_pid; @@ -1191,8 +1189,8 @@ private: class StopInfoVFork : public StopInfo { public: StopInfoVFork(Thread &thread, lldb::pid_t child_pid, lldb::tid_t child_tid) - : StopInfo(thread, child_pid), m_performed_action(false), - m_child_pid(child_pid), m_child_tid(child_tid) {} + : StopInfo(thread, child_pid), m_child_pid(child_pid), + m_child_tid(child_tid) {} ~StopInfoVFork() override = default; @@ -1213,7 +1211,7 @@ protected: thread_sp->GetProcess()->DidVFork(m_child_pid, m_child_tid); } - bool m_performed_action; + bool m_performed_action = false; private: lldb::pid_t m_child_pid; @@ -1224,8 +1222,7 @@ private: class StopInfoVForkDone : public StopInfo { public: - StopInfoVForkDone(Thread &thread) - : StopInfo(thread, 0), m_performed_action(false) {} + StopInfoVForkDone(Thread &thread) : StopInfo(thread, 0) {} ~StopInfoVForkDone() override = default; @@ -1246,7 +1243,7 @@ protected: thread_sp->GetProcess()->DidVForkDone(); } - bool m_performed_action; + bool m_performed_action = false; }; } // namespace lldb_private diff --git a/lldb/source/Utility/DataExtractor.cpp b/lldb/source/Utility/DataExtractor.cpp index bdd79fd..50f2985 100644 --- a/lldb/source/Utility/DataExtractor.cpp +++ b/lldb/source/Utility/DataExtractor.cpp @@ -142,8 +142,7 @@ DataExtractor::DataExtractor(const void *data, offset_t length, DataExtractor::DataExtractor(const DataBufferSP &data_sp, ByteOrder endian, uint32_t addr_size, uint32_t target_byte_size /*=1*/) - : m_start(nullptr), m_end(nullptr), m_byte_order(endian), - m_addr_size(addr_size), m_data_sp(), + : m_byte_order(endian), m_addr_size(addr_size), m_data_sp(), m_target_byte_size(target_byte_size) { assert(addr_size >= 1 && addr_size <= 8); SetData(data_sp); @@ -156,9 +155,8 @@ DataExtractor::DataExtractor(const DataBufferSP &data_sp, ByteOrder endian, // "data". DataExtractor::DataExtractor(const DataExtractor &data, offset_t offset, offset_t length, uint32_t target_byte_size /*=1*/) - : m_start(nullptr), m_end(nullptr), m_byte_order(data.m_byte_order), - m_addr_size(data.m_addr_size), m_data_sp(), - m_target_byte_size(target_byte_size) { + : m_byte_order(data.m_byte_order), m_addr_size(data.m_addr_size), + m_data_sp(), m_target_byte_size(target_byte_size) { assert(m_addr_size >= 1 && m_addr_size <= 8); if (data.ValidOffset(offset)) { offset_t bytes_available = data.GetByteSize() - offset; diff --git a/lldb/source/Utility/Instrumentation.cpp b/lldb/source/Utility/Instrumentation.cpp index 1c64849..581f657 100644 --- a/lldb/source/Utility/Instrumentation.cpp +++ b/lldb/source/Utility/Instrumentation.cpp @@ -25,7 +25,7 @@ static llvm::ManagedStatic<llvm::SignpostEmitter> g_api_signposts; Instrumenter::Instrumenter(llvm::StringRef pretty_func, std::string &&pretty_args) - : m_pretty_func(pretty_func), m_local_boundary(false) { + : m_pretty_func(pretty_func) { if (!g_global_boundary) { g_global_boundary = true; m_local_boundary = true; diff --git a/lldb/source/Utility/ProcessInfo.cpp b/lldb/source/Utility/ProcessInfo.cpp index c9759bb..957bba2 100644 --- a/lldb/source/Utility/ProcessInfo.cpp +++ b/lldb/source/Utility/ProcessInfo.cpp @@ -26,8 +26,8 @@ ProcessInfo::ProcessInfo() ProcessInfo::ProcessInfo(const char *name, const ArchSpec &arch, lldb::pid_t pid) - : m_executable(name), m_arguments(), m_environment(), m_uid(UINT32_MAX), - m_gid(UINT32_MAX), m_arch(arch), m_pid(pid) {} + : m_executable(name), m_arguments(), m_environment(), m_arch(arch), + m_pid(pid) {} void ProcessInfo::Clear() { m_executable.Clear(); diff --git a/lldb/source/Utility/Status.cpp b/lldb/source/Utility/Status.cpp index e6d3814..4498961 100644 --- a/lldb/source/Utility/Status.cpp +++ b/lldb/source/Utility/Status.cpp @@ -51,8 +51,7 @@ Status::Status(std::error_code EC) : eErrorTypeGeneric), m_string(EC.message()) {} -Status::Status(const char *format, ...) - : m_code(0), m_type(eErrorTypeInvalid), m_string() { +Status::Status(const char *format, ...) : m_string() { va_list args; va_start(args, format); SetErrorToGenericError(); diff --git a/lldb/source/Utility/Stream.cpp b/lldb/source/Utility/Stream.cpp index b0f0854..af28a49 100644 --- a/lldb/source/Utility/Stream.cpp +++ b/lldb/source/Utility/Stream.cpp @@ -25,7 +25,7 @@ using namespace lldb_private; Stream::Stream(uint32_t flags, uint32_t addr_size, ByteOrder byte_order, bool colors) : m_flags(flags), m_addr_size(addr_size), m_byte_order(byte_order), - m_indent_level(0), m_forwarder(*this, colors) {} + m_forwarder(*this, colors) {} Stream::Stream(bool colors) : m_flags(0), m_byte_order(endian::InlHostByteOrder()), diff --git a/lldb/source/Utility/StringExtractor.cpp b/lldb/source/Utility/StringExtractor.cpp index d082c86f..c7e4ac79 100644 --- a/lldb/source/Utility/StringExtractor.cpp +++ b/lldb/source/Utility/StringExtractor.cpp @@ -28,13 +28,11 @@ static inline int xdigit_to_sint(char ch) { // StringExtractor constructor StringExtractor::StringExtractor() : m_packet() {} -StringExtractor::StringExtractor(llvm::StringRef packet_str) - : m_packet(), m_index(0) { +StringExtractor::StringExtractor(llvm::StringRef packet_str) : m_packet() { m_packet.assign(packet_str.begin(), packet_str.end()); } -StringExtractor::StringExtractor(const char *packet_cstr) - : m_packet(), m_index(0) { +StringExtractor::StringExtractor(const char *packet_cstr) : m_packet() { if (packet_cstr) m_packet.assign(packet_cstr); } |