diff --git a/lldb/source/API/SBBroadcaster.cpp b/lldb/source/API/SBBroadcaster.cpp --- a/lldb/source/API/SBBroadcaster.cpp +++ b/lldb/source/API/SBBroadcaster.cpp @@ -19,7 +19,7 @@ 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 --- a/lldb/source/API/SBListener.cpp +++ b/lldb/source/API/SBListener.cpp @@ -23,12 +23,11 @@ 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 @@ } 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 --- a/lldb/source/API/SBPlatform.cpp +++ b/lldb/source/API/SBPlatform.cpp @@ -48,8 +48,7 @@ // 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 --- a/lldb/source/API/SBQueue.cpp +++ b/lldb/source/API/SBQueue.cpp @@ -29,10 +29,7 @@ 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 --- a/lldb/source/Commands/CommandObjectCommands.cpp +++ b/lldb/source/Commands/CommandObjectCommands.cpp @@ -1076,7 +1076,7 @@ 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 @@ 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 --- a/lldb/source/Commands/CommandObjectMemory.cpp +++ b/lldb/source/Commands/CommandObjectMemory.cpp @@ -295,7 +295,6 @@ 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 @@ 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 @@ 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 @@ 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 @@ "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 @@ 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 --- a/lldb/source/Commands/CommandObjectMemoryTag.cpp +++ b/lldb/source/Commands/CommandObjectMemoryTag.cpp @@ -138,7 +138,7 @@ public: class OptionGroupTagWrite : public OptionGroup { public: - OptionGroupTagWrite() : m_end_addr(LLDB_INVALID_ADDRESS) {} + OptionGroupTagWrite() {} ~OptionGroupTagWrite() override = default; @@ -168,7 +168,7 @@ 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 --- a/lldb/source/Commands/CommandObjectProcess.cpp +++ b/lldb/source/Commands/CommandObjectProcess.cpp @@ -1214,7 +1214,7 @@ class CommandOptions : public Options { public: - CommandOptions() : m_requested_save_core_style(eSaveCoreUnspecified) {} + CommandOptions() {} ~CommandOptions() override = default; @@ -1250,7 +1250,7 @@ } // 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 --- a/lldb/source/Commands/CommandObjectThread.cpp +++ b/lldb/source/Commands/CommandObjectThread.cpp @@ -2184,8 +2184,7 @@ nullptr, eCommandRequiresProcess | eCommandTryTargetAPILock | eCommandProcessMustBeLaunched | eCommandProcessMustBePaused | - eCommandProcessMustBeTraced), - m_create_repeat_command_just_invoked(false) {} + eCommandProcessMustBeTraced) {} ~CommandObjectTraceDumpInstructions() override = default; @@ -2253,7 +2252,7 @@ // 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> m_dumpers; }; diff --git a/lldb/source/Core/Address.cpp b/lldb/source/Core/Address.cpp --- a/lldb/source/Core/Address.cpp +++ b/lldb/source/Core/Address.cpp @@ -233,7 +233,7 @@ 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 --- a/lldb/source/Core/FormatEntity.cpp +++ b/lldb/source/Core/FormatEntity.cpp @@ -263,11 +263,10 @@ 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 --- a/lldb/source/Core/IOHandlerCursesGUI.cpp +++ b/lldb/source/Core/IOHandlerCursesGUI.cpp @@ -341,7 +341,7 @@ 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 @@ 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 @@ protected: Type m_type; - WINDOW *m_window; + WINDOW *m_window = nullptr; }; class Pad : public Surface { @@ -1076,8 +1076,7 @@ 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 @@ 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 @@ ChoicesFieldDelegate(const char *label, int number_of_visible_choices, std::vector 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 @@ int m_number_of_visible_choices; std::vector 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 @@ template 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 @@ // created though a copy. T m_default_field; std::vector m_fields; - int m_selection_index; + int m_selection_index = 0; // See SelectionType class enum. SelectionType m_selection_type; }; @@ -2465,9 +2464,7 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 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 @@ 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 @@ 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 @@ protected: Debugger &m_debugger; std::shared_ptr 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 @@ protected: std::shared_ptr 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 @@ 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 @@ 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 @@ protected: Debugger &m_debugger; - Block *m_frame_block; + Block *m_frame_block = nullptr; }; class RegistersWindowDelegate : public ValueObjectListDelegate { @@ -6198,7 +6185,7 @@ 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 @@ 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 @@ 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 --- a/lldb/source/Core/Module.cpp +++ b/lldb/source/Core/Module.cpp @@ -129,8 +129,7 @@ } 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 guard( @@ -636,9 +635,7 @@ 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 --- a/lldb/source/Core/ModuleList.cpp +++ b/lldb/source/Core/ModuleList.cpp @@ -182,8 +182,7 @@ 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 lhs_guard(m_modules_mutex); std::lock_guard 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 --- a/lldb/source/Core/Value.cpp +++ b/lldb/source/Core/Value.cpp @@ -41,13 +41,10 @@ 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 --- a/lldb/source/Core/ValueObject.cpp +++ b/lldb/source/Core/ValueObject.cpp @@ -2803,7 +2803,7 @@ 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( 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 --- a/lldb/source/DataFormatters/VectorType.cpp +++ b/lldb/source/DataFormatters/VectorType.cpp @@ -189,8 +189,7 @@ 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 @@ } 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 --- a/lldb/source/Expression/DWARFExpression.cpp +++ b/lldb/source/Expression/DWARFExpression.cpp @@ -64,8 +64,7 @@ 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 --- a/lldb/source/Expression/IRInterpreter.cpp +++ b/lldb/source/Expression/IRInterpreter.cpp @@ -97,8 +97,8 @@ 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 @@ 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 --- a/lldb/source/Expression/Materializer.cpp +++ b/lldb/source/Expression/Materializer.cpp @@ -413,9 +413,7 @@ 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 @@ 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 @@ 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 @@ 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 --- a/lldb/source/Host/common/HostNativeThreadBase.cpp +++ b/lldb/source/Host/common/HostNativeThreadBase.cpp @@ -19,7 +19,7 @@ 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 --- a/lldb/source/Host/common/ProcessLaunchInfo.cpp +++ b/lldb/source/Host/common/ProcessLaunchInfo.cpp @@ -41,7 +41,7 @@ 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 --- a/lldb/source/Interpreter/OptionValueFileColonLine.cpp +++ b/lldb/source/Interpreter/OptionValueFileColonLine.cpp @@ -24,9 +24,8 @@ 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 --- a/lldb/source/Interpreter/OptionValueFileSpec.cpp +++ b/lldb/source/Interpreter/OptionValueFileSpec.cpp @@ -22,14 +22,14 @@ 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 --- a/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp +++ b/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp @@ -90,8 +90,7 @@ AddressClass addr_class) : Instruction(address, addr_class), m_disasm_wp(std::static_pointer_cast( - disasm.shared_from_this())), - m_using_file_addr(false) {} + disasm.shared_from_this())) {} ~InstructionLLVMC() override = default; @@ -822,7 +821,7 @@ std::weak_ptr 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 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp @@ -88,8 +88,7 @@ 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 @@ private: std::vector 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 --- a/lldb/source/Plugins/ExpressionParser/Clang/IRDynamicChecks.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/IRDynamicChecks.cpp @@ -137,8 +137,7 @@ /// The module being instrumented. Instrumenter(llvm::Module &module, std::shared_ptr 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 @@ 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 --- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxAtomic.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxAtomic.cpp @@ -102,14 +102,14 @@ 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 --- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxInitializerList.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxInitializerList.cpp @@ -36,18 +36,17 @@ 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 --- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp @@ -158,8 +158,8 @@ 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 @@ } 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 --- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp @@ -192,11 +192,11 @@ 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 m_iterators; }; } // namespace formatters @@ -204,9 +204,7 @@ 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 --- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp @@ -44,9 +44,9 @@ 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> m_elements_cache; }; } // namespace formatters @@ -54,8 +54,8 @@ 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 --- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp @@ -35,10 +35,10 @@ 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 @@ 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 m_children; }; @@ -68,8 +68,7 @@ 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 @@ 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 --- a/lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp @@ -53,7 +53,7 @@ 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 @@ 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 --- a/lldb/source/Plugins/Language/ObjC/NSArray.cpp +++ b/lldb/source/Plugins/Language/ObjC/NSArray.cpp @@ -70,7 +70,7 @@ 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 @@ 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 @@ 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 @@ template lldb_private::formatters::GenericNSArrayISyntheticFrontEnd:: - 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 --- a/lldb/source/Plugins/Language/ObjC/NSDictionary.cpp +++ b/lldb/source/Plugins/Language/ObjC/NSDictionary.cpp @@ -133,10 +133,10 @@ }; 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 m_children; @@ -196,8 +196,8 @@ }; 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 @@ }; 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 @@ }; 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 m_children; }; @@ -592,9 +592,7 @@ 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::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 @@ } template -lldb_private::formatters::GenericNSDictionaryMSyntheticFrontEnd:: +lldb_private::formatters::GenericNSDictionaryMSyntheticFrontEnd:: 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 lldb_private::formatters::GenericNSDictionaryMSyntheticFrontEnd:: @@ -1227,12 +1224,9 @@ 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 --- a/lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp +++ b/lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp @@ -33,7 +33,7 @@ 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 @@ 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 --- a/lldb/source/Plugins/Language/ObjC/NSSet.cpp +++ b/lldb/source/Plugins/Language/ObjC/NSSet.cpp @@ -73,9 +73,9 @@ }; 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 m_children; }; @@ -101,8 +101,8 @@ }; 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 @@ }; 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 m_children; @@ -401,8 +401,7 @@ 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::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 @@ } template -lldb_private::formatters:: - GenericNSSetMSyntheticFrontEnd::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 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp @@ -181,7 +181,7 @@ 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 @@ typedef std::vector 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 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp @@ -281,8 +281,7 @@ 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 --- a/lldb/source/Plugins/ObjectFile/PECOFF/PECallFrameInfo.cpp +++ b/lldb/source/Plugins/ObjectFile/PECOFF/PECallFrameInfo.cpp @@ -46,25 +46,23 @@ 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 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.cpp @@ -22,8 +22,7 @@ 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 DWARFAbbreviationDeclaration::extract(const DWARFDataExtractor &data, diff --git a/lldb/source/Symbol/Symbol.cpp b/lldb/source/Symbol/Symbol.cpp --- a/lldb/source/Symbol/Symbol.cpp +++ b/lldb/source/Symbol/Symbol.cpp @@ -31,19 +31,18 @@ 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 @@ 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 --- a/lldb/source/Symbol/SymbolContext.cpp +++ b/lldb/source/Symbol/SymbolContext.cpp @@ -31,7 +31,7 @@ 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 @@ 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 --- a/lldb/source/Symbol/Type.cpp +++ b/lldb/source/Symbol/Type.cpp @@ -146,7 +146,7 @@ const Declaration &decl, const CompilerType &compiler_type, ResolveState compiler_type_resolve_state, uint32_t opaque_payload) : std::enable_shared_from_this(), 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 --- a/lldb/source/Target/ExecutionContext.cpp +++ b/lldb/source/Target/ExecutionContext.cpp @@ -398,21 +398,18 @@ : 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 --- a/lldb/source/Target/LanguageRuntime.cpp +++ b/lldb/source/Target/LanguageRuntime.cpp @@ -104,8 +104,7 @@ 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 @@ 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 --- a/lldb/source/Target/PathMappingList.cpp +++ b/lldb/source/Target/PathMappingList.cpp @@ -40,12 +40,10 @@ 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 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -3862,8 +3862,7 @@ 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 @@ 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 @@ 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 --- a/lldb/source/Target/StopInfo.cpp +++ b/lldb/source/Target/StopInfo.cpp @@ -656,8 +656,7 @@ 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 @@ } 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 @@ 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 @@ thread_sp->GetProcess()->DidExec(); } - bool m_performed_action; + bool m_performed_action = false; }; // StopInfoFork @@ -1157,8 +1155,8 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 --- a/lldb/source/Utility/DataExtractor.cpp +++ b/lldb/source/Utility/DataExtractor.cpp @@ -142,8 +142,7 @@ 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 @@ // "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 --- a/lldb/source/Utility/Instrumentation.cpp +++ b/lldb/source/Utility/Instrumentation.cpp @@ -25,7 +25,7 @@ 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 --- a/lldb/source/Utility/ProcessInfo.cpp +++ b/lldb/source/Utility/ProcessInfo.cpp @@ -26,8 +26,8 @@ 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 --- a/lldb/source/Utility/Status.cpp +++ b/lldb/source/Utility/Status.cpp @@ -51,8 +51,7 @@ : 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 --- a/lldb/source/Utility/Stream.cpp +++ b/lldb/source/Utility/Stream.cpp @@ -25,7 +25,7 @@ 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 --- a/lldb/source/Utility/StringExtractor.cpp +++ b/lldb/source/Utility/StringExtractor.cpp @@ -28,13 +28,11 @@ // 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); } diff --git a/lldb/unittests/Editline/EditlineTest.cpp b/lldb/unittests/Editline/EditlineTest.cpp --- a/lldb/unittests/Editline/EditlineTest.cpp +++ b/lldb/unittests/Editline/EditlineTest.cpp @@ -87,15 +87,14 @@ std::unique_ptr _editline_sp; PseudoTerminal _pty; - int _pty_primary_fd; - int _pty_secondary_fd; + int _pty_primary_fd = -1; + int _pty_secondary_fd = -1; std::unique_ptr _el_secondary_file; }; EditlineAdapter::EditlineAdapter() - : _editline_sp(), _pty(), _pty_primary_fd(-1), _pty_secondary_fd(-1), - _el_secondary_file() { + : _editline_sp(), _pty(), _el_secondary_file() { lldb_private::Status error; // Open the first primary pty available. diff --git a/lldb/unittests/Host/FileSystemTest.cpp b/lldb/unittests/Host/FileSystemTest.cpp --- a/lldb/unittests/Host/FileSystemTest.cpp +++ b/lldb/unittests/Host/FileSystemTest.cpp @@ -34,7 +34,7 @@ class DummyFileSystem : public vfs::FileSystem { int FSID; // used to produce UniqueIDs - int FileID; // used to produce UniqueIDs + int FileID = 0; // used to produce UniqueIDs std::string cwd; std::map FilesAndDirs; @@ -44,7 +44,7 @@ } public: - DummyFileSystem() : FSID(getNextFSID()), FileID(0) {} + DummyFileSystem() : FSID(getNextFSID()) {} ErrorOr status(const Twine &Path) override { std::map::iterator I = diff --git a/lldb/unittests/Process/ProcessEventDataTest.cpp b/lldb/unittests/Process/ProcessEventDataTest.cpp --- a/lldb/unittests/Process/ProcessEventDataTest.cpp +++ b/lldb/unittests/Process/ProcessEventDataTest.cpp @@ -82,28 +82,26 @@ class DummyStopInfo : public StopInfo { public: - DummyStopInfo(Thread &thread, uint64_t value) - : StopInfo(thread, value), m_should_stop(true), - m_stop_reason(eStopReasonBreakpoint) {} + DummyStopInfo(Thread &thread, uint64_t value) : StopInfo(thread, value) {} bool ShouldStop(Event *event_ptr) override { return m_should_stop; } StopReason GetStopReason() const override { return m_stop_reason; } - bool m_should_stop; - StopReason m_stop_reason; + bool m_should_stop = true; + StopReason m_stop_reason = eStopReasonBreakpoint; }; class DummyProcessEventData : public Process::ProcessEventData { public: DummyProcessEventData(ProcessSP &process_sp, StateType state) - : ProcessEventData(process_sp, state), m_should_stop_hit_count(0) {} + : ProcessEventData(process_sp, state) {} bool ShouldStop(Event *event_ptr, bool &found_valid_stopinfo) override { m_should_stop_hit_count++; return false; } - int m_should_stop_hit_count; + int m_should_stop_hit_count = 0; }; } // namespace