diff --git a/lldb/.clang-tidy b/lldb/.clang-tidy --- a/lldb/.clang-tidy +++ b/lldb/.clang-tidy @@ -1,2 +1,7 @@ -Checks: '-readability-identifier-naming' +Checks: '-readability-identifier-naming,modernize-use-default-member-init' InheritParentConfig: true +CheckOptions: + - key: modernize-use-default-member-init.IgnoreMacros + value: '1' + - key: modernize-use-default-member-init.UseAssignment + value: '1' diff --git a/lldb/include/lldb/API/SBBlock.h b/lldb/include/lldb/API/SBBlock.h --- a/lldb/include/lldb/API/SBBlock.h +++ b/lldb/include/lldb/API/SBBlock.h @@ -87,7 +87,7 @@ void AppendVariables(bool can_create, bool get_parent_variables, lldb_private::VariableList *var_list); - lldb_private::Block *m_opaque_ptr; + lldb_private::Block *m_opaque_ptr = nullptr; }; } // namespace lldb diff --git a/lldb/include/lldb/API/SBBroadcaster.h b/lldb/include/lldb/API/SBBroadcaster.h --- a/lldb/include/lldb/API/SBBroadcaster.h +++ b/lldb/include/lldb/API/SBBroadcaster.h @@ -77,7 +77,7 @@ private: lldb::BroadcasterSP m_opaque_sp; - lldb_private::Broadcaster *m_opaque_ptr; + lldb_private::Broadcaster *m_opaque_ptr = nullptr; }; } // namespace lldb diff --git a/lldb/include/lldb/API/SBCommunication.h b/lldb/include/lldb/API/SBCommunication.h --- a/lldb/include/lldb/API/SBCommunication.h +++ b/lldb/include/lldb/API/SBCommunication.h @@ -75,8 +75,8 @@ SBCommunication(const SBCommunication &) = delete; const SBCommunication &operator=(const SBCommunication &) = delete; - lldb_private::Communication *m_opaque; - bool m_opaque_owned; + lldb_private::Communication *m_opaque = nullptr; + bool m_opaque_owned = false; }; } // namespace lldb diff --git a/lldb/include/lldb/API/SBCompileUnit.h b/lldb/include/lldb/API/SBCompileUnit.h --- a/lldb/include/lldb/API/SBCompileUnit.h +++ b/lldb/include/lldb/API/SBCompileUnit.h @@ -87,7 +87,7 @@ void reset(lldb_private::CompileUnit *lldb_object_ptr); - lldb_private::CompileUnit *m_opaque_ptr; + lldb_private::CompileUnit *m_opaque_ptr = nullptr; }; } // namespace lldb diff --git a/lldb/include/lldb/API/SBEvent.h b/lldb/include/lldb/API/SBEvent.h --- a/lldb/include/lldb/API/SBEvent.h +++ b/lldb/include/lldb/API/SBEvent.h @@ -79,7 +79,7 @@ private: mutable lldb::EventSP m_event_sp; - mutable lldb_private::Event *m_opaque_ptr; + mutable lldb_private::Event *m_opaque_ptr = nullptr; }; } // namespace lldb diff --git a/lldb/include/lldb/API/SBFunction.h b/lldb/include/lldb/API/SBFunction.h --- a/lldb/include/lldb/API/SBFunction.h +++ b/lldb/include/lldb/API/SBFunction.h @@ -74,7 +74,7 @@ SBFunction(lldb_private::Function *lldb_object_ptr); - lldb_private::Function *m_opaque_ptr; + lldb_private::Function *m_opaque_ptr = nullptr; }; } // namespace lldb diff --git a/lldb/include/lldb/API/SBListener.h b/lldb/include/lldb/API/SBListener.h --- a/lldb/include/lldb/API/SBListener.h +++ b/lldb/include/lldb/API/SBListener.h @@ -100,7 +100,7 @@ void reset(lldb::ListenerSP listener_sp); lldb::ListenerSP m_opaque_sp; - lldb_private::Listener *m_unused_ptr; + lldb_private::Listener *m_unused_ptr = nullptr; }; } // namespace lldb diff --git a/lldb/include/lldb/API/SBStream.h b/lldb/include/lldb/API/SBStream.h --- a/lldb/include/lldb/API/SBStream.h +++ b/lldb/include/lldb/API/SBStream.h @@ -105,7 +105,7 @@ SBStream(const SBStream &) = delete; const SBStream &operator=(const SBStream &) = delete; std::unique_ptr m_opaque_up; - bool m_is_file; + bool m_is_file = false; }; } // namespace lldb diff --git a/lldb/include/lldb/API/SBSymbol.h b/lldb/include/lldb/API/SBSymbol.h --- a/lldb/include/lldb/API/SBSymbol.h +++ b/lldb/include/lldb/API/SBSymbol.h @@ -78,7 +78,7 @@ void SetSymbol(lldb_private::Symbol *lldb_object_ptr); - lldb_private::Symbol *m_opaque_ptr; + lldb_private::Symbol *m_opaque_ptr = nullptr; }; } // namespace lldb diff --git a/lldb/include/lldb/Breakpoint/BreakpointOptions.h b/lldb/include/lldb/Breakpoint/BreakpointOptions.h --- a/lldb/include/lldb/Breakpoint/BreakpointOptions.h +++ b/lldb/include/lldb/Breakpoint/BreakpointOptions.h @@ -43,9 +43,7 @@ | eCondition | eAutoContinue) }; struct CommandData { - CommandData() - : user_source(), script_source(), - interpreter(lldb::eScriptLanguageNone), stop_on_error(true) {} + CommandData() : user_source(), script_source() {} CommandData(const StringList &user_source, lldb::ScriptLanguage interp) : user_source(user_source), script_source(), interpreter(interp), @@ -63,9 +61,10 @@ StringList user_source; std::string script_source; - enum lldb::ScriptLanguage - interpreter; // eScriptLanguageNone means command interpreter. - bool stop_on_error; + enum lldb::ScriptLanguage interpreter = + lldb::eScriptLanguageNone; // eScriptLanguageNone means command + // interpreter. + bool stop_on_error = true; private: enum class OptionNames : uint32_t { diff --git a/lldb/include/lldb/Breakpoint/Stoppoint.h b/lldb/include/lldb/Breakpoint/Stoppoint.h --- a/lldb/include/lldb/Breakpoint/Stoppoint.h +++ b/lldb/include/lldb/Breakpoint/Stoppoint.h @@ -33,7 +33,7 @@ void SetID(lldb::break_id_t bid); protected: - lldb::break_id_t m_bid; + lldb::break_id_t m_bid = LLDB_INVALID_BREAK_ID; private: // For Stoppoint only diff --git a/lldb/include/lldb/Breakpoint/StoppointCallbackContext.h b/lldb/include/lldb/Breakpoint/StoppointCallbackContext.h --- a/lldb/include/lldb/Breakpoint/StoppointCallbackContext.h +++ b/lldb/include/lldb/Breakpoint/StoppointCallbackContext.h @@ -37,13 +37,14 @@ void Clear(); // Member variables - Event *event; // This is the event, the callback can modify this to indicate - // the meaning of the breakpoint hit + Event *event = nullptr; // This is the event, the callback can modify this to + // indicate the meaning of the breakpoint hit ExecutionContextRef exe_ctx_ref; // This tells us where we have stopped, what thread. - bool is_synchronous; // Is the callback being executed synchronously with the - // breakpoint, - // or asynchronously as the event is retrieved? + bool is_synchronous = + false; // Is the callback being executed synchronously with the + // breakpoint, + // or asynchronously as the event is retrieved? }; } // namespace lldb_private diff --git a/lldb/include/lldb/Breakpoint/WatchpointList.h b/lldb/include/lldb/Breakpoint/WatchpointList.h --- a/lldb/include/lldb/Breakpoint/WatchpointList.h +++ b/lldb/include/lldb/Breakpoint/WatchpointList.h @@ -198,7 +198,7 @@ wp_collection m_watchpoints; mutable std::recursive_mutex m_mutex; - lldb::watch_id_t m_next_wp_id; + lldb::watch_id_t m_next_wp_id = 0; }; } // namespace lldb_private diff --git a/lldb/include/lldb/Breakpoint/WatchpointOptions.h b/lldb/include/lldb/Breakpoint/WatchpointOptions.h --- a/lldb/include/lldb/Breakpoint/WatchpointOptions.h +++ b/lldb/include/lldb/Breakpoint/WatchpointOptions.h @@ -166,13 +166,13 @@ lldb::user_id_t watch_id); struct CommandData { - CommandData() : user_source(), script_source(), stop_on_error(true) {} + CommandData() : user_source(), script_source() {} ~CommandData() = default; StringList user_source; std::string script_source; - bool stop_on_error; + bool stop_on_error = true; }; class CommandBaton : public TypedBaton { @@ -191,7 +191,7 @@ // For WatchpointOptions only WatchpointHitCallback m_callback; // This is the callback function pointer lldb::BatonSP m_callback_baton_sp; // This is the client data for the callback - bool m_callback_is_synchronous; + bool m_callback_is_synchronous = false; std::unique_ptr m_thread_spec_up; // Thread for which this watchpoint will take }; diff --git a/lldb/include/lldb/Core/Address.h b/lldb/include/lldb/Core/Address.h --- a/lldb/include/lldb/Core/Address.h +++ b/lldb/include/lldb/Core/Address.h @@ -116,7 +116,7 @@ /// /// Initialize with a invalid section (NULL) and an invalid offset /// (LLDB_INVALID_ADDRESS). - Address() : m_section_wp(), m_offset(LLDB_INVALID_ADDRESS) {} + Address() : m_section_wp() {} /// Copy constructor /// @@ -487,7 +487,8 @@ protected: // Member variables. lldb::SectionWP m_section_wp; ///< The section for the address, can be NULL. - lldb::addr_t m_offset; ///< Offset into section if \a m_section_wp is valid... + lldb::addr_t m_offset = LLDB_INVALID_ADDRESS; ///< Offset into section if \a + ///< m_section_wp is valid... // Returns true if the m_section_wp once had a reference to a valid section // shared pointer, but no longer does. This can happen if we have an address diff --git a/lldb/include/lldb/Core/AddressRange.h b/lldb/include/lldb/Core/AddressRange.h --- a/lldb/include/lldb/Core/AddressRange.h +++ b/lldb/include/lldb/Core/AddressRange.h @@ -239,7 +239,7 @@ protected: // Member variables Address m_base_addr; ///< The section offset base address of this range. - lldb::addr_t m_byte_size; ///< The size in bytes of this address range. + lldb::addr_t m_byte_size = 0; ///< The size in bytes of this address range. }; // bool operator== (const AddressRange& lhs, const AddressRange& rhs); diff --git a/lldb/include/lldb/Core/Declaration.h b/lldb/include/lldb/Core/Declaration.h --- a/lldb/include/lldb/Core/Declaration.h +++ b/lldb/include/lldb/Core/Declaration.h @@ -24,7 +24,7 @@ class Declaration { public: /// Default constructor. - Declaration() : m_file(), m_line(0), m_column(LLDB_INVALID_COLUMN_NUMBER) {} + Declaration() : m_file() {} /// Construct with file specification, and optional line and column. /// @@ -182,10 +182,10 @@ FileSpec m_file; /// Non-zero values indicates a valid line number, zero indicates no line /// number information is available. - uint32_t m_line; + uint32_t m_line = 0; /// Non-zero values indicates a valid column number, zero indicates no column /// information is available. - uint16_t m_column; + uint16_t m_column = LLDB_INVALID_COLUMN_NUMBER; }; bool operator==(const Declaration &lhs, const Declaration &rhs); diff --git a/lldb/include/lldb/Core/Disassembler.h b/lldb/include/lldb/Core/Disassembler.h --- a/lldb/include/lldb/Core/Disassembler.h +++ b/lldb/include/lldb/Core/Disassembler.h @@ -454,10 +454,10 @@ struct SourceLine { FileSpec file; - uint32_t line; - uint32_t column; + uint32_t line = LLDB_INVALID_LINE_NUMBER; + uint32_t column = 0; - SourceLine() : file(), line(LLDB_INVALID_LINE_NUMBER), column(0) {} + SourceLine() : file() {} bool operator==(const SourceLine &rhs) const { return file == rhs.file && line == rhs.line && rhs.column == column; @@ -476,14 +476,12 @@ // index of the "current" source line, if we want to highlight that when // displaying the source lines. (as opposed to the surrounding source // lines provided to give context) - size_t current_source_line; + size_t current_source_line = -1; // Whether to print a blank line at the end of the source lines. - bool print_source_context_end_eol; + bool print_source_context_end_eol = true; - SourceLinesToDisplay() - : lines(), current_source_line(-1), print_source_context_end_eol(true) { - } + SourceLinesToDisplay() : lines() {} }; // Get the function's declaration line number, hopefully a line number diff --git a/lldb/include/lldb/Core/EmulateInstruction.h b/lldb/include/lldb/Core/EmulateInstruction.h --- a/lldb/include/lldb/Core/EmulateInstruction.h +++ b/lldb/include/lldb/Core/EmulateInstruction.h @@ -182,8 +182,8 @@ } InfoType; struct Context { - ContextType type; - enum InfoType info_type; + ContextType type = eContextInvalid; + enum InfoType info_type = eInfoTypeNoArgs; union { struct RegisterPlusOffset { RegisterInfo reg; // base register @@ -237,7 +237,7 @@ uint32_t isa; } info; - Context() : type(eContextInvalid), info_type(eInfoTypeNoArgs) {} + Context() {} void SetRegisterPlusOffset(RegisterInfo base_reg, int64_t signed_offset) { info_type = eInfoTypeRegisterPlusOffset; diff --git a/lldb/include/lldb/Core/FileLineResolver.h b/lldb/include/lldb/Core/FileLineResolver.h --- a/lldb/include/lldb/Core/FileLineResolver.h +++ b/lldb/include/lldb/Core/FileLineResolver.h @@ -28,8 +28,8 @@ public: FileLineResolver() : m_file_spec(), - m_line_number(UINT32_MAX), // Set this to zero for all lines in a file - m_sc_list(), m_inlines(true) {} + // Set this to zero for all lines in a file + m_sc_list() {} FileLineResolver(const FileSpec &resolver, uint32_t line_no, bool check_inlines); @@ -52,10 +52,11 @@ protected: FileSpec m_file_spec; // This is the file spec we are looking for. - uint32_t m_line_number; // This is the line number that we are looking for. + uint32_t m_line_number = + UINT32_MAX; // This is the line number that we are looking for. SymbolContextList m_sc_list; - bool m_inlines; // This determines whether the resolver looks for inlined - // functions or not. + bool m_inlines = true; // This determines whether the resolver looks for + // inlined functions or not. private: FileLineResolver(const FileLineResolver &) = delete; diff --git a/lldb/include/lldb/Core/FormatEntity.h b/lldb/include/lldb/Core/FormatEntity.h --- a/lldb/include/lldb/Core/FormatEntity.h +++ b/lldb/include/lldb/Core/FormatEntity.h @@ -128,7 +128,7 @@ constexpr Definition(const char *name, const FormatEntity::Entry::Type t, const uint64_t data) - : name(name), string(nullptr), type(t), data(data) {} + : name(name), type(t), data(data) {} constexpr Definition(const char *name, const FormatEntity::Entry::Type t, const uint64_t num_children, @@ -148,8 +148,7 @@ Entry(Type t = Type::Invalid, const char *s = nullptr, const char *f = nullptr) - : string(s ? s : ""), printf_format(f ? f : ""), children(), type(t), - fmt(lldb::eFormatDefault), number(0), deref(false) {} + : string(s ? s : ""), printf_format(f ? f : ""), children(), type(t) {} Entry(llvm::StringRef s); Entry(char ch); @@ -202,9 +201,9 @@ std::string printf_format; std::vector children; Type type; - lldb::Format fmt; - lldb::addr_t number; - bool deref; + lldb::Format fmt = lldb::eFormatDefault; + lldb::addr_t number = 0; + bool deref = false; }; static bool Format(const Entry &entry, Stream &s, const SymbolContext *sc, diff --git a/lldb/include/lldb/Core/LoadedModuleInfoList.h b/lldb/include/lldb/Core/LoadedModuleInfoList.h --- a/lldb/include/lldb/Core/LoadedModuleInfoList.h +++ b/lldb/include/lldb/Core/LoadedModuleInfoList.h @@ -101,14 +101,14 @@ lldb::addr_t m_dynamic; }; - LoadedModuleInfoList() : m_list(), m_link_map(LLDB_INVALID_ADDRESS) {} + LoadedModuleInfoList() : m_list() {} void add(const LoadedModuleInfo &mod) { m_list.push_back(mod); } void clear() { m_list.clear(); } std::vector m_list; - lldb::addr_t m_link_map; + lldb::addr_t m_link_map = LLDB_INVALID_ADDRESS; }; } // namespace lldb_private diff --git a/lldb/include/lldb/Core/MappedHash.h b/lldb/include/lldb/Core/MappedHash.h --- a/lldb/include/lldb/Core/MappedHash.h +++ b/lldb/include/lldb/Core/MappedHash.h @@ -47,19 +47,17 @@ uint32_t magic; // HASH_MAGIC or HASH_CIGAM magic value to allow endian detection - uint16_t version; // Version number - uint16_t hash_function; // The hash function enumeration that was used - uint32_t bucket_count; // The number of buckets in this hash table - uint32_t hashes_count; // The total number of unique hash values and hash - // data offsets in this table + uint16_t version = 1; // Version number + uint16_t hash_function = + eHashFunctionDJB; // The hash function enumeration that was used + uint32_t bucket_count = 0; // The number of buckets in this hash table + uint32_t hashes_count = 0; // The total number of unique hash values and + // hash data offsets in this table uint32_t header_data_len; // The size in bytes of the "header_data" template // member below HeaderData header_data; // - Header() - : magic(HASH_MAGIC), version(1), hash_function(eHashFunctionDJB), - bucket_count(0), hashes_count(0), header_data_len(sizeof(T)), - header_data() {} + Header() : magic(HASH_MAGIC), header_data_len(sizeof(T)), header_data() {} virtual ~Header() = default; diff --git a/lldb/include/lldb/Core/Module.h b/lldb/include/lldb/Core/Module.h --- a/lldb/include/lldb/Core/Module.h +++ b/lldb/include/lldb/Core/Module.h @@ -885,10 +885,7 @@ /// correctly. class LookupInfo { public: - LookupInfo() - : m_name(), m_lookup_name(), m_language(lldb::eLanguageTypeUnknown), - m_name_type_mask(lldb::eFunctionNameTypeNone), - m_match_name_after_lookup(false) {} + LookupInfo() : m_name(), m_lookup_name() {} LookupInfo(ConstString name, lldb::FunctionNameType name_type_mask, lldb::LanguageType language); @@ -917,15 +914,15 @@ ConstString m_lookup_name; /// Limit matches to only be for this language - lldb::LanguageType m_language; + lldb::LanguageType m_language = lldb::eLanguageTypeUnknown; /// One or more bits from lldb::FunctionNameType that indicate what kind of /// names we are looking for - lldb::FunctionNameType m_name_type_mask; + lldb::FunctionNameType m_name_type_mask = lldb::eFunctionNameTypeNone; ///< If \b true, then demangled names that match will need to contain ///< "m_name" in order to be considered a match - bool m_match_name_after_lookup; + bool m_match_name_after_lookup = false; }; protected: @@ -952,7 +949,7 @@ ConstString m_object_name; ///< The name an object within this module that is ///selected, or empty of the module is represented ///by \a m_file. - uint64_t m_object_offset; + uint64_t m_object_offset = 0; llvm::sys::TimePoint<> m_object_mod_time; /// DataBuffer containing the module image, if it was provided at diff --git a/lldb/include/lldb/Core/ModuleList.h b/lldb/include/lldb/Core/ModuleList.h --- a/lldb/include/lldb/Core/ModuleList.h +++ b/lldb/include/lldb/Core/ModuleList.h @@ -471,7 +471,7 @@ collection m_modules; ///< The collection of modules. mutable std::recursive_mutex m_modules_mutex; - Notifier *m_notifier; + Notifier *m_notifier = nullptr; public: typedef LockingAdaptedIterable m_object_mod_time; mutable PathMappingList m_source_mappings; lldb::DataBufferSP m_data = {}; diff --git a/lldb/include/lldb/Core/Opcode.h b/lldb/include/lldb/Core/Opcode.h --- a/lldb/include/lldb/Core/Opcode.h +++ b/lldb/include/lldb/Core/Opcode.h @@ -38,7 +38,7 @@ eTypeBytes }; - Opcode() : m_byte_order(lldb::eByteOrderInvalid), m_type(eTypeInvalid) {} + Opcode() {} Opcode(uint8_t inst, lldb::ByteOrder order) : m_byte_order(order), m_type(eType8) { @@ -252,9 +252,9 @@ endian::InlHostByteOrder() == lldb::eByteOrderBig); } - lldb::ByteOrder m_byte_order; + lldb::ByteOrder m_byte_order = lldb::eByteOrderInvalid; - Opcode::Type m_type; + Opcode::Type m_type = eTypeInvalid; union { uint8_t inst8; uint16_t inst16; diff --git a/lldb/include/lldb/Core/RichManglingContext.h b/lldb/include/lldb/Core/RichManglingContext.h --- a/lldb/include/lldb/Core/RichManglingContext.h +++ b/lldb/include/lldb/Core/RichManglingContext.h @@ -24,7 +24,7 @@ /// providers. See Mangled::DemangleWithRichManglingInfo() class RichManglingContext { public: - RichManglingContext() : m_provider(None), m_ipd_buf_size(2048) { + RichManglingContext() { m_ipd_buf = static_cast(std::malloc(m_ipd_buf_size)); m_ipd_buf[0] = '\0'; } @@ -70,7 +70,7 @@ enum InfoProvider { None, ItaniumPartialDemangler, PluginCxxLanguage }; /// Selects the rich mangling info provider. - InfoProvider m_provider; + InfoProvider m_provider = None; /// Reference to the buffer used for results of ParseXy() operations. llvm::StringRef m_buffer; @@ -81,7 +81,7 @@ /// ItaniumPartialDemangler. It should be managed with malloc/free, not /// new/delete. char *m_ipd_buf; - size_t m_ipd_buf_size; + size_t m_ipd_buf_size = 2048; /// Members for PluginCxxLanguage /// Cannot forward declare inner class CPlusPlusLanguage::MethodName. The diff --git a/lldb/include/lldb/Core/Value.h b/lldb/include/lldb/Core/Value.h --- a/lldb/include/lldb/Core/Value.h +++ b/lldb/include/lldb/Core/Value.h @@ -148,9 +148,9 @@ protected: Scalar m_value; CompilerType m_compiler_type; - void *m_context; - ValueType m_value_type; - ContextType m_context_type; + void *m_context = nullptr; + ValueType m_value_type = ValueType::Scalar; + ContextType m_context_type = ContextType::Invalid; DataBufferHeap m_data_buffer; }; diff --git a/lldb/include/lldb/Core/ValueObject.h b/lldb/include/lldb/Core/ValueObject.h --- a/lldb/include/lldb/Core/ValueObject.h +++ b/lldb/include/lldb/Core/ValueObject.h @@ -318,7 +318,7 @@ ProcessModID m_mod_id; // This is the stop id when this ValueObject was last // evaluated. ExecutionContextRef m_exe_ctx_ref; - bool m_needs_update; + bool m_needs_update = true; }; virtual ~ValueObject(); @@ -795,7 +795,7 @@ class ChildrenManager { public: - ChildrenManager() : m_mutex(), m_children(), m_children_count(0) {} + ChildrenManager() : m_mutex(), m_children() {} bool HasChildAtIndex(size_t idx) { std::lock_guard guard(m_mutex); @@ -831,7 +831,7 @@ typedef ChildrenMap::value_type ChildrenPair; std::recursive_mutex m_mutex; ChildrenMap m_children; - size_t m_children_count; + size_t m_children_count = 0; }; // Classes that inherit from ValueObject can see and modify these diff --git a/lldb/include/lldb/DataFormatters/DumpValueObjectOptions.h b/lldb/include/lldb/DataFormatters/DumpValueObjectOptions.h --- a/lldb/include/lldb/DataFormatters/DumpValueObjectOptions.h +++ b/lldb/include/lldb/DataFormatters/DumpValueObjectOptions.h @@ -35,12 +35,11 @@ }; struct PointerAsArraySettings { - size_t m_element_count; - size_t m_base_element; - size_t m_stride; + size_t m_element_count = 0; + size_t m_base_element = 0; + size_t m_stride = 0; - PointerAsArraySettings() - : m_element_count(0), m_base_element(0), m_stride() {} + PointerAsArraySettings() {} PointerAsArraySettings(size_t elem_count, size_t base_elem = 0, size_t stride = 1) diff --git a/lldb/include/lldb/DataFormatters/FormatClasses.h b/lldb/include/lldb/DataFormatters/FormatClasses.h --- a/lldb/include/lldb/DataFormatters/FormatClasses.h +++ b/lldb/include/lldb/DataFormatters/FormatClasses.h @@ -105,7 +105,7 @@ class TypeNameSpecifierImpl { public: - TypeNameSpecifierImpl() : m_is_regex(false), m_type() {} + TypeNameSpecifierImpl() : m_type() {} TypeNameSpecifierImpl(llvm::StringRef name, bool is_regex) : m_is_regex(is_regex), m_type() { @@ -143,7 +143,7 @@ bool IsRegex() { return m_is_regex; } private: - bool m_is_regex; + bool m_is_regex = false; // TODO: Replace this with TypeAndOrName. struct TypeOrName { std::string m_type_name; diff --git a/lldb/include/lldb/DataFormatters/TypeFormat.h b/lldb/include/lldb/DataFormatters/TypeFormat.h --- a/lldb/include/lldb/DataFormatters/TypeFormat.h +++ b/lldb/include/lldb/DataFormatters/TypeFormat.h @@ -25,7 +25,7 @@ public: class Flags { public: - Flags() : m_flags(lldb::eTypeOptionCascade) {} + Flags() {} Flags(const Flags &other) : m_flags(other.m_flags) {} @@ -104,7 +104,7 @@ void SetValue(uint32_t value) { m_flags = value; } private: - uint32_t m_flags; + uint32_t m_flags = lldb::eTypeOptionCascade; }; TypeFormatImpl(const Flags &flags = Flags()); @@ -149,7 +149,7 @@ protected: Flags m_flags; - uint32_t m_my_revision; + uint32_t m_my_revision = 0; private: TypeFormatImpl(const TypeFormatImpl &) = delete; diff --git a/lldb/include/lldb/DataFormatters/TypeSummary.h b/lldb/include/lldb/DataFormatters/TypeSummary.h --- a/lldb/include/lldb/DataFormatters/TypeSummary.h +++ b/lldb/include/lldb/DataFormatters/TypeSummary.h @@ -38,8 +38,8 @@ TypeSummaryOptions &SetCapping(lldb::TypeSummaryCapping); private: - lldb::LanguageType m_lang; - lldb::TypeSummaryCapping m_capping; + lldb::LanguageType m_lang = lldb::eLanguageTypeUnknown; + lldb::TypeSummaryCapping m_capping = lldb::eTypeSummaryCapped; }; class TypeSummaryImpl { @@ -52,7 +52,7 @@ class Flags { public: - Flags() : m_flags(lldb::eTypeOptionCascade) {} + Flags() {} Flags(const Flags &other) : m_flags(other.m_flags) {} @@ -196,7 +196,7 @@ void SetValue(uint32_t value) { m_flags = value; } private: - uint32_t m_flags; + uint32_t m_flags = lldb::eTypeOptionCascade; }; bool Cascades() const { return m_flags.GetCascades(); } diff --git a/lldb/include/lldb/DataFormatters/TypeSynthetic.h b/lldb/include/lldb/DataFormatters/TypeSynthetic.h --- a/lldb/include/lldb/DataFormatters/TypeSynthetic.h +++ b/lldb/include/lldb/DataFormatters/TypeSynthetic.h @@ -133,7 +133,7 @@ public: class Flags { public: - Flags() : m_flags(lldb::eTypeOptionCascade) {} + Flags() {} Flags(const Flags &other) : m_flags(other.m_flags) {} @@ -225,7 +225,7 @@ void SetValue(uint32_t value) { m_flags = value; } private: - uint32_t m_flags; + uint32_t m_flags = lldb::eTypeOptionCascade; }; SyntheticChildren(const Flags &flags) : m_flags(flags) {} diff --git a/lldb/include/lldb/Expression/DWARFExpression.h b/lldb/include/lldb/Expression/DWARFExpression.h --- a/lldb/include/lldb/Expression/DWARFExpression.h +++ b/lldb/include/lldb/Expression/DWARFExpression.h @@ -250,10 +250,10 @@ /// The DWARF compile unit this expression belongs to. It is used to evaluate /// values indexing into the .debug_addr section (e.g. DW_OP_GNU_addr_index, /// DW_OP_GNU_const_index) - const DWARFUnit *m_dwarf_cu; + const DWARFUnit *m_dwarf_cu = nullptr; /// One of the defines that starts with LLDB_REGKIND_ - lldb::RegisterKind m_reg_kind; + lldb::RegisterKind m_reg_kind = lldb::eRegisterKindDWARF; struct LoclistAddresses { lldb::addr_t cu_file_addr; diff --git a/lldb/include/lldb/Expression/Materializer.h b/lldb/include/lldb/Expression/Materializer.h --- a/lldb/include/lldb/Expression/Materializer.h +++ b/lldb/include/lldb/Expression/Materializer.h @@ -90,7 +90,7 @@ class Entity { public: - Entity() : m_alignment(1), m_size(0), m_offset(0) {} + Entity() {} virtual ~Entity() = default; @@ -113,9 +113,9 @@ void SetOffset(uint32_t offset) { m_offset = offset; } protected: - uint32_t m_alignment; - uint32_t m_size; - uint32_t m_offset; + uint32_t m_alignment = 1; + uint32_t m_size = 0; + uint32_t m_offset = 0; }; private: diff --git a/lldb/include/lldb/Host/File.h b/lldb/include/lldb/Host/File.h --- a/lldb/include/lldb/Host/File.h +++ b/lldb/include/lldb/Host/File.h @@ -65,10 +65,7 @@ static llvm::Expected GetStreamOpenModeFromOptions(OpenOptions options); - File() - : IOObject(eFDTypeFile), m_is_interactive(eLazyBoolCalculate), - m_is_real_terminal(eLazyBoolCalculate), - m_supports_colors(eLazyBoolCalculate){}; + File() : IOObject(eFDTypeFile){}; /// Read bytes from a file from the current file position into buf. /// @@ -360,9 +357,9 @@ static bool classof(const File *file) { return file->isA(&ID); } protected: - LazyBool m_is_interactive; - LazyBool m_is_real_terminal; - LazyBool m_supports_colors; + LazyBool m_is_interactive = eLazyBoolCalculate; + LazyBool m_is_real_terminal = eLazyBoolCalculate; + LazyBool m_supports_colors = eLazyBoolCalculate; void CalculateInteractiveAndTerminal(); @@ -373,9 +370,7 @@ class NativeFile : public File { public: - NativeFile() - : m_descriptor(kInvalidDescriptor), m_own_descriptor(false), - m_stream(kInvalidStream), m_options(), m_own_stream(false) {} + NativeFile() : m_descriptor(kInvalidDescriptor), m_stream(kInvalidStream) {} NativeFile(FILE *fh, bool transfer_ownership) : m_descriptor(kInvalidDescriptor), m_own_descriptor(false), m_stream(fh), @@ -422,10 +417,10 @@ // Member variables int m_descriptor; - bool m_own_descriptor; + bool m_own_descriptor = false; FILE *m_stream; - OpenOptions m_options; - bool m_own_stream; + OpenOptions m_options{}; + bool m_own_stream = false; std::mutex offset_access_mutex; private: diff --git a/lldb/include/lldb/Host/FileAction.h b/lldb/include/lldb/Host/FileAction.h --- a/lldb/include/lldb/Host/FileAction.h +++ b/lldb/include/lldb/Host/FileAction.h @@ -46,9 +46,9 @@ void Dump(Stream &stream) const; protected: - Action m_action; // The action for this file - int m_fd; // An existing file descriptor - int m_arg; // oflag for eFileActionOpen*, dup_fd for eFileActionDuplicate + Action m_action = eFileActionNone; // The action for this file + int m_fd = -1; // An existing file descriptor + int m_arg = -1; // oflag for eFileActionOpen*, dup_fd for eFileActionDuplicate FileSpec m_file_spec; // A file spec to use for opening after fork or posix_spawn }; diff --git a/lldb/include/lldb/Host/FileSystem.h b/lldb/include/lldb/Host/FileSystem.h --- a/lldb/include/lldb/Host/FileSystem.h +++ b/lldb/include/lldb/Host/FileSystem.h @@ -33,7 +33,7 @@ FileSystem() : m_fs(llvm::vfs::getRealFileSystem()), m_collector(nullptr), - m_home_directory(), m_mapped(false) {} + m_home_directory() {} FileSystem(std::shared_ptr collector) : m_fs(llvm::vfs::getRealFileSystem()), m_collector(std::move(collector)), m_home_directory(), m_mapped(false) {} @@ -201,7 +201,7 @@ llvm::IntrusiveRefCntPtr m_fs; std::shared_ptr m_collector; std::string m_home_directory; - bool m_mapped; + bool m_mapped = false; }; } // namespace lldb_private diff --git a/lldb/include/lldb/Host/HostNativeThreadBase.h b/lldb/include/lldb/Host/HostNativeThreadBase.h --- a/lldb/include/lldb/Host/HostNativeThreadBase.h +++ b/lldb/include/lldb/Host/HostNativeThreadBase.h @@ -46,7 +46,7 @@ ThreadCreateTrampoline(lldb::thread_arg_t arg); lldb::thread_t m_thread; - lldb::thread_result_t m_result; + lldb::thread_result_t m_result = 0; }; } diff --git a/lldb/include/lldb/Host/ProcessLaunchInfo.h b/lldb/include/lldb/Host/ProcessLaunchInfo.h --- a/lldb/include/lldb/Host/ProcessLaunchInfo.h +++ b/lldb/include/lldb/Host/ProcessLaunchInfo.h @@ -176,10 +176,10 @@ Flags m_flags; // Bitwise OR of bits from lldb::LaunchFlags std::vector m_file_actions; // File actions for any other files std::shared_ptr m_pty; - uint32_t m_resume_count; // How many times do we resume after launching + uint32_t m_resume_count = 0; // How many times do we resume after launching Host::MonitorChildProcessCallback m_monitor_callback; - void *m_monitor_callback_baton; - bool m_monitor_signals; + void *m_monitor_callback_baton = nullptr; + bool m_monitor_signals = false; std::string m_event_data; // A string passed to the plugin launch, having no // meaning to the upper levels of lldb. lldb::ListenerSP m_listener_sp; diff --git a/lldb/include/lldb/Host/ProcessRunLock.h b/lldb/include/lldb/Host/ProcessRunLock.h --- a/lldb/include/lldb/Host/ProcessRunLock.h +++ b/lldb/include/lldb/Host/ProcessRunLock.h @@ -35,7 +35,7 @@ class ProcessRunLocker { public: - ProcessRunLocker() : m_lock(nullptr) {} + ProcessRunLocker() {} ~ProcessRunLocker() { Unlock(); } @@ -64,7 +64,7 @@ } } - ProcessRunLock *m_lock; + ProcessRunLock *m_lock = nullptr; private: ProcessRunLocker(const ProcessRunLocker &) = delete; @@ -73,7 +73,7 @@ protected: lldb::rwlock_t m_rwlock; - bool m_running; + bool m_running = false; private: ProcessRunLock(const ProcessRunLock &) = delete; diff --git a/lldb/include/lldb/Host/PseudoTerminal.h b/lldb/include/lldb/Host/PseudoTerminal.h --- a/lldb/include/lldb/Host/PseudoTerminal.h +++ b/lldb/include/lldb/Host/PseudoTerminal.h @@ -175,8 +175,8 @@ protected: // Member variables - int m_primary_fd; ///< The file descriptor for the primary. - int m_secondary_fd; ///< The file descriptor for the secondary. + int m_primary_fd = invalid_fd; ///< The file descriptor for the primary. + int m_secondary_fd = invalid_fd; ///< The file descriptor for the secondary. private: PseudoTerminal(const PseudoTerminal &) = delete; diff --git a/lldb/include/lldb/Host/Terminal.h b/lldb/include/lldb/Host/Terminal.h --- a/lldb/include/lldb/Host/Terminal.h +++ b/lldb/include/lldb/Host/Terminal.h @@ -116,12 +116,12 @@ // Member variables Terminal m_tty; ///< A terminal - int m_tflags; ///< Cached tflags information. + int m_tflags = -1; ///< Cached tflags information. #if LLDB_ENABLE_TERMIOS std::unique_ptr m_termios_up; ///< Cached terminal state information. #endif - lldb::pid_t m_process_group; ///< Cached process group information. + lldb::pid_t m_process_group = -1; ///< Cached process group information. }; /// \class TerminalStateSwitcher Terminal.h "lldb/Host/Terminal.h" @@ -171,7 +171,8 @@ protected: // Member variables - mutable uint32_t m_currentState; ///< The currently active TTY state index. + mutable uint32_t m_currentState = + UINT32_MAX; ///< The currently active TTY state index. TerminalState m_ttystates[2]; ///< The array of TTY states that holds saved TTY info. }; diff --git a/lldb/include/lldb/Host/XML.h b/lldb/include/lldb/Host/XML.h --- a/lldb/include/lldb/Host/XML.h +++ b/lldb/include/lldb/Host/XML.h @@ -107,7 +107,7 @@ void ForEachAttribute(AttributeCallback const &callback) const; protected: - XMLNodeImpl m_node; + XMLNodeImpl m_node = nullptr; }; class XMLDocument { @@ -138,7 +138,7 @@ static bool XMLEnabled(); protected: - XMLDocumentImpl m_document; + XMLDocumentImpl m_document = nullptr; StreamString m_errors; }; diff --git a/lldb/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h b/lldb/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h --- a/lldb/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h +++ b/lldb/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h @@ -108,7 +108,7 @@ std::atomic m_shutting_down; // This marks that we are shutting down so // if we get woken up from // BytesAvailable to disconnect, we won't try to read again. - bool m_waiting_for_accept; + bool m_waiting_for_accept = false; bool m_child_processes_inherit; std::string m_uri; diff --git a/lldb/include/lldb/Initialization/SystemLifetimeManager.h b/lldb/include/lldb/Initialization/SystemLifetimeManager.h --- a/lldb/include/lldb/Initialization/SystemLifetimeManager.h +++ b/lldb/include/lldb/Initialization/SystemLifetimeManager.h @@ -30,7 +30,7 @@ private: std::recursive_mutex m_mutex; std::unique_ptr m_initializer; - bool m_initialized; + bool m_initialized = false; // Noncopyable. SystemLifetimeManager(const SystemLifetimeManager &other) = delete; diff --git a/lldb/include/lldb/Interpreter/CommandInterpreter.h b/lldb/include/lldb/Interpreter/CommandInterpreter.h --- a/lldb/include/lldb/Interpreter/CommandInterpreter.h +++ b/lldb/include/lldb/Interpreter/CommandInterpreter.h @@ -33,8 +33,7 @@ class CommandInterpreterRunResult { public: - CommandInterpreterRunResult() - : m_num_errors(0), m_result(lldb::eCommandInterpreterResultSuccess) {} + CommandInterpreterRunResult() {} uint32_t GetNumErrors() const { return m_num_errors; } @@ -52,8 +51,9 @@ void SetResult(lldb::CommandInterpreterResult result) { m_result = result; } private: - int m_num_errors; - lldb::CommandInterpreterResult m_result; + int m_num_errors = 0; + lldb::CommandInterpreterResult m_result = + lldb::eCommandInterpreterResultSuccess; }; class CommandInterpreterRunOptions { @@ -101,13 +101,8 @@ m_print_errors(print_errors), m_add_to_history(add_to_history) {} CommandInterpreterRunOptions() - : m_stop_on_continue(eLazyBoolCalculate), - m_stop_on_error(eLazyBoolCalculate), - m_stop_on_crash(eLazyBoolCalculate), - m_echo_commands(eLazyBoolCalculate), - m_echo_comment_commands(eLazyBoolCalculate), - m_print_results(eLazyBoolCalculate), m_print_errors(eLazyBoolCalculate), - m_add_to_history(eLazyBoolCalculate) {} + + {} void SetSilent(bool silent) { LazyBool value = silent ? eLazyBoolNo : eLazyBoolYes; @@ -187,14 +182,14 @@ m_spawn_thread = spawn_thread ? eLazyBoolYes : eLazyBoolNo; } - LazyBool m_stop_on_continue; - LazyBool m_stop_on_error; - LazyBool m_stop_on_crash; - LazyBool m_echo_commands; - LazyBool m_echo_comment_commands; - LazyBool m_print_results; - LazyBool m_print_errors; - LazyBool m_add_to_history; + LazyBool m_stop_on_continue = eLazyBoolCalculate; + LazyBool m_stop_on_error = eLazyBoolCalculate; + LazyBool m_stop_on_crash = eLazyBoolCalculate; + LazyBool m_echo_commands = eLazyBoolCalculate; + LazyBool m_echo_comment_commands = eLazyBoolCalculate; + LazyBool m_print_results = eLazyBoolCalculate; + LazyBool m_print_errors = eLazyBoolCalculate; + LazyBool m_add_to_history = eLazyBoolCalculate; LazyBool m_auto_handle_events; LazyBool m_spawn_thread; diff --git a/lldb/include/lldb/Interpreter/OptionValue.h b/lldb/include/lldb/Interpreter/OptionValue.h --- a/lldb/include/lldb/Interpreter/OptionValue.h +++ b/lldb/include/lldb/Interpreter/OptionValue.h @@ -60,7 +60,7 @@ eDumpGroupExport = (eDumpOptionCommand | eDumpOptionName | eDumpOptionValue) }; - OptionValue() : m_value_was_set(false) {} + OptionValue() {} virtual ~OptionValue() = default; @@ -329,12 +329,12 @@ lldb::OptionValueWP m_parent_wp; std::function m_callback; - bool m_value_was_set; // This can be used to see if a value has been set - // by a call to SetValueFromCString(). It is often - // handy to know if an option value was set from the - // command line or as a setting, versus if we just have - // the default value that was already populated in the - // option value. + bool m_value_was_set = false; // This can be used to see if a value has been + // set by a call to SetValueFromCString(). It is + // often handy to know if an option value was + // set from the command line or as a setting, + // versus if we just have the default value that + // was already populated in the option value. }; } // namespace lldb_private diff --git a/lldb/include/lldb/Interpreter/OptionValueFileColonLine.h b/lldb/include/lldb/Interpreter/OptionValueFileColonLine.h --- a/lldb/include/lldb/Interpreter/OptionValueFileColonLine.h +++ b/lldb/include/lldb/Interpreter/OptionValueFileColonLine.h @@ -9,8 +9,8 @@ #ifndef LLDB_INTERPRETER_OPTIONVALUEFILECOLONLINE_H #define LLDB_INTERPRETER_OPTIONVALUEFILECOLONLINE_H +#include "lldb/Interpreter/CommandCompletions.h" #include "lldb/Interpreter/OptionValue.h" - #include "lldb/Utility/FileSpec.h" #include "llvm/Support/Chrono.h" @@ -50,9 +50,9 @@ protected: FileSpec m_file_spec; - uint32_t m_line_number; - uint32_t m_column_number; - uint32_t m_completion_mask; + uint32_t m_line_number = LLDB_INVALID_LINE_NUMBER; + uint32_t m_column_number = LLDB_INVALID_COLUMN_NUMBER; + uint32_t m_completion_mask = CommandCompletions::eSourceFileCompletion; }; } // namespace lldb_private diff --git a/lldb/include/lldb/Interpreter/OptionValueFileSpec.h b/lldb/include/lldb/Interpreter/OptionValueFileSpec.h --- a/lldb/include/lldb/Interpreter/OptionValueFileSpec.h +++ b/lldb/include/lldb/Interpreter/OptionValueFileSpec.h @@ -9,6 +9,7 @@ #ifndef LLDB_INTERPRETER_OPTIONVALUEFILESPEC_H #define LLDB_INTERPRETER_OPTIONVALUEFILESPEC_H +#include "lldb/Interpreter/CommandCompletions.h" #include "lldb/Interpreter/OptionValue.h" #include "lldb/Utility/FileSpec.h" @@ -74,7 +75,7 @@ FileSpec m_default_value; lldb::DataBufferSP m_data_sp; llvm::sys::TimePoint<> m_data_mod_time; - uint32_t m_completion_mask; + uint32_t m_completion_mask = CommandCompletions::eDiskFileCompletion; bool m_resolve; }; diff --git a/lldb/include/lldb/Interpreter/Options.h b/lldb/include/lldb/Interpreter/Options.h --- a/lldb/include/lldb/Interpreter/Options.h +++ b/lldb/include/lldb/Interpreter/Options.h @@ -254,7 +254,7 @@ class OptionGroupOptions : public Options { public: - OptionGroupOptions() : m_did_finalize(false) {} + OptionGroupOptions() {} ~OptionGroupOptions() override = default; @@ -317,7 +317,7 @@ std::vector m_option_defs; OptionInfos m_option_infos; - bool m_did_finalize; + bool m_did_finalize = false; }; } // namespace lldb_private diff --git a/lldb/include/lldb/Interpreter/ScriptInterpreter.h b/lldb/include/lldb/Interpreter/ScriptInterpreter.h --- a/lldb/include/lldb/Interpreter/ScriptInterpreter.h +++ b/lldb/include/lldb/Interpreter/ScriptInterpreter.h @@ -94,8 +94,7 @@ struct ExecuteScriptOptions { public: - ExecuteScriptOptions() - : m_enable_io(true), m_set_lldb_globals(true), m_maskout_errors(true) {} + ExecuteScriptOptions() {} bool GetEnableIO() const { return m_enable_io; } @@ -122,9 +121,9 @@ } private: - bool m_enable_io; - bool m_set_lldb_globals; - bool m_maskout_errors; + bool m_enable_io = true; + bool m_set_lldb_globals = true; + bool m_maskout_errors = true; }; virtual bool Interrupt() { return false; } diff --git a/lldb/include/lldb/Symbol/CompactUnwindInfo.h b/lldb/include/lldb/Symbol/CompactUnwindInfo.h --- a/lldb/include/lldb/Symbol/CompactUnwindInfo.h +++ b/lldb/include/lldb/Symbol/CompactUnwindInfo.h @@ -50,21 +50,20 @@ // There are relatively few of these (one per 500/1000 functions, depending // on format) so creating them on first scan will not be too costly. struct UnwindIndex { - uint32_t function_offset; // The offset of the first function covered by - // this index - uint32_t second_level; // The offset (inside unwind_info sect) to the second - // level page for this index + uint32_t function_offset = 0; // The offset of the first function covered by + // this index + uint32_t second_level = 0; // The offset (inside unwind_info sect) to the + // second level page for this index // (either UNWIND_SECOND_LEVEL_REGULAR or UNWIND_SECOND_LEVEL_COMPRESSED) - uint32_t lsda_array_start; // The offset (inside unwind_info sect) LSDA - // array for this index - uint32_t lsda_array_end; // The offset to the LSDA array for the NEXT index - bool sentinal_entry; // There is an empty index at the end which provides - // the upper bound of + uint32_t lsda_array_start = 0; // The offset (inside unwind_info sect) LSDA + // array for this index + uint32_t lsda_array_end = + 0; // The offset to the LSDA array for the NEXT index + bool sentinal_entry = false; // There is an empty index at the end which + // provides the upper bound of // function addresses that are described - UnwindIndex() - : function_offset(0), second_level(0), lsda_array_start(0), - lsda_array_end(0), sentinal_entry(false) {} + UnwindIndex() {} bool operator<(const CompactUnwindInfo::UnwindIndex &rhs) const { return function_offset < rhs.function_offset; @@ -78,30 +77,26 @@ // An internal object used to store the information we retrieve about a // function -- the encoding bits and possibly the LSDA/personality function. struct FunctionInfo { - uint32_t encoding; // compact encoding 32-bit value for this function + uint32_t encoding = 0; // compact encoding 32-bit value for this function Address lsda_address; // the address of the LSDA data for this function Address personality_ptr_address; // the address where the personality // routine addr can be found - uint32_t valid_range_offset_start; // first offset that this encoding is - // valid for (start of the function) - uint32_t - valid_range_offset_end; // the offset of the start of the next function - FunctionInfo() - : encoding(0), lsda_address(), personality_ptr_address(), - valid_range_offset_start(0), valid_range_offset_end(0) {} + uint32_t valid_range_offset_start = 0; // first offset that this encoding is + // valid for (start of the function) + uint32_t valid_range_offset_end = + 0; // the offset of the start of the next function + FunctionInfo() : lsda_address(), personality_ptr_address() {} }; struct UnwindHeader { uint32_t version; - uint32_t common_encodings_array_offset; - uint32_t common_encodings_array_count; - uint32_t personality_array_offset; - uint32_t personality_array_count; - - UnwindHeader() - : common_encodings_array_offset(0), common_encodings_array_count(0), - personality_array_offset(0), personality_array_count(0) {} + uint32_t common_encodings_array_offset = 0; + uint32_t common_encodings_array_count = 0; + uint32_t personality_array_offset = 0; + uint32_t personality_array_count = 0; + + UnwindHeader() {} }; void ScanIndex(const lldb::ProcessSP &process_sp); diff --git a/lldb/include/lldb/Symbol/LineEntry.h b/lldb/include/lldb/Symbol/LineEntry.h --- a/lldb/include/lldb/Symbol/LineEntry.h +++ b/lldb/include/lldb/Symbol/LineEntry.h @@ -140,10 +140,12 @@ FileSpec file; ///< The source file, possibly mapped by the target.source-map ///setting FileSpec original_file; ///< The original source file, from debug info. - uint32_t line; ///< The source line number, or zero if there is no line number - ///information. - uint16_t column; ///< The column number of the source line, or zero if there - ///is no column information. + uint32_t line = LLDB_INVALID_LINE_NUMBER; ///< The source line number, or zero + ///< if there is no line number + /// information. + uint16_t column = + 0; ///< The column number of the source line, or zero if there + /// is no column information. uint16_t is_start_of_statement : 1, ///< Indicates this entry is the beginning ///of a statement. is_start_of_basic_block : 1, ///< Indicates this entry is the beginning of diff --git a/lldb/include/lldb/Symbol/LineTable.h b/lldb/include/lldb/Symbol/LineTable.h --- a/lldb/include/lldb/Symbol/LineTable.h +++ b/lldb/include/lldb/Symbol/LineTable.h @@ -209,10 +209,9 @@ protected: struct Entry { Entry() - : file_addr(LLDB_INVALID_ADDRESS), line(0), - is_start_of_statement(false), is_start_of_basic_block(false), + : line(0), is_start_of_statement(false), is_start_of_basic_block(false), is_prologue_end(false), is_epilogue_begin(false), - is_terminal_entry(false), column(0), file_idx(0) {} + is_terminal_entry(false) {} Entry(lldb::addr_t _file_addr, uint32_t _line, uint16_t _column, uint16_t _file_idx, bool _is_start_of_statement, @@ -279,7 +278,7 @@ // Member variables. /// The file address for this line entry. - lldb::addr_t file_addr; + lldb::addr_t file_addr = LLDB_INVALID_ADDRESS; /// The source line number, or zero if there is no line number /// information. uint32_t line : 27; @@ -298,10 +297,10 @@ uint32_t is_terminal_entry : 1; /// The column number of the source line, or zero if there is no /// column information. - uint16_t column; + uint16_t column = 0; /// The file index into CompileUnit's file table, or zero if there /// is no file information. - uint16_t file_idx; + uint16_t file_idx = 0; }; struct EntrySearchInfo { diff --git a/lldb/include/lldb/Symbol/Symbol.h b/lldb/include/lldb/Symbol/Symbol.h --- a/lldb/include/lldb/Symbol/Symbol.h +++ b/lldb/include/lldb/Symbol/Symbol.h @@ -233,8 +233,9 @@ lldb_private::ModuleSpec &module_spec, lldb_private::ModuleList &seen_modules) const; - uint32_t m_uid; // User ID (usually the original symbol table index) - uint16_t m_type_data; // data specific to m_type + uint32_t m_uid = + UINT32_MAX; // User ID (usually the original symbol table index) + uint16_t m_type_data = 0; // data specific to m_type uint16_t m_type_data_resolved : 1, // True if the data in m_type_data has // already been calculated m_is_synthetic : 1, // non-zero if this symbol is not actually in the @@ -261,8 +262,8 @@ AddressRange m_addr_range; // Contains the value, or the section offset // address when the value is an address in a // section, and the size (if any) - uint32_t m_flags; // A copy of the flags from the original symbol table, the - // ObjectFile plug-in can interpret these + uint32_t m_flags = 0; // A copy of the flags from the original symbol table, + // the ObjectFile plug-in can interpret these }; } // namespace lldb_private diff --git a/lldb/include/lldb/Symbol/SymbolContext.h b/lldb/include/lldb/Symbol/SymbolContext.h --- a/lldb/include/lldb/Symbol/SymbolContext.h +++ b/lldb/include/lldb/Symbol/SymbolContext.h @@ -316,12 +316,13 @@ // Member variables lldb::TargetSP target_sp; ///< The Target for a given query lldb::ModuleSP module_sp; ///< The Module for a given query - CompileUnit *comp_unit; ///< The CompileUnit for a given query - Function *function; ///< The Function for a given query - Block *block; ///< The Block for a given query + CompileUnit *comp_unit = nullptr; ///< The CompileUnit for a given query + Function *function = nullptr; ///< The Function for a given query + Block *block = nullptr; ///< The Block for a given query LineEntry line_entry; ///< The LineEntry for a given query - Symbol *symbol; ///< The Symbol for a given query - Variable *variable; ///< The global variable matching the given query + Symbol *symbol = nullptr; ///< The Symbol for a given query + Variable *variable = + nullptr; ///< The global variable matching the given query }; class SymbolContextSpecifier { diff --git a/lldb/include/lldb/Symbol/Type.h b/lldb/include/lldb/Symbol/Type.h --- a/lldb/include/lldb/Symbol/Type.h +++ b/lldb/include/lldb/Symbol/Type.h @@ -213,17 +213,17 @@ protected: ConstString m_name; - SymbolFile *m_symbol_file; + SymbolFile *m_symbol_file = nullptr; /// The symbol context in which this type is defined. - SymbolContextScope *m_context; - Type *m_encoding_type; - lldb::user_id_t m_encoding_uid; - EncodingDataType m_encoding_uid_type; + SymbolContextScope *m_context = nullptr; + Type *m_encoding_type = nullptr; + lldb::user_id_t m_encoding_uid = LLDB_INVALID_UID; + EncodingDataType m_encoding_uid_type = eEncodingInvalid; uint64_t m_byte_size : 63; uint64_t m_byte_size_has_value : 1; Declaration m_decl; CompilerType m_compiler_type; - ResolveState m_compiler_type_resolve_state; + ResolveState m_compiler_type_resolve_state = ResolveState::Unresolved; /// Language-specific flags. Payload m_payload; @@ -340,8 +340,7 @@ class TypeMemberImpl { public: TypeMemberImpl() - : m_type_impl_sp(), m_bit_offset(0), m_name(), m_bitfield_bit_size(0), - m_is_bitfield(false) + : m_type_impl_sp(), m_name() {} @@ -376,10 +375,10 @@ protected: lldb::TypeImplSP m_type_impl_sp; - uint64_t m_bit_offset; + uint64_t m_bit_offset = 0; ConstString m_name; - uint32_t m_bitfield_bit_size; // Bit size for bitfield members only - bool m_is_bitfield; + uint32_t m_bitfield_bit_size = 0; // Bit size for bitfield members only + bool m_is_bitfield = false; }; /// @@ -435,9 +434,7 @@ class TypeMemberFunctionImpl { public: - TypeMemberFunctionImpl() - : m_type(), m_decl(), m_name(), m_kind(lldb::eMemberFunctionKindUnknown) { - } + TypeMemberFunctionImpl() : m_type(), m_decl(), m_name() {} TypeMemberFunctionImpl(const CompilerType &type, const CompilerDecl &decl, const std::string &name, @@ -469,13 +466,12 @@ CompilerType m_type; CompilerDecl m_decl; ConstString m_name; - lldb::MemberFunctionKind m_kind; + lldb::MemberFunctionKind m_kind = lldb::eMemberFunctionKindUnknown; }; class TypeEnumMemberImpl { public: - TypeEnumMemberImpl() - : m_integer_type_sp(), m_name(""), m_value(), m_valid(false) {} + TypeEnumMemberImpl() : m_integer_type_sp(), m_name(""), m_value() {} TypeEnumMemberImpl(const lldb::TypeImplSP &integer_type_sp, ConstString name, const llvm::APSInt &value); @@ -498,7 +494,7 @@ lldb::TypeImplSP m_integer_type_sp; ConstString m_name; llvm::APSInt m_value; - bool m_valid; + bool m_valid = false; }; class TypeEnumMemberListImpl { diff --git a/lldb/include/lldb/Symbol/TypeSystem.h b/lldb/include/lldb/Symbol/TypeSystem.h --- a/lldb/include/lldb/Symbol/TypeSystem.h +++ b/lldb/include/lldb/Symbol/TypeSystem.h @@ -524,7 +524,7 @@ mutable std::mutex m_mutex; ///< A mutex to keep this object happy in ///multi-threaded environments. collection m_map; - bool m_clear_in_progress; + bool m_clear_in_progress = false; private: typedef llvm::function_ref CreateCallback; diff --git a/lldb/include/lldb/Symbol/UnwindPlan.h b/lldb/include/lldb/Symbol/UnwindPlan.h --- a/lldb/include/lldb/Symbol/UnwindPlan.h +++ b/lldb/include/lldb/Symbol/UnwindPlan.h @@ -71,7 +71,7 @@ isDWARFExpression // reg = eval(dwarf_expr) }; - RegisterLocation() : m_type(unspecified), m_location() {} + RegisterLocation() : m_location() {} bool operator==(const RegisterLocation &rhs) const; @@ -181,7 +181,7 @@ const UnwindPlan::Row *row, Thread *thread, bool verbose) const; private: - RestoreType m_type; // How do we locate this register? + RestoreType m_type = unspecified; // How do we locate this register? union { // For m_type == atCFAPlusOffset or m_type == isCFAPlusOffset int32_t offset; @@ -205,7 +205,7 @@ isRaSearch, // FA = SP + offset + ??? }; - FAValue() : m_type(unspecified), m_value() {} + FAValue() : m_value() {} bool operator==(const FAValue &rhs) const; @@ -301,7 +301,7 @@ void Dump(Stream &s, const UnwindPlan *unwind_plan, Thread *thread) const; private: - ValueType m_type; // How do we compute CFA value? + ValueType m_type = unspecified; // How do we compute CFA value? union { struct { // For m_type == isRegisterPlusOffset or m_type == @@ -384,12 +384,12 @@ protected: typedef std::map collection; - lldb::addr_t m_offset; // Offset into the function for this row + lldb::addr_t m_offset = 0; // Offset into the function for this row FAValue m_cfa_value; FAValue m_afa_value; collection m_register_locations; - bool m_unspecified_registers_are_undefined; + bool m_unspecified_registers_are_undefined = false; }; // class Row typedef std::shared_ptr RowSP; diff --git a/lldb/include/lldb/Target/ExecutionContext.h b/lldb/include/lldb/Target/ExecutionContext.h --- a/lldb/include/lldb/Target/ExecutionContext.h +++ b/lldb/include/lldb/Target/ExecutionContext.h @@ -263,8 +263,9 @@ lldb::TargetWP m_target_wp; ///< A weak reference to a target lldb::ProcessWP m_process_wp; ///< A weak reference to a process mutable lldb::ThreadWP m_thread_wp; ///< A weak reference to a thread - lldb::tid_t m_tid; ///< The thread ID that this object refers to in case the - ///backing object changes + lldb::tid_t m_tid = LLDB_INVALID_THREAD_ID; ///< The thread ID that this + ///< object refers to in case the + /// backing object changes StackID m_stack_id; ///< The stack ID that this object refers to in case the ///backing object changes }; diff --git a/lldb/include/lldb/Target/PathMappingList.h b/lldb/include/lldb/Target/PathMappingList.h --- a/lldb/include/lldb/Target/PathMappingList.h +++ b/lldb/include/lldb/Target/PathMappingList.h @@ -118,9 +118,9 @@ const_iterator FindIteratorForPath(ConstString path) const; collection m_pairs; - ChangedCallback m_callback; - void *m_callback_baton; - uint32_t m_mod_id; // Incremented anytime anything is added or removed. + ChangedCallback m_callback = nullptr; + void *m_callback_baton = nullptr; + uint32_t m_mod_id = 0; // Incremented anytime anything is added or removed. }; } // namespace lldb_private diff --git a/lldb/include/lldb/Target/Process.h b/lldb/include/lldb/Target/Process.h --- a/lldb/include/lldb/Target/Process.h +++ b/lldb/include/lldb/Target/Process.h @@ -113,9 +113,7 @@ public: ProcessAttachInfo() : ProcessInstanceInfo(), m_listener_sp(), m_hijack_listener_sp(), - m_plugin_name(), m_resume_count(0), m_wait_for_launch(false), - m_ignore_existing(true), m_continue_once_attached(false), - m_detach_on_error(true), m_async(false) {} + m_plugin_name() {} ProcessAttachInfo(const ProcessLaunchInfo &launch_info) : ProcessInstanceInfo(), m_listener_sp(), m_hijack_listener_sp(), @@ -200,17 +198,19 @@ lldb::ListenerSP m_listener_sp; lldb::ListenerSP m_hijack_listener_sp; std::string m_plugin_name; - uint32_t m_resume_count; // How many times do we resume after launching - bool m_wait_for_launch; - bool m_ignore_existing; - bool m_continue_once_attached; // Supports the use-case scenario of - // immediately continuing the process once - // attached. - bool m_detach_on_error; // If we are debugging remotely, instruct the stub to - // detach rather than killing the target on error. - bool m_async; // Use an async attach where we start the attach and return - // immediately (used by GUI programs with --waitfor so they can - // call SBProcess::Stop() to cancel attach) + uint32_t m_resume_count = 0; // How many times do we resume after launching + bool m_wait_for_launch = false; + bool m_ignore_existing = true; + bool m_continue_once_attached = false; // Supports the use-case scenario of + // immediately continuing the process + // once attached. + bool m_detach_on_error = + true; // If we are debugging remotely, instruct the stub to + // detach rather than killing the target on error. + bool m_async = + false; // Use an async attach where we start the attach and return + // immediately (used by GUI programs with --waitfor so they can + // call SBProcess::Stop() to cancel attach) }; // This class tracks the Modification state of the process. Things that can @@ -223,9 +223,8 @@ public: ProcessModID() - : m_stop_id(0), m_last_natural_stop_id(0), m_resume_id(0), m_memory_id(0), - m_last_user_expression_resume(0), m_running_user_expression(false), - m_running_utility_function(0) {} + + {} ProcessModID(const ProcessModID &rhs) : m_stop_id(rhs.m_stop_id), m_memory_id(rhs.m_memory_id) {} @@ -316,13 +315,13 @@ } private: - uint32_t m_stop_id; - uint32_t m_last_natural_stop_id; - uint32_t m_resume_id; - uint32_t m_memory_id; - uint32_t m_last_user_expression_resume; - uint32_t m_running_user_expression; - uint32_t m_running_utility_function; + uint32_t m_stop_id = 0; + uint32_t m_last_natural_stop_id = 0; + uint32_t m_resume_id = 0; + uint32_t m_memory_id = 0; + uint32_t m_last_user_expression_resume = 0; + uint32_t m_running_user_expression = false; + uint32_t m_running_utility_function = 0; lldb::EventSP m_last_natural_stop_event; }; @@ -471,12 +470,12 @@ } lldb::ProcessWP m_process_wp; - lldb::StateType m_state; + lldb::StateType m_state = lldb::eStateInvalid; std::vector m_restarted_reasons; - bool m_restarted; // For "eStateStopped" events, this is true if the target - // was automatically restarted. - int m_update_state; - bool m_interrupted; + bool m_restarted = false; // For "eStateStopped" events, this is true if the + // target was automatically restarted. + int m_update_state = 0; + bool m_interrupted = false; ProcessEventData(const ProcessEventData &) = delete; const ProcessEventData &operator=(const ProcessEventData &) = delete; diff --git a/lldb/include/lldb/Target/RegisterNumber.h b/lldb/include/lldb/Target/RegisterNumber.h --- a/lldb/include/lldb/Target/RegisterNumber.h +++ b/lldb/include/lldb/Target/RegisterNumber.h @@ -50,10 +50,10 @@ typedef std::map Collection; lldb::RegisterContextSP m_reg_ctx_sp; - uint32_t m_regnum; - lldb::RegisterKind m_kind; + uint32_t m_regnum = LLDB_INVALID_REGNUM; + lldb::RegisterKind m_kind = lldb::kNumRegisterKinds; Collection m_kind_regnum_map; - const char *m_name; + const char *m_name = nullptr; }; #endif // LLDB_TARGET_REGISTERNUMBER_H diff --git a/lldb/include/lldb/Target/StackID.h b/lldb/include/lldb/Target/StackID.h --- a/lldb/include/lldb/Target/StackID.h +++ b/lldb/include/lldb/Target/StackID.h @@ -18,8 +18,8 @@ public: // Constructors and Destructors StackID() - : m_pc(LLDB_INVALID_ADDRESS), m_cfa(LLDB_INVALID_ADDRESS), - m_symbol_scope(nullptr) {} + + {} explicit StackID(lldb::addr_t pc, lldb::addr_t cfa, SymbolContextScope *symbol_scope) @@ -69,23 +69,25 @@ void SetCFA(lldb::addr_t cfa) { m_cfa = cfa; } - lldb::addr_t - m_pc; // The pc value for the function/symbol for this frame. This will + lldb::addr_t m_pc = + LLDB_INVALID_ADDRESS; // The pc value for the function/symbol for this + // frame. This will // only get used if the symbol scope is nullptr (the code where we are // stopped is not represented by any function or symbol in any shared // library). - lldb::addr_t m_cfa; // The call frame address (stack pointer) value - // at the beginning of the function that uniquely - // identifies this frame (along with m_symbol_scope - // below) - SymbolContextScope * - m_symbol_scope; // If nullptr, there is no block or symbol for this frame. - // If not nullptr, this will either be the scope for the - // lexical block for the frame, or the scope for the - // symbol. Symbol context scopes are always be unique - // pointers since the are part of the Block and Symbol - // objects and can easily be used to tell if a stack ID - // is the same as another. + lldb::addr_t m_cfa = + LLDB_INVALID_ADDRESS; // The call frame address (stack pointer) value + // at the beginning of the function that uniquely + // identifies this frame (along with m_symbol_scope + // below) + SymbolContextScope *m_symbol_scope = + nullptr; // If nullptr, there is no block or symbol for this frame. + // If not nullptr, this will either be the scope for the + // lexical block for the frame, or the scope for the + // symbol. Symbol context scopes are always be unique + // pointers since the are part of the Block and Symbol + // objects and can easily be used to tell if a stack ID + // is the same as another. }; bool operator==(const StackID &lhs, const StackID &rhs); diff --git a/lldb/include/lldb/Target/ThreadSpec.h b/lldb/include/lldb/Target/ThreadSpec.h --- a/lldb/include/lldb/Target/ThreadSpec.h +++ b/lldb/include/lldb/Target/ThreadSpec.h @@ -120,8 +120,8 @@ return g_option_names[(size_t) enum_value]; } - uint32_t m_index; - lldb::tid_t m_tid; + uint32_t m_index = UINT32_MAX; + lldb::tid_t m_tid = LLDB_INVALID_THREAD_ID; std::string m_name; std::string m_queue_name; }; diff --git a/lldb/include/lldb/Target/UnwindLLDB.h b/lldb/include/lldb/Target/UnwindLLDB.h --- a/lldb/include/lldb/Target/UnwindLLDB.h +++ b/lldb/include/lldb/Target/UnwindLLDB.h @@ -109,17 +109,17 @@ private: struct Cursor { - lldb::addr_t start_pc; // The start address of the function/symbol for this - // frame - current pc if unknown - lldb::addr_t cfa; // The canonical frame address for this stack frame + lldb::addr_t start_pc = + LLDB_INVALID_ADDRESS; // The start address of the function/symbol for + // this frame - current pc if unknown + lldb::addr_t cfa = LLDB_INVALID_ADDRESS; // The canonical frame address for + // this stack frame lldb_private::SymbolContext sctx; // A symbol context we'll contribute to & // provide to the StackFrame creation RegisterContextLLDBSP reg_ctx_lldb_sp; // These are all RegisterContextUnwind's - Cursor() - : start_pc(LLDB_INVALID_ADDRESS), cfa(LLDB_INVALID_ADDRESS), sctx(), - reg_ctx_lldb_sp() {} + Cursor() : sctx(), reg_ctx_lldb_sp() {} private: Cursor(const Cursor &) = delete; diff --git a/lldb/include/lldb/Utility/DataEncoder.h b/lldb/include/lldb/Utility/DataEncoder.h --- a/lldb/include/lldb/Utility/DataEncoder.h +++ b/lldb/include/lldb/Utility/DataEncoder.h @@ -226,10 +226,10 @@ size_t GetByteSize() const { return m_end - m_start; } /// A pointer to the first byte of data. - uint8_t *m_start; + uint8_t *m_start = nullptr; /// A pointer to the byte that is past the end of the data. - uint8_t *m_end; + uint8_t *m_end = nullptr; /// The byte order of the data we are extracting from. lldb::ByteOrder m_byte_order; diff --git a/lldb/include/lldb/Utility/DataExtractor.h b/lldb/include/lldb/Utility/DataExtractor.h --- a/lldb/include/lldb/Utility/DataExtractor.h +++ b/lldb/include/lldb/Utility/DataExtractor.h @@ -997,15 +997,15 @@ } // Member variables - const uint8_t *m_start; ///< A pointer to the first byte of data. - const uint8_t - *m_end; ///< A pointer to the byte that is past the end of the data. + const uint8_t *m_start = nullptr; ///< A pointer to the first byte of data. + const uint8_t *m_end = + nullptr; ///< A pointer to the byte that is past the end of the data. lldb::ByteOrder m_byte_order; ///< The byte order of the data we are extracting from. uint32_t m_addr_size; ///< The address size to use when extracting addresses. /// The shared pointer to data that can be shared among multiple instances lldb::DataBufferSP m_data_sp; - const uint32_t m_target_byte_size; + const uint32_t m_target_byte_size = 1; }; } // namespace lldb_private diff --git a/lldb/include/lldb/Utility/GDBRemote.h b/lldb/include/lldb/Utility/GDBRemote.h --- a/lldb/include/lldb/Utility/GDBRemote.h +++ b/lldb/include/lldb/Utility/GDBRemote.h @@ -55,9 +55,7 @@ enum Type { ePacketTypeInvalid = 0, ePacketTypeSend, ePacketTypeRecv }; - GDBRemotePacket() - : packet(), type(ePacketTypeInvalid), bytes_transmitted(0), packet_idx(0), - tid(LLDB_INVALID_THREAD_ID) {} + GDBRemotePacket() : packet() {} void Clear() { packet.data.clear(); @@ -74,10 +72,10 @@ void Dump(Stream &strm) const; BinaryData packet; - Type type; - uint32_t bytes_transmitted; - uint32_t packet_idx; - lldb::tid_t tid; + Type type = ePacketTypeInvalid; + uint32_t bytes_transmitted = 0; + uint32_t packet_idx = 0; + lldb::tid_t tid = LLDB_INVALID_THREAD_ID; private: llvm::StringRef GetTypeStr() const; diff --git a/lldb/include/lldb/Utility/ProcessInfo.h b/lldb/include/lldb/Utility/ProcessInfo.h --- a/lldb/include/lldb/Utility/ProcessInfo.h +++ b/lldb/include/lldb/Utility/ProcessInfo.h @@ -95,10 +95,10 @@ // the resolved platform executable (which is in m_executable) Args m_arguments; // All program arguments except argv[0] Environment m_environment; - uint32_t m_uid; - uint32_t m_gid; + uint32_t m_uid = UINT32_MAX; + uint32_t m_gid = UINT32_MAX; ArchSpec m_arch; - lldb::pid_t m_pid; + lldb::pid_t m_pid = LLDB_INVALID_PROCESS_ID; }; // ProcessInstanceInfo @@ -107,9 +107,7 @@ // to that process. class ProcessInstanceInfo : public ProcessInfo { public: - ProcessInstanceInfo() - : ProcessInfo(), m_euid(UINT32_MAX), m_egid(UINT32_MAX), - m_parent_pid(LLDB_INVALID_PROCESS_ID) {} + ProcessInstanceInfo() : ProcessInfo() {} ProcessInstanceInfo(const char *name, const ArchSpec &arch, lldb::pid_t pid) : ProcessInfo(name, arch, pid), m_euid(UINT32_MAX), m_egid(UINT32_MAX), @@ -151,9 +149,9 @@ protected: friend struct llvm::yaml::MappingTraits; - uint32_t m_euid; - uint32_t m_egid; - lldb::pid_t m_parent_pid; + uint32_t m_euid = UINT32_MAX; + uint32_t m_egid = UINT32_MAX; + lldb::pid_t m_parent_pid = LLDB_INVALID_PROCESS_ID; }; typedef std::vector ProcessInstanceInfoList; @@ -164,9 +162,7 @@ class ProcessInstanceInfoMatch { public: - ProcessInstanceInfoMatch() - : m_match_info(), m_name_match_type(NameMatch::Ignore), - m_match_all_users(false) {} + ProcessInstanceInfoMatch() : m_match_info() {} ProcessInstanceInfoMatch(const char *process_name, NameMatch process_name_match_type) @@ -211,8 +207,8 @@ protected: ProcessInstanceInfo m_match_info; - NameMatch m_name_match_type; - bool m_match_all_users; + NameMatch m_name_match_type = NameMatch::Ignore; + bool m_match_all_users = false; }; namespace repro { diff --git a/lldb/include/lldb/Utility/RegisterValue.h b/lldb/include/lldb/Utility/RegisterValue.h --- a/lldb/include/lldb/Utility/RegisterValue.h +++ b/lldb/include/lldb/Utility/RegisterValue.h @@ -43,8 +43,7 @@ eTypeBytes }; - RegisterValue() - : m_type(eTypeInvalid), m_scalar(static_cast(0)) {} + RegisterValue() : m_scalar(static_cast(0)) {} explicit RegisterValue(uint8_t inst) : m_type(eTypeUInt8) { m_scalar = inst; } @@ -257,7 +256,7 @@ void Clear(); protected: - RegisterValue::Type m_type; + RegisterValue::Type m_type = eTypeInvalid; Scalar m_scalar; struct { diff --git a/lldb/include/lldb/Utility/ReproducerInstrumentation.h b/lldb/include/lldb/Utility/ReproducerInstrumentation.h --- a/lldb/include/lldb/Utility/ReproducerInstrumentation.h +++ b/lldb/include/lldb/Utility/ReproducerInstrumentation.h @@ -714,8 +714,7 @@ friend llvm::optional_detail::OptionalStorage; friend llvm::Optional; - InstrumentationData() - : m_serializer(nullptr), m_deserializer(nullptr), m_registry(nullptr) {} + InstrumentationData() {} InstrumentationData(Serializer &serializer, Registry ®istry) : m_serializer(&serializer), m_deserializer(nullptr), m_registry(®istry) {} @@ -726,9 +725,9 @@ private: static llvm::Optional &InstanceImpl(); - Serializer *m_serializer; - Deserializer *m_deserializer; - Registry *m_registry; + Serializer *m_serializer = nullptr; + Deserializer *m_deserializer = nullptr; + Registry *m_registry = nullptr; }; struct EmptyArg {}; @@ -888,17 +887,17 @@ } #endif - Serializer *m_serializer; + Serializer *m_serializer = nullptr; /// Pretty function for logging. llvm::StringRef m_pretty_func; std::string m_pretty_args; /// Whether this function call was the one crossing the API boundary. - bool m_local_boundary; + bool m_local_boundary = false; /// Whether the return value was recorded explicitly. - bool m_result_recorded; + bool m_result_recorded = true; /// The sequence number for this pair of function and result. unsigned m_sequence; diff --git a/lldb/include/lldb/Utility/Scalar.h b/lldb/include/lldb/Utility/Scalar.h --- a/lldb/include/lldb/Utility/Scalar.h +++ b/lldb/include/lldb/Utility/Scalar.h @@ -49,7 +49,7 @@ }; // Constructors and Destructors - Scalar() : m_type(e_void), m_float(0.0f) {} + Scalar() : m_float(0.0f) {} Scalar(int v) : m_type(e_int), m_integer(MakeAPSInt(v)), m_float(0.0f) {} Scalar(unsigned int v) : m_type(e_int), m_integer(MakeAPSInt(v)), m_float(0.0f) {} @@ -187,7 +187,7 @@ size_t byte_size); protected: - Scalar::Type m_type; + Scalar::Type m_type = e_void; llvm::APSInt m_integer; llvm::APFloat m_float; diff --git a/lldb/include/lldb/Utility/Status.h b/lldb/include/lldb/Utility/Status.h --- a/lldb/include/lldb/Utility/Status.h +++ b/lldb/include/lldb/Utility/Status.h @@ -196,8 +196,9 @@ protected: /// Member variables - ValueType m_code; ///< Status code as an integer value. - lldb::ErrorType m_type; ///< The type of the above error code. + ValueType m_code = 0; ///< Status code as an integer value. + lldb::ErrorType m_type = + lldb::eErrorTypeInvalid; ///< The type of the above error code. mutable std::string m_string; ///< A string representation of the error code. }; diff --git a/lldb/include/lldb/Utility/Stream.h b/lldb/include/lldb/Utility/Stream.h --- a/lldb/include/lldb/Utility/Stream.h +++ b/lldb/include/lldb/Utility/Stream.h @@ -361,10 +361,10 @@ protected: // Member variables Flags m_flags; ///< Dump flags. - uint32_t m_addr_size; ///< Size of an address in bytes. + uint32_t m_addr_size = 4; ///< Size of an address in bytes. lldb::ByteOrder m_byte_order; ///< Byte order to use when encoding scalar types. - unsigned m_indent_level; ///< Indention level. + unsigned m_indent_level = 0; ///< Indention level. std::size_t m_bytes_written = 0; ///< Number of bytes written so far. void _PutHex8(uint8_t uvalue, bool add_prefix); diff --git a/lldb/include/lldb/Utility/StringExtractor.h b/lldb/include/lldb/Utility/StringExtractor.h --- a/lldb/include/lldb/Utility/StringExtractor.h +++ b/lldb/include/lldb/Utility/StringExtractor.h @@ -115,7 +115,7 @@ /// When extracting data from a packet, this index will march along as things /// get extracted. If set to UINT64_MAX the end of the packet data was /// reached when decoding information. - uint64_t m_index; + uint64_t m_index = 0; }; #endif // LLDB_UTILITY_STRINGEXTRACTOR_H diff --git a/lldb/include/lldb/Utility/StringExtractorGDBRemote.h b/lldb/include/lldb/Utility/StringExtractorGDBRemote.h --- a/lldb/include/lldb/Utility/StringExtractorGDBRemote.h +++ b/lldb/include/lldb/Utility/StringExtractorGDBRemote.h @@ -23,7 +23,7 @@ typedef bool (*ResponseValidatorCallback)( void *baton, const StringExtractorGDBRemote &response); - StringExtractorGDBRemote() : StringExtractor(), m_validator(nullptr) {} + StringExtractorGDBRemote() : StringExtractor() {} StringExtractorGDBRemote(llvm::StringRef str) : StringExtractor(str), m_validator(nullptr) {} @@ -201,7 +201,7 @@ GetPidTid(lldb::pid_t default_pid); protected: - ResponseValidatorCallback m_validator; + ResponseValidatorCallback m_validator = nullptr; void *m_validator_baton; }; diff --git a/lldb/include/lldb/Utility/VMRange.h b/lldb/include/lldb/Utility/VMRange.h --- a/lldb/include/lldb/Utility/VMRange.h +++ b/lldb/include/lldb/Utility/VMRange.h @@ -26,7 +26,7 @@ typedef collection::iterator iterator; typedef collection::const_iterator const_iterator; - VMRange() : m_base_addr(0), m_byte_size(0) {} + VMRange() {} VMRange(lldb::addr_t start_addr, lldb::addr_t end_addr) : m_base_addr(start_addr), @@ -88,8 +88,8 @@ const VMRange &range); protected: - lldb::addr_t m_base_addr; - lldb::addr_t m_byte_size; + lldb::addr_t m_base_addr = 0; + lldb::addr_t m_byte_size = 0; }; bool operator==(const VMRange &lhs, const VMRange &rhs); diff --git a/lldb/source/API/SBBlock.cpp b/lldb/source/API/SBBlock.cpp --- a/lldb/source/API/SBBlock.cpp +++ b/lldb/source/API/SBBlock.cpp @@ -25,9 +25,7 @@ using namespace lldb; using namespace lldb_private; -SBBlock::SBBlock() : m_opaque_ptr(nullptr) { - LLDB_RECORD_CONSTRUCTOR_NO_ARGS(SBBlock); -} +SBBlock::SBBlock() { LLDB_RECORD_CONSTRUCTOR_NO_ARGS(SBBlock); } SBBlock::SBBlock(lldb_private::Block *lldb_object_ptr) : m_opaque_ptr(lldb_object_ptr) {} 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 @@ -16,7 +16,7 @@ using namespace lldb; using namespace lldb_private; -SBBroadcaster::SBBroadcaster() : m_opaque_sp(), m_opaque_ptr(nullptr) { +SBBroadcaster::SBBroadcaster() : m_opaque_sp() { LLDB_RECORD_CONSTRUCTOR_NO_ARGS(SBBroadcaster); } diff --git a/lldb/source/API/SBCommandReturnObject.cpp b/lldb/source/API/SBCommandReturnObject.cpp --- a/lldb/source/API/SBCommandReturnObject.cpp +++ b/lldb/source/API/SBCommandReturnObject.cpp @@ -21,8 +21,7 @@ class lldb_private::SBCommandReturnObjectImpl { public: - SBCommandReturnObjectImpl() - : m_ptr(new CommandReturnObject(false)), m_owned(true) {} + SBCommandReturnObjectImpl() : m_ptr(new CommandReturnObject(false)) {} SBCommandReturnObjectImpl(CommandReturnObject &ref) : m_ptr(&ref), m_owned(false) {} SBCommandReturnObjectImpl(const SBCommandReturnObjectImpl &rhs) @@ -42,7 +41,7 @@ private: CommandReturnObject *m_ptr; - bool m_owned; + bool m_owned = true; }; SBCommandReturnObject::SBCommandReturnObject() diff --git a/lldb/source/API/SBCommunication.cpp b/lldb/source/API/SBCommunication.cpp --- a/lldb/source/API/SBCommunication.cpp +++ b/lldb/source/API/SBCommunication.cpp @@ -16,7 +16,7 @@ using namespace lldb; using namespace lldb_private; -SBCommunication::SBCommunication() : m_opaque(nullptr), m_opaque_owned(false) { +SBCommunication::SBCommunication() { LLDB_RECORD_CONSTRUCTOR_NO_ARGS(SBCommunication); } diff --git a/lldb/source/API/SBCompileUnit.cpp b/lldb/source/API/SBCompileUnit.cpp --- a/lldb/source/API/SBCompileUnit.cpp +++ b/lldb/source/API/SBCompileUnit.cpp @@ -21,7 +21,7 @@ using namespace lldb; using namespace lldb_private; -SBCompileUnit::SBCompileUnit() : m_opaque_ptr(nullptr) { +SBCompileUnit::SBCompileUnit() { LLDB_RECORD_CONSTRUCTOR_NO_ARGS(SBCompileUnit); } diff --git a/lldb/source/API/SBEvent.cpp b/lldb/source/API/SBEvent.cpp --- a/lldb/source/API/SBEvent.cpp +++ b/lldb/source/API/SBEvent.cpp @@ -22,9 +22,7 @@ using namespace lldb; using namespace lldb_private; -SBEvent::SBEvent() : m_event_sp(), m_opaque_ptr(nullptr) { - LLDB_RECORD_CONSTRUCTOR_NO_ARGS(SBEvent); -} +SBEvent::SBEvent() : m_event_sp() { LLDB_RECORD_CONSTRUCTOR_NO_ARGS(SBEvent); } SBEvent::SBEvent(uint32_t event_type, const char *cstr, uint32_t cstr_len) : m_event_sp(new Event(event_type, new EventDataBytes(cstr, cstr_len))), diff --git a/lldb/source/API/SBFunction.cpp b/lldb/source/API/SBFunction.cpp --- a/lldb/source/API/SBFunction.cpp +++ b/lldb/source/API/SBFunction.cpp @@ -22,9 +22,7 @@ using namespace lldb; using namespace lldb_private; -SBFunction::SBFunction() : m_opaque_ptr(nullptr) { - LLDB_RECORD_CONSTRUCTOR_NO_ARGS(SBFunction); -} +SBFunction::SBFunction() { LLDB_RECORD_CONSTRUCTOR_NO_ARGS(SBFunction); } SBFunction::SBFunction(lldb_private::Function *lldb_object_ptr) : m_opaque_ptr(lldb_object_ptr) {} 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 @@ -20,7 +20,7 @@ using namespace lldb; using namespace lldb_private; -SBListener::SBListener() : m_opaque_sp(), m_unused_ptr(nullptr) { +SBListener::SBListener() : m_opaque_sp() { LLDB_RECORD_CONSTRUCTOR_NO_ARGS(SBListener); } 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 @@ -32,7 +32,7 @@ struct PlatformConnectOptions { PlatformConnectOptions(const char *url = nullptr) : m_url(), m_rsync_options(), m_rsync_remote_path_prefix(), - m_rsync_enabled(false), m_rsync_omit_hostname_from_remote_path(false), + m_local_cache_directory() { if (url && url[0]) m_url = url; @@ -43,8 +43,8 @@ std::string m_url; std::string m_rsync_options; std::string m_rsync_remote_path_prefix; - bool m_rsync_enabled; - bool m_rsync_omit_hostname_from_remote_path; + bool m_rsync_enabled = false; + bool m_rsync_omit_hostname_from_remote_path = false; ConstString m_local_cache_directory; }; @@ -61,7 +61,7 @@ } PlatformShellCommand(llvm::StringRef shell_command = llvm::StringRef()) - : m_shell(), m_command(), m_working_dir(), m_status(0), m_signo(0) { + : m_shell(), m_command(), m_working_dir() { if (!shell_command.empty()) m_command = shell_command.str(); } @@ -72,8 +72,8 @@ std::string m_command; std::string m_working_dir; std::string m_output; - int m_status; - int m_signo; + int m_status = 0; + int m_signo = 0; Timeout> m_timeout = llvm::None; }; // SBPlatformConnectOptions 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 @@ -27,9 +27,7 @@ class QueueImpl { public: - QueueImpl() - : m_queue_wp(), m_threads(), m_thread_list_fetched(false), - m_pending_items(), m_pending_items_fetched(false) {} + QueueImpl() : m_queue_wp(), m_threads(), m_pending_items() {} QueueImpl(const lldb::QueueSP &queue_sp) : m_queue_wp(), m_threads(), m_thread_list_fetched(false), @@ -210,10 +208,11 @@ lldb::QueueWP m_queue_wp; std::vector m_threads; // threads currently executing this queue's items - bool - m_thread_list_fetched; // have we tried to fetch the threads list already? + bool m_thread_list_fetched = + false; // have we tried to fetch the threads list already? std::vector m_pending_items; // items currently enqueued - bool m_pending_items_fetched; // have we tried to fetch the item list already? + bool m_pending_items_fetched = + false; // have we tried to fetch the item list already? }; } diff --git a/lldb/source/API/SBStream.cpp b/lldb/source/API/SBStream.cpp --- a/lldb/source/API/SBStream.cpp +++ b/lldb/source/API/SBStream.cpp @@ -19,7 +19,7 @@ using namespace lldb; using namespace lldb_private; -SBStream::SBStream() : m_opaque_up(new StreamString()), m_is_file(false) { +SBStream::SBStream() : m_opaque_up(new StreamString()) { LLDB_RECORD_CONSTRUCTOR_NO_ARGS(SBStream); } diff --git a/lldb/source/API/SBSymbol.cpp b/lldb/source/API/SBSymbol.cpp --- a/lldb/source/API/SBSymbol.cpp +++ b/lldb/source/API/SBSymbol.cpp @@ -18,9 +18,7 @@ using namespace lldb; using namespace lldb_private; -SBSymbol::SBSymbol() : m_opaque_ptr(nullptr) { - LLDB_RECORD_CONSTRUCTOR_NO_ARGS(SBSymbol); -} +SBSymbol::SBSymbol() { LLDB_RECORD_CONSTRUCTOR_NO_ARGS(SBSymbol); } SBSymbol::SBSymbol(lldb_private::Symbol *lldb_object_ptr) : m_opaque_ptr(lldb_object_ptr) {} diff --git a/lldb/source/API/SBVariablesOptions.cpp b/lldb/source/API/SBVariablesOptions.cpp --- a/lldb/source/API/SBVariablesOptions.cpp +++ b/lldb/source/API/SBVariablesOptions.cpp @@ -21,9 +21,7 @@ VariablesOptionsImpl() : m_include_arguments(false), m_include_locals(false), m_include_statics(false), m_in_scope_only(false), - m_include_runtime_support_values(false), - m_include_recognized_arguments(eLazyBoolCalculate), - m_use_dynamic(lldb::eNoDynamicValues) {} + m_include_runtime_support_values(false) {} VariablesOptionsImpl(const VariablesOptionsImpl &) = default; @@ -75,8 +73,9 @@ bool m_include_statics : 1; bool m_in_scope_only : 1; bool m_include_runtime_support_values : 1; - LazyBool m_include_recognized_arguments; // can be overridden with a setting - lldb::DynamicValueType m_use_dynamic; + LazyBool m_include_recognized_arguments = + eLazyBoolCalculate; // can be overridden with a setting + lldb::DynamicValueType m_use_dynamic = lldb::eNoDynamicValues; }; SBVariablesOptions::SBVariablesOptions() diff --git a/lldb/source/Breakpoint/Stoppoint.cpp b/lldb/source/Breakpoint/Stoppoint.cpp --- a/lldb/source/Breakpoint/Stoppoint.cpp +++ b/lldb/source/Breakpoint/Stoppoint.cpp @@ -14,7 +14,7 @@ using namespace lldb_private; // Stoppoint constructor -Stoppoint::Stoppoint() : m_bid(LLDB_INVALID_BREAK_ID) {} +Stoppoint::Stoppoint() {} // Destructor Stoppoint::~Stoppoint() {} diff --git a/lldb/source/Breakpoint/StoppointCallbackContext.cpp b/lldb/source/Breakpoint/StoppointCallbackContext.cpp --- a/lldb/source/Breakpoint/StoppointCallbackContext.cpp +++ b/lldb/source/Breakpoint/StoppointCallbackContext.cpp @@ -10,8 +10,7 @@ using namespace lldb_private; -StoppointCallbackContext::StoppointCallbackContext() - : event(nullptr), exe_ctx_ref(), is_synchronous(false) {} +StoppointCallbackContext::StoppointCallbackContext() : exe_ctx_ref() {} StoppointCallbackContext::StoppointCallbackContext( Event *e, const ExecutionContext &exe_ctx, bool synchronously) diff --git a/lldb/source/Breakpoint/WatchpointList.cpp b/lldb/source/Breakpoint/WatchpointList.cpp --- a/lldb/source/Breakpoint/WatchpointList.cpp +++ b/lldb/source/Breakpoint/WatchpointList.cpp @@ -12,8 +12,7 @@ using namespace lldb; using namespace lldb_private; -WatchpointList::WatchpointList() - : m_watchpoints(), m_mutex(), m_next_wp_id(0) {} +WatchpointList::WatchpointList() : m_watchpoints(), m_mutex() {} WatchpointList::~WatchpointList() {} diff --git a/lldb/source/Breakpoint/WatchpointOptions.cpp b/lldb/source/Breakpoint/WatchpointOptions.cpp --- a/lldb/source/Breakpoint/WatchpointOptions.cpp +++ b/lldb/source/Breakpoint/WatchpointOptions.cpp @@ -28,7 +28,7 @@ // WatchpointOptions constructor WatchpointOptions::WatchpointOptions() : m_callback(WatchpointOptions::NullCallback), m_callback_baton_sp(), - m_callback_is_synchronous(false), m_thread_spec_up() {} + m_thread_spec_up() {} // WatchpointOptions copy constructor WatchpointOptions::WatchpointOptions(const WatchpointOptions &rhs) diff --git a/lldb/source/Commands/CommandObjectBreakpoint.cpp b/lldb/source/Commands/CommandObjectBreakpoint.cpp --- a/lldb/source/Commands/CommandObjectBreakpoint.cpp +++ b/lldb/source/Commands/CommandObjectBreakpoint.cpp @@ -242,15 +242,8 @@ class CommandOptions : public OptionGroup { public: CommandOptions() - : OptionGroup(), m_condition(), m_filenames(), m_line_num(0), - m_column(0), m_func_names(), - m_func_name_type_mask(eFunctionNameTypeNone), m_func_regexp(), - m_source_text_regexp(), m_modules(), m_load_addr(), m_catch_bp(false), - m_throw_bp(true), m_hardware(false), - m_exception_language(eLanguageTypeUnknown), - m_language(lldb::eLanguageTypeUnknown), - m_skip_prologue(eLazyBoolCalculate), m_all_files(false), - m_move_to_nearest_code(eLazyBoolCalculate) {} + : OptionGroup(), m_condition(), m_filenames(), m_func_names(), + m_func_regexp(), m_source_text_regexp(), m_modules() {} ~CommandOptions() override = default; @@ -500,25 +493,25 @@ std::string m_condition; FileSpecList m_filenames; - uint32_t m_line_num; - uint32_t m_column; + uint32_t m_line_num = 0; + uint32_t m_column = 0; std::vector m_func_names; std::vector m_breakpoint_names; - lldb::FunctionNameType m_func_name_type_mask; + lldb::FunctionNameType m_func_name_type_mask = eFunctionNameTypeNone; std::string m_func_regexp; std::string m_source_text_regexp; FileSpecList m_modules; - lldb::addr_t m_load_addr; + lldb::addr_t m_load_addr = 0; lldb::addr_t m_offset_addr; - bool m_catch_bp; - bool m_throw_bp; - bool m_hardware; // Request to use hardware breakpoints - lldb::LanguageType m_exception_language; - lldb::LanguageType m_language; - LazyBool m_skip_prologue; - bool m_all_files; + bool m_catch_bp = false; + bool m_throw_bp = true; + bool m_hardware = false; // Request to use hardware breakpoints + lldb::LanguageType m_exception_language = eLanguageTypeUnknown; + lldb::LanguageType m_language = lldb::eLanguageTypeUnknown; + LazyBool m_skip_prologue = eLazyBoolCalculate; + bool m_all_files = false; Args m_exception_extra_args; - LazyBool m_move_to_nearest_code; + LazyBool m_move_to_nearest_code = eLazyBoolCalculate; std::unordered_set m_source_regex_func_names; std::string m_current_key; }; @@ -1133,9 +1126,7 @@ class CommandOptions : public Options { public: - CommandOptions() - : Options(), m_level(lldb::eDescriptionLevelBrief), m_use_dummy(false) { - } + CommandOptions() : Options() {} ~CommandOptions() override = default; @@ -1179,10 +1170,10 @@ // Instance variables to hold the values for command options. - lldb::DescriptionLevel m_level; + lldb::DescriptionLevel m_level = lldb::eDescriptionLevelBrief; bool m_internal; - bool m_use_dummy; + bool m_use_dummy = false; }; protected: @@ -1268,7 +1259,7 @@ class CommandOptions : public Options { public: - CommandOptions() : Options(), m_filename(), m_line_num(0) {} + CommandOptions() : Options(), m_filename() {} ~CommandOptions() override = default; @@ -1305,7 +1296,7 @@ // Instance variables to hold the values for command options. std::string m_filename; - uint32_t m_line_num; + uint32_t m_line_num = 0; }; protected: @@ -1423,8 +1414,7 @@ class CommandOptions : public Options { public: - CommandOptions() : Options(), m_use_dummy(false), m_force(false), - m_delete_disabled(false) {} + CommandOptions() : Options() {} ~CommandOptions() override = default; @@ -1464,9 +1454,9 @@ } // Instance variables to hold the values for command options. - bool m_use_dummy; - bool m_force; - bool m_delete_disabled; + bool m_use_dummy = false; + bool m_force = false; + bool m_delete_disabled = false; }; protected: diff --git a/lldb/source/Commands/CommandObjectBreakpointCommand.cpp b/lldb/source/Commands/CommandObjectBreakpointCommand.cpp --- a/lldb/source/Commands/CommandObjectBreakpointCommand.cpp +++ b/lldb/source/Commands/CommandObjectBreakpointCommand.cpp @@ -283,10 +283,7 @@ class CommandOptions : public OptionGroup { public: - CommandOptions() - : OptionGroup(), m_use_commands(false), m_use_script_language(false), - m_script_language(eScriptLanguageNone), m_use_one_liner(false), - m_one_liner() {} + CommandOptions() : OptionGroup(), m_one_liner() {} ~CommandOptions() override = default; @@ -356,12 +353,12 @@ // Instance variables to hold the values for command options. - bool m_use_commands; - bool m_use_script_language; - lldb::ScriptLanguage m_script_language; + bool m_use_commands = false; + bool m_use_script_language = false; + lldb::ScriptLanguage m_script_language = eScriptLanguageNone; // Instance variables to hold the values for one_liner options. - bool m_use_one_liner; + bool m_use_one_liner = false; std::string m_one_liner; bool m_stop_on_error; bool m_use_dummy; @@ -510,7 +507,7 @@ class CommandOptions : public Options { public: - CommandOptions() : Options(), m_use_dummy(false) {} + CommandOptions() : Options() {} ~CommandOptions() override = default; @@ -540,7 +537,7 @@ } // Instance variables to hold the values for command options. - bool m_use_dummy; + bool m_use_dummy = false; }; protected: 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 @@ -1387,8 +1387,7 @@ class CommandOptions : public Options { public: CommandOptions() - : Options(), m_class_name(), m_funct_name(), m_short_help(), - m_synchronicity(eScriptedCommandSynchronicitySynchronous) {} + : Options(), m_class_name(), m_funct_name(), m_short_help() {} ~CommandOptions() override = default; @@ -1442,7 +1441,8 @@ std::string m_class_name; std::string m_funct_name; std::string m_short_help; - ScriptedCommandSynchronicity m_synchronicity; + ScriptedCommandSynchronicity m_synchronicity = + eScriptedCommandSynchronicitySynchronous; }; void IOHandlerActivated(IOHandler &io_handler, bool interactive) override { diff --git a/lldb/source/Commands/CommandObjectDisassemble.h b/lldb/source/Commands/CommandObjectDisassemble.h --- a/lldb/source/Commands/CommandObjectDisassemble.h +++ b/lldb/source/Commands/CommandObjectDisassemble.h @@ -46,22 +46,22 @@ bool show_mixed; // Show mixed source/assembly bool show_bytes; - uint32_t num_lines_context; - uint32_t num_instructions; + uint32_t num_lines_context = 0; + uint32_t num_instructions = 0; bool raw; std::string func_name; - bool current_function; - lldb::addr_t start_addr; - lldb::addr_t end_addr; - bool at_pc; - bool frame_line; + bool current_function = false; + lldb::addr_t start_addr = 0; + lldb::addr_t end_addr = 0; + bool at_pc = false; + bool frame_line = false; std::string plugin_name; std::string flavor_string; ArchSpec arch; - bool some_location_specified; // If no location was specified, we'll select - // "at_pc". This should be set + bool some_location_specified = false; // If no location was specified, we'll + // select "at_pc". This should be set // in SetOptionValue if anything the selects a location is set. - lldb::addr_t symbol_containing_addr; + lldb::addr_t symbol_containing_addr = 0; bool force = false; }; diff --git a/lldb/source/Commands/CommandObjectDisassemble.cpp b/lldb/source/Commands/CommandObjectDisassemble.cpp --- a/lldb/source/Commands/CommandObjectDisassemble.cpp +++ b/lldb/source/Commands/CommandObjectDisassemble.cpp @@ -31,10 +31,7 @@ #include "CommandOptions.inc" CommandObjectDisassemble::CommandOptions::CommandOptions() - : Options(), num_lines_context(0), num_instructions(0), func_name(), - current_function(false), start_addr(), end_addr(), at_pc(false), - frame_line(false), plugin_name(), flavor_string(), arch(), - some_location_specified(false), symbol_containing_addr() { + : Options(), func_name(), plugin_name(), flavor_string(), arch() { OptionParsingStarting(nullptr); } diff --git a/lldb/source/Commands/CommandObjectLog.cpp b/lldb/source/Commands/CommandObjectLog.cpp --- a/lldb/source/Commands/CommandObjectLog.cpp +++ b/lldb/source/Commands/CommandObjectLog.cpp @@ -76,7 +76,7 @@ class CommandOptions : public Options { public: - CommandOptions() : Options(), log_file(), log_options(0) {} + CommandOptions() : Options(), log_file() {} ~CommandOptions() override = default; @@ -136,7 +136,7 @@ // Instance variables to hold the values for command options. FileSpec log_file; - uint32_t log_options; + uint32_t log_options = 0; }; void 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 @@ -46,8 +46,8 @@ class OptionGroupReadMemory : public OptionGroup { public: OptionGroupReadMemory() - : m_num_per_line(1, 1), m_output_as_binary(false), m_view_as_type(), - m_offset(0, 0), m_language_for_type(eLanguageTypeUnknown) {} + : m_num_per_line(1, 1), m_view_as_type(), m_offset(0, 0), + m_language_for_type(eLanguageTypeUnknown) {} ~OptionGroupReadMemory() override = default; @@ -270,7 +270,7 @@ } OptionValueUInt64 m_num_per_line; - bool m_output_as_binary; + bool m_output_as_binary = false; OptionValueString m_view_as_type; bool m_force; OptionValueUInt64 m_offset; diff --git a/lldb/source/Commands/CommandObjectPlatform.cpp b/lldb/source/Commands/CommandObjectPlatform.cpp --- a/lldb/source/Commands/CommandObjectPlatform.cpp +++ b/lldb/source/Commands/CommandObjectPlatform.cpp @@ -1215,8 +1215,7 @@ class CommandOptions : public Options { public: - CommandOptions() - : Options(), match_info(), show_args(false), verbose(false) {} + CommandOptions() : Options(), match_info() {} ~CommandOptions() override = default; @@ -1351,8 +1350,8 @@ // Instance variables to hold the values for command options. ProcessInstanceInfoMatch match_info; - bool show_args; - bool verbose; + bool show_args = false; + bool verbose = false; }; CommandOptions m_options; 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 @@ -1250,7 +1250,7 @@ class CommandOptions : public Options { public: - CommandOptions() : Options(), m_verbose(false) {} + CommandOptions() : Options() {} ~CommandOptions() override = default; @@ -1278,7 +1278,7 @@ } // Instance variables to hold the values for command options. - bool m_verbose; + bool m_verbose = false; }; protected: diff --git a/lldb/source/Commands/CommandObjectSettings.cpp b/lldb/source/Commands/CommandObjectSettings.cpp --- a/lldb/source/Commands/CommandObjectSettings.cpp +++ b/lldb/source/Commands/CommandObjectSettings.cpp @@ -87,7 +87,7 @@ class CommandOptions : public Options { public: - CommandOptions() : Options(), m_global(false) {} + CommandOptions() : Options() {} ~CommandOptions() override = default; @@ -120,7 +120,7 @@ } // Instance variables to hold the values for command options. - bool m_global; + bool m_global = false; bool m_force; }; diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -1969,7 +1969,7 @@ class CommandOptions : public Options { public: - CommandOptions() : Options(), m_sort_order(eSortOrderNone) {} + CommandOptions() : Options() {} ~CommandOptions() override = default; @@ -2005,7 +2005,7 @@ return llvm::makeArrayRef(g_target_modules_dump_symtab_options); } - SortOrder m_sort_order; + SortOrder m_sort_order = eSortOrderNone; OptionValueBoolean m_prefer_mangled = {false, false}; }; @@ -2902,9 +2902,7 @@ public: class CommandOptions : public Options { public: - CommandOptions() - : Options(), m_format_array(), m_use_global_module_list(false), - m_module_addr(LLDB_INVALID_ADDRESS) {} + CommandOptions() : Options(), m_format_array() {} ~CommandOptions() override = default; @@ -2939,8 +2937,8 @@ // Instance variables to hold the values for command options. typedef std::vector> FormatWidthCollection; FormatWidthCollection m_format_array; - bool m_use_global_module_list; - lldb::addr_t m_module_addr; + bool m_use_global_module_list = false; + lldb::addr_t m_module_addr = LLDB_INVALID_ADDRESS; }; CommandObjectTargetModulesList(CommandInterpreter &interpreter) @@ -3253,9 +3251,7 @@ class CommandOptions : public Options { public: - CommandOptions() - : Options(), m_type(eLookupTypeInvalid), m_str(), - m_addr(LLDB_INVALID_ADDRESS) {} + CommandOptions() : Options(), m_str() {} ~CommandOptions() override = default; @@ -3301,9 +3297,10 @@ // Instance variables to hold the values for command options. - int m_type; // Should be a eLookupTypeXXX enum after parsing options + int m_type = eLookupTypeInvalid; // Should be a eLookupTypeXXX enum after + // parsing options std::string m_str; // Holds name lookup - lldb::addr_t m_addr; // Holds the address to lookup + lldb::addr_t m_addr = LLDB_INVALID_ADDRESS; // Holds the address to lookup }; CommandObjectTargetModulesShowUnwind(CommandInterpreter &interpreter) @@ -4424,11 +4421,7 @@ public: class CommandOptions : public OptionGroup { public: - CommandOptions() - : OptionGroup(), m_line_start(0), m_line_end(UINT_MAX), - m_func_name_type_mask(eFunctionNameTypeAuto), - m_sym_ctx_specified(false), m_thread_specified(false), - m_use_one_liner(false), m_one_liner() {} + CommandOptions() : OptionGroup(), m_line_end(UINT_MAX), m_one_liner() {} ~CommandOptions() override = default; @@ -4555,20 +4548,21 @@ std::string m_class_name; std::string m_function_name; - uint32_t m_line_start; + uint32_t m_line_start = 0; uint32_t m_line_end; std::string m_file_name; std::string m_module_name; - uint32_t m_func_name_type_mask; // A pick from lldb::FunctionNameType. + uint32_t m_func_name_type_mask = + eFunctionNameTypeAuto; // A pick from lldb::FunctionNameType. lldb::tid_t m_thread_id; uint32_t m_thread_index; std::string m_thread_name; std::string m_queue_name; - bool m_sym_ctx_specified; + bool m_sym_ctx_specified = false; bool m_no_inlines; - bool m_thread_specified; + bool m_thread_specified = false; // Instance variables to hold the values for one_liner options. - bool m_use_one_liner; + bool m_use_one_liner = false; std::vector m_one_liner; bool m_auto_continue; 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 @@ -802,12 +802,10 @@ public: class CommandOptions : public Options { public: - uint32_t m_thread_idx; - uint32_t m_frame_idx; + uint32_t m_thread_idx = LLDB_INVALID_THREAD_ID; + uint32_t m_frame_idx = LLDB_INVALID_FRAME_ID; - CommandOptions() - : Options(), m_thread_idx(LLDB_INVALID_THREAD_ID), - m_frame_idx(LLDB_INVALID_FRAME_ID) { + CommandOptions() : Options() { // Keep default values of all options in one place: OptionParsingStarting // () OptionParsingStarting(nullptr); @@ -1374,7 +1372,7 @@ public: class CommandOptions : public Options { public: - CommandOptions() : Options(), m_from_expression(false) { + CommandOptions() : Options() { // Keep default values of all options in one place: OptionParsingStarting // () OptionParsingStarting(nullptr); @@ -1414,7 +1412,7 @@ return llvm::makeArrayRef(g_thread_return_options); } - bool m_from_expression; + bool m_from_expression = false; // Instance variables to hold the values for command options. }; diff --git a/lldb/source/Commands/CommandObjectType.cpp b/lldb/source/Commands/CommandObjectType.cpp --- a/lldb/source/Commands/CommandObjectType.cpp +++ b/lldb/source/Commands/CommandObjectType.cpp @@ -2712,8 +2712,7 @@ class CommandOptions : public OptionGroup { public: - CommandOptions() - : OptionGroup(), m_show_help(false), m_language(eLanguageTypeUnknown) {} + CommandOptions() : OptionGroup() {} ~CommandOptions() override = default; @@ -2750,8 +2749,8 @@ // Options table: Required for subclasses of Options. - bool m_show_help; - lldb::LanguageType m_language; + bool m_show_help = false; + lldb::LanguageType m_language = eLanguageTypeUnknown; }; OptionGroupOptions m_option_group; diff --git a/lldb/source/Commands/CommandObjectWatchpoint.cpp b/lldb/source/Commands/CommandObjectWatchpoint.cpp --- a/lldb/source/Commands/CommandObjectWatchpoint.cpp +++ b/lldb/source/Commands/CommandObjectWatchpoint.cpp @@ -166,11 +166,7 @@ class CommandOptions : public Options { public: - CommandOptions() - : Options(), - m_level(lldb::eDescriptionLevelBrief) // Watchpoint List defaults to - // brief descriptions - {} + CommandOptions() : Options() {} ~CommandOptions() override = default; @@ -206,7 +202,7 @@ // Instance variables to hold the values for command options. - lldb::DescriptionLevel m_level; + lldb::DescriptionLevel m_level = lldb::eDescriptionLevelBrief; }; protected: @@ -467,7 +463,7 @@ class CommandOptions : public Options { public: - CommandOptions() : Options(), m_force(false) {} + CommandOptions() : Options() {} ~CommandOptions() override = default; @@ -495,7 +491,7 @@ } // Instance variables to hold the values for command options. - bool m_force; + bool m_force = false; }; protected: @@ -593,7 +589,7 @@ class CommandOptions : public Options { public: - CommandOptions() : Options(), m_ignore_count(0) {} + CommandOptions() : Options() {} ~CommandOptions() override = default; @@ -625,7 +621,7 @@ // Instance variables to hold the values for command options. - uint32_t m_ignore_count; + uint32_t m_ignore_count = 0; }; protected: @@ -721,7 +717,7 @@ class CommandOptions : public Options { public: - CommandOptions() : Options(), m_condition(), m_condition_passed(false) {} + CommandOptions() : Options(), m_condition() {} ~CommandOptions() override = default; @@ -754,7 +750,7 @@ // Instance variables to hold the values for command options. std::string m_condition; - bool m_condition_passed; + bool m_condition_passed = false; }; protected: diff --git a/lldb/source/Commands/CommandObjectWatchpointCommand.cpp b/lldb/source/Commands/CommandObjectWatchpointCommand.cpp --- a/lldb/source/Commands/CommandObjectWatchpointCommand.cpp +++ b/lldb/source/Commands/CommandObjectWatchpointCommand.cpp @@ -314,10 +314,7 @@ class CommandOptions : public Options { public: - CommandOptions() - : Options(), m_use_commands(false), m_use_script_language(false), - m_script_language(eScriptLanguageNone), m_use_one_liner(false), - m_one_liner(), m_function_name() {} + CommandOptions() : Options(), m_one_liner(), m_function_name() {} ~CommandOptions() override = default; @@ -387,12 +384,12 @@ // Instance variables to hold the values for command options. - bool m_use_commands; - bool m_use_script_language; - lldb::ScriptLanguage m_script_language; + bool m_use_commands = false; + bool m_use_script_language = false; + lldb::ScriptLanguage m_script_language = eScriptLanguageNone; // Instance variables to hold the values for one_liner options. - bool m_use_one_liner; + bool m_use_one_liner = false; std::string m_one_liner; bool m_stop_on_error; std::string m_function_name; diff --git a/lldb/source/Core/AddressRange.cpp b/lldb/source/Core/AddressRange.cpp --- a/lldb/source/Core/AddressRange.cpp +++ b/lldb/source/Core/AddressRange.cpp @@ -28,7 +28,7 @@ using namespace lldb; using namespace lldb_private; -AddressRange::AddressRange() : m_base_addr(), m_byte_size(0) {} +AddressRange::AddressRange() : m_base_addr() {} AddressRange::AddressRange(addr_t file_addr, addr_t byte_size, const SectionList *section_list) 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 @@ -2219,9 +2219,7 @@ class ValueObjectListDelegate : public WindowDelegate { public: - ValueObjectListDelegate() - : 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() : m_rows() {} ValueObjectListDelegate(ValueObjectList &valobj_list) : m_rows(), m_selected_row(nullptr), m_selected_row_idx(0), @@ -2409,14 +2407,14 @@ protected: std::vector m_rows; - Row *m_selected_row; - uint32_t m_selected_row_idx; - uint32_t m_first_visible_row; - uint32_t m_num_rows; + Row *m_selected_row = nullptr; + uint32_t m_selected_row_idx = 0; + uint32_t m_first_visible_row = 0; + uint32_t m_num_rows = 0; int m_min_x; int m_min_y; - int m_max_x; - int m_max_y; + int m_max_x = 0; + int m_max_y = 0; static Format FormatForChar(int c) { switch (c) { 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 @@ -257,9 +257,7 @@ m_object_name.IsEmpty() ? "" : ")"); } -Module::Module() - : m_object_offset(0), m_file_has_changed(false), - m_first_file_changed_log(false) { +Module::Module() : m_file_has_changed(false), m_first_file_changed_log(false) { std::lock_guard guard( GetAllocationModuleCollectionMutex()); GetModuleCollection().push_back(this); 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 @@ -132,8 +132,7 @@ return m_symlink_paths; } -ModuleList::ModuleList() - : m_modules(), m_modules_mutex(), m_notifier(nullptr) {} +ModuleList::ModuleList() : m_modules(), m_modules_mutex() {} ModuleList::ModuleList(const ModuleList &rhs) : m_modules(), m_modules_mutex(), m_notifier(nullptr) { diff --git a/lldb/source/Core/PluginManager.cpp b/lldb/source/Core/PluginManager.cpp --- a/lldb/source/Core/PluginManager.cpp +++ b/lldb/source/Core/PluginManager.cpp @@ -38,11 +38,11 @@ typedef void (*PluginTermCallback)(); struct PluginInfo { - PluginInfo() : plugin_init_callback(nullptr), plugin_term_callback(nullptr) {} + PluginInfo() {} llvm::sys::DynamicLibrary library; - PluginInitCallback plugin_init_callback; - PluginTermCallback plugin_term_callback; + PluginInitCallback plugin_init_callback = nullptr; + PluginTermCallback plugin_term_callback = nullptr; }; typedef std::map PluginTerminateMap; 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 @@ -38,10 +38,7 @@ using namespace lldb; using namespace lldb_private; -Value::Value() - : m_value(), m_compiler_type(), m_context(nullptr), - m_value_type(ValueType::Scalar), m_context_type(ContextType::Invalid), - m_data_buffer() {} +Value::Value() : m_value(), m_compiler_type(), m_data_buffer() {} Value::Value(const Scalar &scalar) : m_value(scalar), m_compiler_type(), m_context(nullptr), 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 @@ -2796,8 +2796,7 @@ return valobj_sp; } -ValueObject::EvaluationPoint::EvaluationPoint() - : m_mod_id(), m_exe_ctx_ref(), m_needs_update(true) {} +ValueObject::EvaluationPoint::EvaluationPoint() : m_mod_id(), m_exe_ctx_ref() {} ValueObject::EvaluationPoint::EvaluationPoint(ExecutionContextScope *exe_scope, bool use_selected) diff --git a/lldb/source/DataFormatters/TypeFormat.cpp b/lldb/source/DataFormatters/TypeFormat.cpp --- a/lldb/source/DataFormatters/TypeFormat.cpp +++ b/lldb/source/DataFormatters/TypeFormat.cpp @@ -27,8 +27,7 @@ using namespace lldb; using namespace lldb_private; -TypeFormatImpl::TypeFormatImpl(const Flags &flags) - : m_flags(flags), m_my_revision(0) {} +TypeFormatImpl::TypeFormatImpl(const Flags &flags) : m_flags(flags) {} TypeFormatImpl::~TypeFormatImpl() {} diff --git a/lldb/source/DataFormatters/TypeSummary.cpp b/lldb/source/DataFormatters/TypeSummary.cpp --- a/lldb/source/DataFormatters/TypeSummary.cpp +++ b/lldb/source/DataFormatters/TypeSummary.cpp @@ -26,8 +26,7 @@ using namespace lldb; using namespace lldb_private; -TypeSummaryOptions::TypeSummaryOptions() - : m_lang(eLanguageTypeUnknown), m_capping(eTypeSummaryCapped) {} +TypeSummaryOptions::TypeSummaryOptions() {} lldb::LanguageType TypeSummaryOptions::GetLanguage() const { return m_lang; } 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 @@ -55,9 +55,7 @@ } // DWARFExpression constructor -DWARFExpression::DWARFExpression() - : m_module_wp(), m_data(), m_dwarf_cu(nullptr), - m_reg_kind(eRegisterKindDWARF) {} +DWARFExpression::DWARFExpression() : m_module_wp(), m_data() {} DWARFExpression::DWARFExpression(lldb::ModuleSP module_sp, const DataExtractor &data, diff --git a/lldb/source/Host/common/FileAction.cpp b/lldb/source/Host/common/FileAction.cpp --- a/lldb/source/Host/common/FileAction.cpp +++ b/lldb/source/Host/common/FileAction.cpp @@ -16,8 +16,7 @@ // FileAction member functions -FileAction::FileAction() - : m_action(eFileActionNone), m_fd(-1), m_arg(-1), m_file_spec() {} +FileAction::FileAction() : m_file_spec() {} void FileAction::Clear() { m_action = eFileActionNone; diff --git a/lldb/source/Host/common/Host.cpp b/lldb/source/Host/common/Host.cpp --- a/lldb/source/Host/common/Host.cpp +++ b/lldb/source/Host/common/Host.cpp @@ -442,14 +442,12 @@ #endif struct ShellInfo { - ShellInfo() - : process_reaped(false), pid(LLDB_INVALID_PROCESS_ID), signo(-1), - status(-1) {} + ShellInfo() : process_reaped(false) {} lldb_private::Predicate process_reaped; - lldb::pid_t pid; - int signo; - int status; + lldb::pid_t pid = LLDB_INVALID_PROCESS_ID; + int signo = -1; + int status = -1; }; static bool 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 @@ -18,7 +18,7 @@ using namespace lldb_private; HostNativeThreadBase::HostNativeThreadBase() - : m_thread(LLDB_INVALID_HOST_THREAD), m_result(0) {} + : m_thread(LLDB_INVALID_HOST_THREAD) {} HostNativeThreadBase::HostNativeThreadBase(thread_t thread) : m_thread(thread), m_result(0) {} 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 @@ -30,10 +30,9 @@ ProcessLaunchInfo::ProcessLaunchInfo() : ProcessInfo(), m_working_dir(), m_plugin_name(), m_flags(0), - m_file_actions(), m_pty(new PseudoTerminal), m_resume_count(0), - m_monitor_callback(nullptr), m_monitor_callback_baton(nullptr), - m_monitor_signals(false), m_listener_sp(), m_hijack_listener_sp(), - m_scripted_process_class_name(), m_scripted_process_dictionary_sp() {} + m_file_actions(), m_pty(new PseudoTerminal), m_monitor_callback(nullptr), + m_listener_sp(), m_hijack_listener_sp(), m_scripted_process_class_name(), + m_scripted_process_dictionary_sp() {} ProcessLaunchInfo::ProcessLaunchInfo(const FileSpec &stdin_file_spec, const FileSpec &stdout_file_spec, diff --git a/lldb/source/Host/common/ProcessRunLock.cpp b/lldb/source/Host/common/ProcessRunLock.cpp --- a/lldb/source/Host/common/ProcessRunLock.cpp +++ b/lldb/source/Host/common/ProcessRunLock.cpp @@ -11,7 +11,7 @@ namespace lldb_private { -ProcessRunLock::ProcessRunLock() : m_running(false) { +ProcessRunLock::ProcessRunLock() { int err = ::pthread_rwlock_init(&m_rwlock, nullptr); (void)err; } diff --git a/lldb/source/Host/common/PseudoTerminal.cpp b/lldb/source/Host/common/PseudoTerminal.cpp --- a/lldb/source/Host/common/PseudoTerminal.cpp +++ b/lldb/source/Host/common/PseudoTerminal.cpp @@ -29,8 +29,7 @@ using namespace lldb_private; // PseudoTerminal constructor -PseudoTerminal::PseudoTerminal() - : m_primary_fd(invalid_fd), m_secondary_fd(invalid_fd) {} +PseudoTerminal::PseudoTerminal() {} // Destructor // diff --git a/lldb/source/Host/common/Terminal.cpp b/lldb/source/Host/common/Terminal.cpp --- a/lldb/source/Host/common/Terminal.cpp +++ b/lldb/source/Host/common/Terminal.cpp @@ -83,11 +83,12 @@ // Default constructor TerminalState::TerminalState() - : m_tty(), m_tflags(-1), + : m_tty() #if LLDB_ENABLE_TERMIOS - m_termios_up(), + , + m_termios_up() #endif - m_process_group(-1) { +{ } // Destructor @@ -189,7 +190,7 @@ } // Constructor -TerminalStateSwitcher::TerminalStateSwitcher() : m_currentState(UINT32_MAX) {} +TerminalStateSwitcher::TerminalStateSwitcher() {} // Destructor TerminalStateSwitcher::~TerminalStateSwitcher() {} diff --git a/lldb/source/Host/common/XML.cpp b/lldb/source/Host/common/XML.cpp --- a/lldb/source/Host/common/XML.cpp +++ b/lldb/source/Host/common/XML.cpp @@ -17,7 +17,7 @@ #pragma mark-- XMLDocument -XMLDocument::XMLDocument() : m_document(nullptr) {} +XMLDocument::XMLDocument() {} XMLDocument::~XMLDocument() { Clear(); } @@ -91,7 +91,7 @@ #pragma mark-- XMLNode -XMLNode::XMLNode() : m_node(nullptr) {} +XMLNode::XMLNode() {} XMLNode::XMLNode(XMLNodeImpl node) : m_node(node) {} diff --git a/lldb/source/Host/macosx/objcxx/HostThreadMacOSX.mm b/lldb/source/Host/macosx/objcxx/HostThreadMacOSX.mm --- a/lldb/source/Host/macosx/objcxx/HostThreadMacOSX.mm +++ b/lldb/source/Host/macosx/objcxx/HostThreadMacOSX.mm @@ -23,9 +23,7 @@ class MacOSXDarwinThread { public: - MacOSXDarwinThread() : m_pool(nil) { - m_pool = [[NSAutoreleasePool alloc] init]; - } + MacOSXDarwinThread() { m_pool = [[NSAutoreleasePool alloc] init]; } ~MacOSXDarwinThread() { if (m_pool) { @@ -41,7 +39,7 @@ } protected: - NSAutoreleasePool *m_pool; + NSAutoreleasePool *m_pool = nil; private: MacOSXDarwinThread(const MacOSXDarwinThread &) = delete; diff --git a/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp b/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp --- a/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp +++ b/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp @@ -76,7 +76,7 @@ ConnectionFileDescriptor::ConnectionFileDescriptor(bool child_processes_inherit) : Connection(), m_pipe(), m_mutex(), m_shutting_down(false), - m_waiting_for_accept(false), + m_child_processes_inherit(child_processes_inherit) { Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION | LIBLLDB_LOG_OBJECT)); diff --git a/lldb/source/Initialization/SystemLifetimeManager.cpp b/lldb/source/Initialization/SystemLifetimeManager.cpp --- a/lldb/source/Initialization/SystemLifetimeManager.cpp +++ b/lldb/source/Initialization/SystemLifetimeManager.cpp @@ -15,8 +15,7 @@ using namespace lldb_private; -SystemLifetimeManager::SystemLifetimeManager() - : m_mutex(), m_initialized(false) {} +SystemLifetimeManager::SystemLifetimeManager() : m_mutex() {} SystemLifetimeManager::~SystemLifetimeManager() { assert(!m_initialized && 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 @@ -22,9 +22,8 @@ // only usefully complete in the file name part of it so it should be good // enough. OptionValueFileColonLine::OptionValueFileColonLine() - : m_line_number(LLDB_INVALID_LINE_NUMBER), - m_column_number(LLDB_INVALID_COLUMN_NUMBER), - m_completion_mask(CommandCompletions::eSourceFileCompletion) {} + +{} OptionValueFileColonLine::OptionValueFileColonLine(llvm::StringRef input) : m_line_number(LLDB_INVALID_LINE_NUMBER), 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 @@ -18,9 +18,7 @@ using namespace lldb; using namespace lldb_private; -OptionValueFileSpec::OptionValueFileSpec(bool resolve) - : m_completion_mask(CommandCompletions::eDiskFileCompletion), - m_resolve(resolve) {} +OptionValueFileSpec::OptionValueFileSpec(bool resolve) : m_resolve(resolve) {} OptionValueFileSpec::OptionValueFileSpec(const FileSpec &value, bool resolve) : m_current_value(value), m_default_value(value), diff --git a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h --- a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h +++ b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h @@ -125,11 +125,7 @@ class KextImageInfo { public: - KextImageInfo() - : m_name(), m_module_sp(), m_memory_module_sp(), - m_load_process_stop_id(UINT32_MAX), m_uuid(), - m_load_address(LLDB_INVALID_ADDRESS), m_size(0), - m_kernel_image(false) {} + KextImageInfo() : m_name(), m_module_sp(), m_memory_module_sp(), m_uuid() {} void Clear() { m_load_address = LLDB_INVALID_ADDRESS; @@ -201,24 +197,26 @@ std::string m_name; lldb::ModuleSP m_module_sp; lldb::ModuleSP m_memory_module_sp; - uint32_t m_load_process_stop_id; // the stop-id when this module was added - // to the Target + uint32_t m_load_process_stop_id = + UINT32_MAX; // the stop-id when this module was added + // to the Target lldb_private::UUID m_uuid; // UUID for this dylib if it has one, else all zeros - lldb::addr_t m_load_address; - uint64_t m_size; - bool m_kernel_image; // true if this is the kernel, false if this is a kext + lldb::addr_t m_load_address = LLDB_INVALID_ADDRESS; + uint64_t m_size = 0; + bool m_kernel_image = + false; // true if this is the kernel, false if this is a kext }; struct OSKextLoadedKextSummaryHeader { - uint32_t version; - uint32_t entry_size; - uint32_t entry_count; - lldb::addr_t image_infos_addr; + uint32_t version = 0; + uint32_t entry_size = 0; + uint32_t entry_count = 0; + lldb::addr_t image_infos_addr = LLDB_INVALID_ADDRESS; OSKextLoadedKextSummaryHeader() - : version(0), entry_size(0), entry_count(0), - image_infos_addr(LLDB_INVALID_ADDRESS) {} + + {} uint32_t GetSize() { switch (version) { diff --git a/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/HexagonDYLDRendezvous.h b/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/HexagonDYLDRendezvous.h --- a/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/HexagonDYLDRendezvous.h +++ b/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/HexagonDYLDRendezvous.h @@ -35,15 +35,13 @@ // the layout of this struct is not binary compatible, it is simply large // enough to hold the information on both 32 and 64 bit platforms. struct Rendezvous { - uint64_t version; - lldb::addr_t map_addr; - lldb::addr_t brk; - uint64_t state; - lldb::addr_t ldbase; - - Rendezvous() - : version(0), map_addr(LLDB_INVALID_ADDRESS), brk(LLDB_INVALID_ADDRESS), - state(0), ldbase(0) {} + uint64_t version = 0; + lldb::addr_t map_addr = LLDB_INVALID_ADDRESS; + lldb::addr_t brk = LLDB_INVALID_ADDRESS; + uint64_t state = 0; + lldb::addr_t ldbase = 0; + + Rendezvous() {} }; public: diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.h b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.h --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.h +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.h @@ -73,19 +73,17 @@ class Segment { public: - Segment() - : name(), vmaddr(LLDB_INVALID_ADDRESS), vmsize(0), fileoff(0), - filesize(0), maxprot(0), initprot(0), nsects(0), flags(0) {} + Segment() : name() {} lldb_private::ConstString name; - lldb::addr_t vmaddr; - lldb::addr_t vmsize; - lldb::addr_t fileoff; - lldb::addr_t filesize; - uint32_t maxprot; - uint32_t initprot; - uint32_t nsects; - uint32_t flags; + lldb::addr_t vmaddr = LLDB_INVALID_ADDRESS; + lldb::addr_t vmsize = 0; + lldb::addr_t fileoff = 0; + lldb::addr_t filesize = 0; + uint32_t maxprot = 0; + uint32_t initprot = 0; + uint32_t nsects = 0; + uint32_t flags = 0; bool operator==(const Segment &rhs) const { return name == rhs.name && vmaddr == rhs.vmaddr && vmsize == rhs.vmsize; diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h @@ -98,20 +98,17 @@ lldb_private::FileSpec *lc_id_dylinker); struct DYLDAllImageInfos { - uint32_t version; - uint32_t dylib_info_count; // Version >= 1 - lldb::addr_t dylib_info_addr; // Version >= 1 - lldb::addr_t notification; // Version >= 1 - bool processDetachedFromSharedRegion; // Version >= 1 - bool libSystemInitialized; // Version >= 2 - lldb::addr_t dyldImageLoadAddress; // Version >= 2 + uint32_t version = 0; + uint32_t dylib_info_count = 0; // Version >= 1 + lldb::addr_t dylib_info_addr = LLDB_INVALID_ADDRESS; // Version >= 1 + lldb::addr_t notification = LLDB_INVALID_ADDRESS; // Version >= 1 + bool processDetachedFromSharedRegion = false; // Version >= 1 + bool libSystemInitialized = false; // Version >= 2 + lldb::addr_t dyldImageLoadAddress = LLDB_INVALID_ADDRESS; // Version >= 2 DYLDAllImageInfos() - : version(0), dylib_info_count(0), - dylib_info_addr(LLDB_INVALID_ADDRESS), - notification(LLDB_INVALID_ADDRESS), - processDetachedFromSharedRegion(false), libSystemInitialized(false), - dyldImageLoadAddress(LLDB_INVALID_ADDRESS) {} + + {} void Clear() { version = 0; diff --git a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.h b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.h --- a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.h +++ b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.h @@ -38,13 +38,13 @@ // the layout of this struct is not binary compatible, it is simply large // enough to hold the information on both 32 and 64 bit platforms. struct Rendezvous { - uint64_t version; - lldb::addr_t map_addr; - lldb::addr_t brk; - uint64_t state; - lldb::addr_t ldbase; + uint64_t version = 0; + lldb::addr_t map_addr = 0; + lldb::addr_t brk = 0; + uint64_t state = 0; + lldb::addr_t ldbase = 0; - Rendezvous() : version(0), map_addr(0), brk(0), state(0), ldbase(0) {} + Rendezvous() {} }; public: diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.h b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.h --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.h +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.h @@ -216,7 +216,7 @@ void ForgetSource(clang::ASTContext *dst_ctx, clang::ASTContext *src_ctx); struct DeclOrigin { - DeclOrigin() : ctx(nullptr), decl(nullptr) {} + DeclOrigin() {} DeclOrigin(clang::ASTContext *_ctx, clang::Decl *_decl) : ctx(_ctx), decl(_decl) { @@ -236,8 +236,8 @@ bool Valid() const { return (ctx != nullptr || decl != nullptr); } - clang::ASTContext *ctx; - clang::Decl *decl; + clang::ASTContext *ctx = nullptr; + clang::Decl *decl = nullptr; }; /// Listener interface used by the ASTImporterDelegate to inform other code diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h @@ -248,10 +248,10 @@ lldb::SymbolType symbol_type); struct TargetInfo { - lldb::ByteOrder byte_order; - size_t address_byte_size; + lldb::ByteOrder byte_order = lldb::eByteOrderInvalid; + size_t address_byte_size = 0; - TargetInfo() : byte_order(lldb::eByteOrderInvalid), address_byte_size(0) {} + TargetInfo() {} bool IsValid() { return (byte_order != lldb::eByteOrderInvalid && address_byte_size != 0); @@ -353,16 +353,15 @@ /// The following values contain layout information for the materialized /// struct, but are not specific to a single materialization struct StructVars { - StructVars() - : m_struct_alignment(0), m_struct_size(0), m_struct_laid_out(false), - m_result_name(), m_object_pointer_type(nullptr, nullptr) {} - - lldb::offset_t - m_struct_alignment; ///< The alignment of the struct in bytes. - size_t m_struct_size; ///< The size of the struct in bytes. - bool m_struct_laid_out; ///< True if the struct has been laid out and the - ///layout is valid (that is, no new fields have been - ///added since). + StructVars() : m_result_name(), m_object_pointer_type(nullptr, nullptr) {} + + lldb::offset_t m_struct_alignment = + 0; ///< The alignment of the struct in bytes. + size_t m_struct_size = 0; ///< The size of the struct in bytes. + bool m_struct_laid_out = + false; ///< True if the struct has been laid out and the + /// layout is valid (that is, no new fields have been + /// added since). ConstString m_result_name; ///< The name of the result variable ($1, for example) TypeFromUser m_object_pointer_type; ///< The type of the "this" variable, if diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionVariable.h b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionVariable.h --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionVariable.h +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionVariable.h @@ -116,19 +116,19 @@ /// The following values should not live beyond parsing class ParserVars { public: - ParserVars() - : m_named_decl(nullptr), m_llvm_value(nullptr), - m_lldb_value(), m_lldb_var(), m_lldb_sym(nullptr) {} - - const clang::NamedDecl - *m_named_decl; ///< The Decl corresponding to this variable - llvm::Value *m_llvm_value; ///< The IR value corresponding to this variable; - ///usually a GlobalValue + ParserVars() : m_lldb_value(), m_lldb_var() {} + + const clang::NamedDecl *m_named_decl = + nullptr; ///< The Decl corresponding to this variable + llvm::Value *m_llvm_value = + nullptr; ///< The IR value corresponding to this variable; + /// usually a GlobalValue lldb_private::Value m_lldb_value; ///< The value found in LLDB for this variable lldb::VariableSP m_lldb_var; ///< The original variable for this variable - const lldb_private::Symbol *m_lldb_sym; ///< The original symbol for this - ///variable, if it was a symbol + const lldb_private::Symbol *m_lldb_sym = + nullptr; ///< The original symbol for this + /// variable, if it was a symbol }; private: @@ -157,13 +157,13 @@ /// The following values are valid if the variable is used by JIT code struct JITVars { - JITVars() : m_alignment(0), m_size(0), m_offset(0) {} + JITVars() {} - lldb::offset_t - m_alignment; ///< The required alignment of the variable, in bytes - size_t m_size; ///< The space required for the variable, in bytes - lldb::offset_t - m_offset; ///< The offset of the variable in the struct, in bytes + lldb::offset_t m_alignment = + 0; ///< The required alignment of the variable, in bytes + size_t m_size = 0; ///< The space required for the variable, in bytes + lldb::offset_t m_offset = + 0; ///< The offset of the variable in the struct, in bytes }; private: diff --git a/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.h b/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.h --- a/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.h +++ b/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.h @@ -19,7 +19,7 @@ // ITSession - Keep track of the IT Block progression. class ITSession { public: - ITSession() : ITCounter(0), ITState(0) {} + ITSession() {} ~ITSession() {} // InitIT - Initializes ITCounter/ITState. @@ -39,8 +39,8 @@ uint32_t GetCond(); private: - uint32_t ITCounter; // Possible values: 0, 1, 2, 3, 4. - uint32_t ITState; // A2.5.2 Consists of IT[7:5] and IT[4:0] initially. + uint32_t ITCounter = 0; // Possible values: 0, 1, 2, 3, 4. + uint32_t ITState = 0; // A2.5.2 Consists of IT[7:5] and IT[4:0] initially. }; class EmulateInstructionARM : public EmulateInstruction { diff --git a/lldb/source/Plugins/Instruction/ARM/EmulationStateARM.h b/lldb/source/Plugins/Instruction/ARM/EmulationStateARM.h --- a/lldb/source/Plugins/Instruction/ARM/EmulationStateARM.h +++ b/lldb/source/Plugins/Instruction/ARM/EmulationStateARM.h @@ -61,7 +61,7 @@ const lldb_private::RegisterValue ®_value); private: - uint32_t m_gpr[17]; + uint32_t m_gpr[17] = {0}; struct _sd_regs { uint32_t s_regs[32]; // sregs 0 - 31 & dregs 0 - 15 diff --git a/lldb/source/Plugins/Instruction/ARM/EmulationStateARM.cpp b/lldb/source/Plugins/Instruction/ARM/EmulationStateARM.cpp --- a/lldb/source/Plugins/Instruction/ARM/EmulationStateARM.cpp +++ b/lldb/source/Plugins/Instruction/ARM/EmulationStateARM.cpp @@ -20,7 +20,7 @@ using namespace lldb; using namespace lldb_private; -EmulationStateARM::EmulationStateARM() : m_gpr(), m_vfp_regs(), m_memory() { +EmulationStateARM::EmulationStateARM() : m_vfp_regs(), m_memory() { ClearPseudoRegisters(); } diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h --- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h +++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h @@ -28,8 +28,7 @@ class MethodName { public: MethodName() - : m_full(), m_basename(), m_context(), m_arguments(), m_qualifiers(), - m_parsed(false), m_parse_error(false) {} + : m_full(), m_basename(), m_context(), m_arguments(), m_qualifiers() {} MethodName(ConstString s) : m_full(s), m_basename(), m_context(), m_arguments(), m_qualifiers(), @@ -68,8 +67,8 @@ llvm::StringRef m_context; // Decl context: "lldb::SBTarget" llvm::StringRef m_arguments; // Arguments: "(unsigned int)" llvm::StringRef m_qualifiers; // Qualifiers: "const" - bool m_parsed; - bool m_parse_error; + bool m_parsed = false; + bool m_parse_error = false; }; CPlusPlusLanguage() = default; 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 @@ -209,14 +209,13 @@ m_process = nullptr; } - InlinedIndexes() - : m_indexes(0), m_count(0), m_ptr_size(0), m_process(nullptr) {} + InlinedIndexes() {} private: - uint64_t m_indexes; - size_t m_count; - uint32_t m_ptr_size; - Process *m_process; + uint64_t m_indexes = 0; + size_t m_count = 0; + uint32_t m_ptr_size = 0; + Process *m_process = nullptr; // cfr. Foundation for the details of this code size_t _lengthForInlinePayload(uint32_t ptr_size) { @@ -271,10 +270,10 @@ m_count = 0; } - OutsourcedIndexes() : m_indexes(nullptr), m_count(0) {} + OutsourcedIndexes() {} - ValueObject *m_indexes; - size_t m_count; + ValueObject *m_indexes = nullptr; + size_t m_count = 0; }; union { @@ -288,9 +287,9 @@ m_outsourced.Clear(); } - Impl() : m_mode(Mode::Invalid) {} + Impl() {} - Mode m_mode; + Mode m_mode = Mode::Invalid; } m_impl; uint32_t m_ptr_size; diff --git a/lldb/source/Plugins/Language/ObjC/ObjCLanguage.h b/lldb/source/Plugins/Language/ObjC/ObjCLanguage.h --- a/lldb/source/Plugins/Language/ObjC/ObjCLanguage.h +++ b/lldb/source/Plugins/Language/ObjC/ObjCLanguage.h @@ -27,9 +27,7 @@ public: enum Type { eTypeUnspecified, eTypeClassMethod, eTypeInstanceMethod }; - MethodName() - : m_full(), m_class(), m_category(), m_selector(), - m_type(eTypeUnspecified), m_category_is_valid(false) {} + MethodName() : m_full(), m_class(), m_category(), m_selector() {} MethodName(const char *name, bool strict) : m_full(), m_class(), m_category(), m_selector(), @@ -81,8 +79,8 @@ m_class_category; // Class with category: "NSString(my_additions)" ConstString m_category; // Category: "my_additions" ConstString m_selector; // Selector: "myStringWithCString:" - Type m_type; - bool m_category_is_valid; + Type m_type = eTypeUnspecified; + bool m_category_is_valid = false; }; ObjCLanguage() = default; diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.h b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.h --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.h +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.h @@ -77,16 +77,14 @@ static const uint32_t RW_REALIZED = (1 << 31); struct objc_class_t { - ObjCLanguageRuntime::ObjCISA m_isa; // The class's metaclass. - ObjCLanguageRuntime::ObjCISA m_superclass; - lldb::addr_t m_cache_ptr; - lldb::addr_t m_vtable_ptr; - lldb::addr_t m_data_ptr; - uint8_t m_flags; + ObjCLanguageRuntime::ObjCISA m_isa = 0; // The class's metaclass. + ObjCLanguageRuntime::ObjCISA m_superclass = 0; + lldb::addr_t m_cache_ptr = 0; + lldb::addr_t m_vtable_ptr = 0; + lldb::addr_t m_data_ptr = 0; + uint8_t m_flags = 0; - objc_class_t() - : m_isa(0), m_superclass(0), m_cache_ptr(0), m_vtable_ptr(0), - m_data_ptr(0), m_flags(0) {} + objc_class_t() {} void Clear() { m_isa = 0; @@ -213,7 +211,7 @@ void fill(AppleObjCRuntimeV2 &runtime, ClassDescriptorV2 &descriptor); private: - bool m_filled; + bool m_filled = false; std::vector m_ivars; std::recursive_mutex m_mutex; }; diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp @@ -514,8 +514,7 @@ return 0; } -ClassDescriptorV2::iVarsStorage::iVarsStorage() - : m_filled(false), m_ivars(), m_mutex() {} +ClassDescriptorV2::iVarsStorage::iVarsStorage() : m_ivars(), m_mutex() {} size_t ClassDescriptorV2::iVarsStorage::size() { return m_ivars.size(); } diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h @@ -126,8 +126,7 @@ class HashTableSignature { public: - HashTableSignature() - : m_count(0), m_num_buckets(0), m_buckets_ptr(LLDB_INVALID_ADDRESS) {} + HashTableSignature() {} bool NeedsUpdate(uint32_t count, uint32_t num_buckets, lldb::addr_t buckets_ptr) { @@ -143,9 +142,9 @@ } protected: - uint32_t m_count; - uint32_t m_num_buckets; - lldb::addr_t m_buckets_ptr; + uint32_t m_count = 0; + uint32_t m_num_buckets = 0; + lldb::addr_t m_buckets_ptr = LLDB_INVALID_ADDRESS; }; lldb::addr_t GetISAHashTablePointer(); diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h @@ -116,9 +116,9 @@ void UpdateSignature(const RemoteNXMapTable &hash_table); protected: - uint32_t m_count; - uint32_t m_num_buckets; - lldb::addr_t m_buckets_ptr; + uint32_t m_count = 0; + uint32_t m_num_buckets = 0; + lldb::addr_t m_buckets_ptr = 0; }; class NonPointerISACache { diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp @@ -1032,11 +1032,7 @@ class RemoteNXMapTable { public: - RemoteNXMapTable() - : m_count(0), m_num_buckets_minus_one(0), - m_buckets_ptr(LLDB_INVALID_ADDRESS), m_process(nullptr), - m_end_iterator(*this, -1), m_load_addr(LLDB_INVALID_ADDRESS), - m_map_pair_size(0), m_invalid_key(0) {} + RemoteNXMapTable() : m_end_iterator(*this, -1) {} void Dump() { printf("RemoteNXMapTable.m_load_addr = 0x%" PRIx64 "\n", m_load_addr); @@ -1210,18 +1206,17 @@ private: // contents of _NXMapTable struct - uint32_t m_count; - uint32_t m_num_buckets_minus_one; - lldb::addr_t m_buckets_ptr; - lldb_private::Process *m_process; + uint32_t m_count = 0; + uint32_t m_num_buckets_minus_one = 0; + lldb::addr_t m_buckets_ptr = LLDB_INVALID_ADDRESS; + lldb_private::Process *m_process = nullptr; const_iterator m_end_iterator; - lldb::addr_t m_load_addr; - size_t m_map_pair_size; - lldb::addr_t m_invalid_key; + lldb::addr_t m_load_addr = LLDB_INVALID_ADDRESS; + size_t m_map_pair_size = 0; + lldb::addr_t m_invalid_key = 0; }; -AppleObjCRuntimeV2::HashTableSignature::HashTableSignature() - : m_count(0), m_num_buckets(0), m_buckets_ptr(0) {} +AppleObjCRuntimeV2::HashTableSignature::HashTableSignature() {} void AppleObjCRuntimeV2::HashTableSignature::UpdateSignature( const RemoteNXMapTable &hash_table) { diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.h b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.h --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.h +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.h @@ -76,10 +76,7 @@ class VTableRegion { public: - VTableRegion() - : m_valid(false), m_owner(nullptr), - m_header_addr(LLDB_INVALID_ADDRESS), m_code_start_addr(0), - m_code_end_addr(0), m_next_region(0) {} + VTableRegion() {} VTableRegion(AppleObjCVTables *owner, lldb::addr_t header_addr); @@ -99,13 +96,13 @@ void Dump(Stream &s); - bool m_valid; - AppleObjCVTables *m_owner; - lldb::addr_t m_header_addr; - lldb::addr_t m_code_start_addr; - lldb::addr_t m_code_end_addr; + bool m_valid = false; + AppleObjCVTables *m_owner = nullptr; + lldb::addr_t m_header_addr = LLDB_INVALID_ADDRESS; + lldb::addr_t m_code_start_addr = 0; + lldb::addr_t m_code_end_addr = 0; std::vector m_descriptors; - lldb::addr_t m_next_region; + lldb::addr_t m_next_region = 0; }; public: diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.h b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.h --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.h +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.h @@ -29,7 +29,7 @@ struct StructElement { std::string name; clang::QualType type; - uint32_t bitfield; + uint32_t bitfield = 0; StructElement(); ~StructElement() = default; diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp @@ -59,7 +59,7 @@ // "{CGRect=\"origin\"{CGPoint=\"x\"d\"y\"d}\"size\"{CGSize=\"width\"d\"height\"d}}" AppleObjCTypeEncodingParser::StructElement::StructElement() - : name(""), type(clang::QualType()), bitfield(0) {} + : name(""), type(clang::QualType()) {} AppleObjCTypeEncodingParser::StructElement AppleObjCTypeEncodingParser::ReadStructElement(TypeSystemClang &ast_ctx, diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h b/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h --- a/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h @@ -49,9 +49,7 @@ // implementations of the runtime, and more might come class ClassDescriptor { public: - ClassDescriptor() - : m_is_kvo(eLazyBoolCalculate), m_is_cf(eLazyBoolCalculate), - m_type_wp() {} + ClassDescriptor() : m_type_wp() {} virtual ~ClassDescriptor() = default; @@ -145,8 +143,8 @@ bool check_version_specific = false) const; private: - LazyBool m_is_kvo; - LazyBool m_is_cf; + LazyBool m_is_kvo = eLazyBoolCalculate; + LazyBool m_is_cf = eLazyBoolCalculate; lldb::TypeWP m_type_wp; }; diff --git a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h --- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h +++ b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h @@ -44,9 +44,9 @@ typedef std::shared_ptr RSScriptGroupDescriptorSP; struct RSCoordinate { - uint32_t x, y, z; + uint32_t x = 0, y = 0, z = 0; - RSCoordinate() : x(), y(), z(){}; + RSCoordinate(){}; bool operator==(const lldb_renderscript::RSCoordinate &rhs) { return x == rhs.x && y == rhs.y && z == rhs.z; diff --git a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp --- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp +++ b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp @@ -61,7 +61,7 @@ template class empirical_type { public: // Ctor. Contents is invalid when constructed. - empirical_type() : valid(false) {} + empirical_type() {} // Return true and copy contents to out if valid, else return false. bool get(type_t &out) const { @@ -99,7 +99,7 @@ } protected: - bool valid; + bool valid = false; type_t data; }; @@ -4087,9 +4087,7 @@ class CommandOptions : public Options { public: - CommandOptions() - : Options(), - m_kernel_types(RSReduceBreakpointResolver::eKernelTypeAll) {} + CommandOptions() : Options() {} ~CommandOptions() override = default; @@ -4175,7 +4173,7 @@ return true; } - int m_kernel_types; + int m_kernel_types = RSReduceBreakpointResolver::eKernelTypeAll; llvm::StringRef m_reduce_name; RSCoordinate m_coord; bool m_have_coord; @@ -4653,7 +4651,7 @@ class CommandOptions : public Options { public: - CommandOptions() : Options(), m_id(0) {} + CommandOptions() : Options() {} ~CommandOptions() override = default; @@ -4681,7 +4679,7 @@ return llvm::makeArrayRef(g_renderscript_runtime_alloc_list_options); } - uint32_t m_id; + uint32_t m_id = 0; }; bool DoExecute(Args &command, CommandReturnObject &result) override { diff --git a/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h b/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h --- a/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h +++ b/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h @@ -84,25 +84,25 @@ lldb_private::ConstString ar_name; /// Object modification time in the archive. - uint32_t modification_time; + uint32_t modification_time = 0; /// Object user id in the archive. - uint16_t uid; + uint16_t uid = 0; /// Object group id in the archive. - uint16_t gid; + uint16_t gid = 0; /// Object octal file permissions in the archive. - uint16_t mode; + uint16_t mode = 0; /// Object size in bytes in the archive. - uint32_t size; + uint32_t size = 0; /// File offset in bytes from the beginning of the file of the object data. - lldb::offset_t file_offset; + lldb::offset_t file_offset = 0; /// Length of the object data. - lldb::offset_t file_size; + lldb::offset_t file_size = 0; }; class Archive { diff --git a/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp b/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp --- a/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp +++ b/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp @@ -42,9 +42,7 @@ LLDB_PLUGIN_DEFINE(ObjectContainerBSDArchive) -ObjectContainerBSDArchive::Object::Object() - : ar_name(), modification_time(0), uid(0), gid(0), mode(0), size(0), - file_offset(0), file_size(0) {} +ObjectContainerBSDArchive::Object::Object() : ar_name() {} void ObjectContainerBSDArchive::Object::Clear() { ar_name.Clear(); diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h --- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h +++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h @@ -22,13 +22,13 @@ #include "ELFHeader.h" struct ELFNote { - elf::elf_word n_namesz; - elf::elf_word n_descsz; - elf::elf_word n_type; + elf::elf_word n_namesz = 0; + elf::elf_word n_descsz = 0; + elf::elf_word n_type = 0; std::string n_name; - ELFNote() : n_namesz(0), n_descsz(0), n_type(0) {} + ELFNote() {} /// Parse an ELFNote entry from the given DataExtractor starting at position /// \p offset. diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.h b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.h --- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.h +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.h @@ -64,8 +64,8 @@ std::string m_device_support_directory; std::string m_device_support_directory_for_os_version; std::string m_build_update; - uint32_t m_last_module_sdk_idx; - uint32_t m_connected_module_sdk_idx; + uint32_t m_last_module_sdk_idx = UINT32_MAX; + uint32_t m_connected_module_sdk_idx = UINT32_MAX; bool UpdateSDKDirectoryInfosIfNeeded(); diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp --- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp @@ -39,9 +39,7 @@ PlatformRemoteDarwinDevice::PlatformRemoteDarwinDevice() : PlatformDarwin(false), // This is a remote platform m_sdk_directory_infos(), m_device_support_directory(), - m_device_support_directory_for_os_version(), m_build_update(), - m_last_module_sdk_idx(UINT32_MAX), - m_connected_module_sdk_idx(UINT32_MAX) {} + m_device_support_directory_for_os_version(), m_build_update() {} /// Destructor. /// diff --git a/lldb/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.h b/lldb/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.h --- a/lldb/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.h +++ b/lldb/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.h @@ -93,7 +93,7 @@ ProductFamilyID GetProductFamilyID(); private: - id m_dev; + id m_dev = nullptr; llvm::Optional m_model_identifier; }; @@ -129,7 +129,7 @@ bool IsAvailable(); private: - id m_dev; + id m_dev = nullptr; llvm::Optional m_os_version; }; @@ -169,7 +169,7 @@ Process Spawn(lldb_private::ProcessLaunchInfo &launch_info); private: - id m_dev; + id m_dev = nullptr; llvm::Optional m_dev_type; llvm::Optional m_dev_runtime; diff --git a/lldb/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.mm b/lldb/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.mm --- a/lldb/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.mm +++ b/lldb/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.mm @@ -66,8 +66,7 @@ CoreSimulatorSupport::Process::Process(lldb::pid_t p, Status error) : m_pid(p), m_error(error) {} -CoreSimulatorSupport::DeviceType::DeviceType() - : m_dev(nil), m_model_identifier() {} +CoreSimulatorSupport::DeviceType::DeviceType() : m_model_identifier() {} CoreSimulatorSupport::DeviceType::DeviceType(id d) : m_dev(d), m_model_identifier() {} @@ -87,8 +86,7 @@ return ProductFamilyID([m_dev productFamilyID]); } -CoreSimulatorSupport::DeviceRuntime::DeviceRuntime() - : m_dev(nil), m_os_version() {} +CoreSimulatorSupport::DeviceRuntime::DeviceRuntime() : m_os_version() {} CoreSimulatorSupport::DeviceRuntime::DeviceRuntime(id d) : m_dev(d), m_os_version() {} @@ -99,8 +97,7 @@ return [m_dev available]; } -CoreSimulatorSupport::Device::Device() - : m_dev(nil), m_dev_type(), m_dev_runtime() {} +CoreSimulatorSupport::Device::Device() : m_dev_type(), m_dev_runtime() {} CoreSimulatorSupport::Device::Device(id d) : m_dev(d), m_dev_type(), m_dev_runtime() {} diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h @@ -522,42 +522,42 @@ SendTraceGetBinaryData(const TraceGetBinaryDataRequest &request); protected: - LazyBool m_supports_not_sending_acks; - LazyBool m_supports_thread_suffix; - LazyBool m_supports_threads_in_stop_reply; - LazyBool m_supports_vCont_all; - LazyBool m_supports_vCont_any; - LazyBool m_supports_vCont_c; - LazyBool m_supports_vCont_C; - LazyBool m_supports_vCont_s; - LazyBool m_supports_vCont_S; - LazyBool m_qHostInfo_is_valid; - LazyBool m_curr_pid_is_valid; - LazyBool m_qProcessInfo_is_valid; - LazyBool m_qGDBServerVersion_is_valid; - LazyBool m_supports_alloc_dealloc_memory; - LazyBool m_supports_memory_region_info; - LazyBool m_supports_watchpoint_support_info; - LazyBool m_supports_detach_stay_stopped; - LazyBool m_watchpoints_trigger_after_instruction; - LazyBool m_attach_or_wait_reply; - LazyBool m_prepare_for_reg_writing_reply; - LazyBool m_supports_p; - LazyBool m_supports_x; - LazyBool m_avoid_g_packets; - LazyBool m_supports_QSaveRegisterState; - LazyBool m_supports_qXfer_auxv_read; - LazyBool m_supports_qXfer_libraries_read; - LazyBool m_supports_qXfer_libraries_svr4_read; - LazyBool m_supports_qXfer_features_read; - LazyBool m_supports_qXfer_memory_map_read; - LazyBool m_supports_augmented_libraries_svr4_read; - LazyBool m_supports_jThreadExtendedInfo; - LazyBool m_supports_jLoadedDynamicLibrariesInfos; - LazyBool m_supports_jGetSharedCacheInfo; - LazyBool m_supports_QPassSignals; - LazyBool m_supports_error_string_reply; - LazyBool m_supports_multiprocess; + LazyBool m_supports_not_sending_acks = eLazyBoolCalculate; + LazyBool m_supports_thread_suffix = eLazyBoolCalculate; + LazyBool m_supports_threads_in_stop_reply = eLazyBoolCalculate; + LazyBool m_supports_vCont_all = eLazyBoolCalculate; + LazyBool m_supports_vCont_any = eLazyBoolCalculate; + LazyBool m_supports_vCont_c = eLazyBoolCalculate; + LazyBool m_supports_vCont_C = eLazyBoolCalculate; + LazyBool m_supports_vCont_s = eLazyBoolCalculate; + LazyBool m_supports_vCont_S = eLazyBoolCalculate; + LazyBool m_qHostInfo_is_valid = eLazyBoolCalculate; + LazyBool m_curr_pid_is_valid = eLazyBoolCalculate; + LazyBool m_qProcessInfo_is_valid = eLazyBoolCalculate; + LazyBool m_qGDBServerVersion_is_valid = eLazyBoolCalculate; + LazyBool m_supports_alloc_dealloc_memory = eLazyBoolCalculate; + LazyBool m_supports_memory_region_info = eLazyBoolCalculate; + LazyBool m_supports_watchpoint_support_info = eLazyBoolCalculate; + LazyBool m_supports_detach_stay_stopped = eLazyBoolCalculate; + LazyBool m_watchpoints_trigger_after_instruction = eLazyBoolCalculate; + LazyBool m_attach_or_wait_reply = eLazyBoolCalculate; + LazyBool m_prepare_for_reg_writing_reply = eLazyBoolCalculate; + LazyBool m_supports_p = eLazyBoolCalculate; + LazyBool m_supports_x = eLazyBoolCalculate; + LazyBool m_avoid_g_packets = eLazyBoolCalculate; + LazyBool m_supports_QSaveRegisterState = eLazyBoolCalculate; + LazyBool m_supports_qXfer_auxv_read = eLazyBoolCalculate; + LazyBool m_supports_qXfer_libraries_read = eLazyBoolCalculate; + LazyBool m_supports_qXfer_libraries_svr4_read = eLazyBoolCalculate; + LazyBool m_supports_qXfer_features_read = eLazyBoolCalculate; + LazyBool m_supports_qXfer_memory_map_read = eLazyBoolCalculate; + LazyBool m_supports_augmented_libraries_svr4_read = eLazyBoolCalculate; + LazyBool m_supports_jThreadExtendedInfo = eLazyBoolCalculate; + LazyBool m_supports_jLoadedDynamicLibrariesInfos = eLazyBoolCalculate; + LazyBool m_supports_jGetSharedCacheInfo = eLazyBoolCalculate; + LazyBool m_supports_QPassSignals = eLazyBoolCalculate; + LazyBool m_supports_error_string_reply = eLazyBoolCalculate; + LazyBool m_supports_multiprocess = eLazyBoolCalculate; bool m_supports_qProcessInfoPID : 1, m_supports_qfProcessInfo : 1, m_supports_qUserName : 1, m_supports_qGroupName : 1, @@ -568,14 +568,16 @@ m_supports_qModuleInfo : 1, m_supports_jThreadsInfo : 1, m_supports_jModulesInfo : 1; - lldb::pid_t m_curr_pid; - lldb::tid_t m_curr_tid; // Current gdb remote protocol thread index for all - // other operations - lldb::tid_t m_curr_tid_run; // Current gdb remote protocol thread index for + lldb::pid_t m_curr_pid = LLDB_INVALID_PROCESS_ID; + lldb::tid_t m_curr_tid = + LLDB_INVALID_THREAD_ID; // Current gdb remote protocol thread index for + // all other operations + lldb::tid_t m_curr_tid_run = + LLDB_INVALID_THREAD_ID; // Current gdb remote protocol thread index for // continue, step, etc - uint32_t m_num_supported_hardware_watchpoints; - uint32_t m_addressing_bits; + uint32_t m_num_supported_hardware_watchpoints = 0; + uint32_t m_addressing_bits = 0; ArchSpec m_host_arch; ArchSpec m_process_arch; @@ -586,17 +588,18 @@ std::string m_hostname; std::string m_gdb_server_name; // from reply to qGDBServerVersion, empty if // qGDBServerVersion is not supported - uint32_t m_gdb_server_version; // from reply to qGDBServerVersion, zero if - // qGDBServerVersion is not supported + uint32_t m_gdb_server_version = + UINT32_MAX; // from reply to qGDBServerVersion, zero if + // qGDBServerVersion is not supported std::chrono::seconds m_default_packet_timeout; - uint64_t m_max_packet_size; // as returned by qSupported + uint64_t m_max_packet_size = 0; // as returned by qSupported std::string m_qSupported_response; // the complete response to qSupported - bool m_supported_async_json_packets_is_valid; + bool m_supported_async_json_packets_is_valid = false; lldb_private::StructuredData::ObjectSP m_supported_async_json_packets_sp; std::vector m_qXfer_memory_map; - bool m_qXfer_memory_map_loaded; + bool m_qXfer_memory_map_loaded = false; bool GetCurrentProcessInfo(bool allow_lazy_pid = true); diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp @@ -55,41 +55,7 @@ // GDBRemoteCommunicationClient constructor GDBRemoteCommunicationClient::GDBRemoteCommunicationClient() : GDBRemoteClientBase("gdb-remote.client", "gdb-remote.client.rx_packet"), - m_supports_not_sending_acks(eLazyBoolCalculate), - m_supports_thread_suffix(eLazyBoolCalculate), - m_supports_threads_in_stop_reply(eLazyBoolCalculate), - m_supports_vCont_all(eLazyBoolCalculate), - m_supports_vCont_any(eLazyBoolCalculate), - m_supports_vCont_c(eLazyBoolCalculate), - m_supports_vCont_C(eLazyBoolCalculate), - m_supports_vCont_s(eLazyBoolCalculate), - m_supports_vCont_S(eLazyBoolCalculate), - m_qHostInfo_is_valid(eLazyBoolCalculate), - m_curr_pid_is_valid(eLazyBoolCalculate), - m_qProcessInfo_is_valid(eLazyBoolCalculate), - m_qGDBServerVersion_is_valid(eLazyBoolCalculate), - m_supports_alloc_dealloc_memory(eLazyBoolCalculate), - m_supports_memory_region_info(eLazyBoolCalculate), - m_supports_watchpoint_support_info(eLazyBoolCalculate), - m_supports_detach_stay_stopped(eLazyBoolCalculate), - m_watchpoints_trigger_after_instruction(eLazyBoolCalculate), - m_attach_or_wait_reply(eLazyBoolCalculate), - m_prepare_for_reg_writing_reply(eLazyBoolCalculate), - m_supports_p(eLazyBoolCalculate), m_supports_x(eLazyBoolCalculate), - m_avoid_g_packets(eLazyBoolCalculate), - m_supports_QSaveRegisterState(eLazyBoolCalculate), - m_supports_qXfer_auxv_read(eLazyBoolCalculate), - m_supports_qXfer_libraries_read(eLazyBoolCalculate), - m_supports_qXfer_libraries_svr4_read(eLazyBoolCalculate), - m_supports_qXfer_features_read(eLazyBoolCalculate), - m_supports_qXfer_memory_map_read(eLazyBoolCalculate), - m_supports_augmented_libraries_svr4_read(eLazyBoolCalculate), - m_supports_jThreadExtendedInfo(eLazyBoolCalculate), - m_supports_jLoadedDynamicLibrariesInfos(eLazyBoolCalculate), - m_supports_jGetSharedCacheInfo(eLazyBoolCalculate), - m_supports_QPassSignals(eLazyBoolCalculate), - m_supports_error_string_reply(eLazyBoolCalculate), - m_supports_multiprocess(eLazyBoolCalculate), + m_supports_qProcessInfoPID(true), m_supports_qfProcessInfo(true), m_supports_qUserName(true), m_supports_qGroupName(true), m_supports_qThreadStopInfo(true), m_supports_z0(true), @@ -98,15 +64,11 @@ m_supports_QEnvironmentHexEncoded(true), m_supports_qSymbol(true), m_qSymbol_requests_done(false), m_supports_qModuleInfo(true), m_supports_jThreadsInfo(true), m_supports_jModulesInfo(true), - m_curr_pid(LLDB_INVALID_PROCESS_ID), m_curr_tid(LLDB_INVALID_THREAD_ID), - m_curr_tid_run(LLDB_INVALID_THREAD_ID), - m_num_supported_hardware_watchpoints(0), m_addressing_bits(0), + m_host_arch(), m_process_arch(), m_os_build(), m_os_kernel(), - m_hostname(), m_gdb_server_name(), m_gdb_server_version(UINT32_MAX), - m_default_packet_timeout(0), m_max_packet_size(0), - m_qSupported_response(), m_supported_async_json_packets_is_valid(false), - m_supported_async_json_packets_sp(), m_qXfer_memory_map(), - m_qXfer_memory_map_loaded(false) {} + m_hostname(), m_gdb_server_name(), m_default_packet_timeout(0), + m_qSupported_response(), m_supported_async_json_packets_sp(), + m_qXfer_memory_map() {} // Destructor GDBRemoteCommunicationClient::~GDBRemoteCommunicationClient() { diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationHistory.h b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationHistory.h --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationHistory.h +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationHistory.h @@ -74,9 +74,9 @@ } std::vector m_packets; - uint32_t m_curr_idx; - uint32_t m_total_packet_count; - mutable bool m_dumped_to_log; + uint32_t m_curr_idx = 0; + uint32_t m_total_packet_count = 0; + mutable bool m_dumped_to_log = false; repro::PacketRecorder *m_recorder = nullptr; }; diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationHistory.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationHistory.cpp --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationHistory.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationHistory.cpp @@ -19,8 +19,7 @@ using namespace lldb_private::process_gdb_remote; GDBRemoteCommunicationHistory::GDBRemoteCommunicationHistory(uint32_t size) - : m_packets(), m_curr_idx(0), m_total_packet_count(0), - m_dumped_to_log(false) { + : m_packets() { if (size) m_packets.resize(size); } diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationReplayServer.h b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationReplayServer.h --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationReplayServer.h +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationReplayServer.h @@ -73,7 +73,7 @@ HostThread m_async_thread; std::recursive_mutex m_async_thread_state_mutex; - bool m_skip_acks; + bool m_skip_acks = false; private: GDBRemoteCommunicationReplayServer( diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationReplayServer.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationReplayServer.cpp --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationReplayServer.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationReplayServer.cpp @@ -74,7 +74,7 @@ m_async_broadcaster(nullptr, "lldb.gdb-replay.async-broadcaster"), m_async_listener_sp( Listener::MakeListener("lldb.gdb-replay.async-listener")), - m_async_thread_state_mutex(), m_skip_acks(false) { + m_async_thread_state_mutex() { m_async_broadcaster.SetEventName(eBroadcastBitAsyncContinue, "async thread continue"); m_async_broadcaster.SetEventName(eBroadcastBitAsyncThreadShouldExit, diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h --- a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h +++ b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h @@ -229,7 +229,7 @@ class PythonObject { public: - PythonObject() : m_py_obj(nullptr) {} + PythonObject() {} PythonObject(PyRefType type, PyObject *py_obj) { m_py_obj = py_obj; @@ -378,7 +378,7 @@ } protected: - PyObject *m_py_obj; + PyObject *m_py_obj = nullptr; }; diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp --- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp @@ -236,8 +236,7 @@ // save off initial state at the beginning, and restore it at the end struct InitializePythonRAII { public: - InitializePythonRAII() - : m_gil_state(PyGILState_UNLOCKED), m_was_already_initialized(false) { + InitializePythonRAII() { InitializePythonHome(); #ifdef LLDB_USE_LIBEDIT_READLINE_COMPAT_MODULE @@ -357,8 +356,8 @@ } TerminalState m_stdin_tty_state; - PyGILState_STATE m_gil_state; - bool m_was_already_initialized; + PyGILState_STATE m_gil_state = PyGILState_UNLOCKED; + bool m_was_already_initialized = false; }; } // namespace diff --git a/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp b/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp --- a/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp +++ b/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp @@ -473,13 +473,9 @@ class EnableOptions : public Options { public: EnableOptions() - : Options(), m_include_debug_level(false), m_include_info_level(false), - m_include_any_process(false), + : Options(), m_filter_fall_through_accepts(DEFAULT_FILTER_FALLTHROUGH_ACCEPTS), - m_echo_to_stderr(false), m_display_timestamp_relative(false), - m_display_subsystem(false), m_display_category(false), - m_display_activity_chain(false), m_broadcast_events(true), - m_live_stream(true), m_filter_rules() {} + m_filter_rules() {} void OptionParsingStarting(ExecutionContext *execution_context) override { m_include_debug_level = false; @@ -728,17 +724,17 @@ return -1; } - bool m_include_debug_level; - bool m_include_info_level; - bool m_include_any_process; + bool m_include_debug_level = false; + bool m_include_info_level = false; + bool m_include_any_process = false; bool m_filter_fall_through_accepts; - bool m_echo_to_stderr; - bool m_display_timestamp_relative; - bool m_display_subsystem; - bool m_display_category; - bool m_display_activity_chain; - bool m_broadcast_events; - bool m_live_stream; + bool m_echo_to_stderr = false; + bool m_display_timestamp_relative = false; + bool m_display_subsystem = false; + bool m_display_category = false; + bool m_display_activity_chain = false; + bool m_broadcast_events = true; + bool m_live_stream = true; FilterRules m_filter_rules; }; diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.h --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.h @@ -55,9 +55,9 @@ bool IsValid(); protected: - dw_uleb128_t m_code; - dw_tag_t m_tag; - uint8_t m_has_children; + dw_uleb128_t m_code = InvalidCode; + dw_tag_t m_tag = llvm::dwarf::DW_TAG_null; + uint8_t m_has_children = 0; DWARFAttribute::collection m_attributes; }; 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 @@ -17,9 +17,7 @@ using namespace lldb_private; -DWARFAbbreviationDeclaration::DWARFAbbreviationDeclaration() - : m_code(InvalidCode), m_tag(llvm::dwarf::DW_TAG_null), m_has_children(0), - m_attributes() {} +DWARFAbbreviationDeclaration::DWARFAbbreviationDeclaration() : m_attributes() {} DWARFAbbreviationDeclaration::DWARFAbbreviationDeclaration(dw_tag_t tag, uint8_t has_children) diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.h --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.h @@ -24,7 +24,7 @@ class DWARFBaseDIE { public: - DWARFBaseDIE() : m_cu(nullptr), m_die(nullptr) {} + DWARFBaseDIE() {} DWARFBaseDIE(DWARFUnit *cu, DWARFDebugInfoEntry *die) : m_cu(cu), m_die(die) {} @@ -115,8 +115,8 @@ Recurse recurse = Recurse::yes) const; protected: - DWARFUnit *m_cu; - DWARFDebugInfoEntry *m_die; + DWARFUnit *m_cu = nullptr; + DWARFDebugInfoEntry *m_die = nullptr; }; bool operator==(const DWARFBaseDIE &lhs, const DWARFBaseDIE &rhs); diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.h --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.h @@ -26,8 +26,7 @@ class DWARFAbbreviationDeclarationSet { public: - DWARFAbbreviationDeclarationSet() - : m_offset(DW_INVALID_OFFSET), m_idx_offset(0), m_decls() {} + DWARFAbbreviationDeclarationSet() : m_offset(DW_INVALID_OFFSET), m_decls() {} DWARFAbbreviationDeclarationSet(dw_offset_t offset, uint32_t idx_offset) : m_offset(offset), m_idx_offset(idx_offset), m_decls() {} @@ -51,7 +50,7 @@ /// @} private: dw_offset_t m_offset; - uint32_t m_idx_offset; + uint32_t m_idx_offset = 0; std::vector m_decls; }; diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h @@ -35,8 +35,7 @@ typedef collection::const_iterator const_iterator; DWARFDebugInfoEntry() - : m_offset(DW_INVALID_OFFSET), m_parent_idx(0), m_sibling_idx(0), - m_has_children(false), m_abbr_idx(0), m_tag(llvm::dwarf::DW_TAG_null) {} + : m_offset(DW_INVALID_OFFSET), m_sibling_idx(0), m_has_children(false) {} explicit operator bool() const { return m_offset != DW_INVALID_OFFSET; } bool operator==(const DWARFDebugInfoEntry &rhs) const; @@ -167,14 +166,14 @@ GetDWARFDeclContextStatic(const DWARFDebugInfoEntry *die, DWARFUnit *cu); dw_offset_t m_offset; // Offset within the .debug_info/.debug_types - uint32_t m_parent_idx; // How many to subtract from "this" to get the parent. - // If zero this die has no parent + uint32_t m_parent_idx = 0; // How many to subtract from "this" to get the + // parent. If zero this die has no parent uint32_t m_sibling_idx : 31, // How many to add to "this" to get the sibling. // If it is zero, then the DIE doesn't have children, or the // DWARF claimed it had children but the DIE only contained // a single NULL terminating child. m_has_children : 1; - uint16_t m_abbr_idx; + uint16_t m_abbr_idx = 0; /// A copy of the DW_TAG value so we don't have to go through the compile /// unit abbrev table dw_tag_t m_tag = llvm::dwarf::DW_TAG_null; diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.h --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.h @@ -23,7 +23,7 @@ class DWARFDeclContext { public: struct Entry { - Entry() : tag(llvm::dwarf::DW_TAG_null), name(nullptr) {} + Entry() {} Entry(dw_tag_t t, const char *n) : tag(t), name(n) {} bool NameMatches(const Entry &rhs) const { @@ -37,11 +37,11 @@ // Test operator explicit operator bool() const { return tag != 0; } - dw_tag_t tag; - const char *name; + dw_tag_t tag = llvm::dwarf::DW_TAG_null; + const char *name = nullptr; }; - DWARFDeclContext() : m_entries(), m_language(lldb::eLanguageTypeUnknown) {} + DWARFDeclContext() : m_entries() {} void AppendDeclContext(dw_tag_t tag, const char *name) { m_entries.push_back(Entry(tag, name)); @@ -83,7 +83,7 @@ typedef std::vector collection; collection m_entries; mutable std::string m_qualified_name; - lldb::LanguageType m_language; + lldb::LanguageType m_language = lldb::eLanguageTypeUnknown; }; #endif // LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFDECLCONTEXT_H diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h @@ -20,14 +20,14 @@ class DWARFFormValue { public: typedef struct ValueTypeTag { - ValueTypeTag() : value(), data(nullptr) { value.uval = 0; } + ValueTypeTag() : value() { value.uval = 0; } union { uint64_t uval; int64_t sval; const char *cstr; } value; - const uint8_t *data; + const uint8_t *data = nullptr; } ValueType; enum { diff --git a/lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h b/lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h --- a/lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h @@ -101,9 +101,9 @@ /// DIE offset base so die offsets in hash_data can be CU relative. dw_offset_t die_base_offset; AtomArray atoms; - uint32_t atom_mask; - size_t min_hash_data_byte_size; - bool hash_data_has_fixed_byte_size; + uint32_t atom_mask = 0; + size_t min_hash_data_byte_size = 0; + bool hash_data_has_fixed_byte_size = true; }; class Header : public MappedHash::Header { diff --git a/lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp b/lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp --- a/lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp @@ -130,8 +130,7 @@ : die_offset(o), tag(t), type_flags(f), qualified_name_hash(h) {} DWARFMappedHash::Prologue::Prologue(dw_offset_t _die_base_offset) - : die_base_offset(_die_base_offset), atoms(), atom_mask(0), - min_hash_data_byte_size(0), hash_data_has_fixed_byte_size(true) { + : die_base_offset(_die_base_offset), atoms() { // Define an array of DIE offsets by first defining an array, and then define // the atom type for the array, in this case we have an array of DIE offsets. AppendAtom(eAtomTypeDIEOffset, DW_FORM_data4); diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h @@ -170,18 +170,17 @@ llvm::sys::TimePoint<> oso_mod_time; OSOInfoSP oso_sp; lldb::CompUnitSP compile_unit_sp; - uint32_t first_symbol_index; - uint32_t last_symbol_index; - uint32_t first_symbol_id; - uint32_t last_symbol_id; + uint32_t first_symbol_index = UINT32_MAX; + uint32_t last_symbol_index = UINT32_MAX; + uint32_t first_symbol_id = UINT32_MAX; + uint32_t last_symbol_id = UINT32_MAX; FileRangeMap file_range_map; - bool file_range_map_valid; + bool file_range_map_valid = false; CompileUnitInfo() : so_file(), oso_path(), oso_mod_time(), oso_sp(), compile_unit_sp(), - first_symbol_index(UINT32_MAX), last_symbol_index(UINT32_MAX), - first_symbol_id(UINT32_MAX), last_symbol_id(UINT32_MAX), - file_range_map(), file_range_map_valid(false) {} + + file_range_map() {} const FileRangeMap &GetFileRangeMap(SymbolFileDWARFDebugMap *exe_symfile); }; @@ -279,8 +278,7 @@ // OSOEntry class OSOEntry { public: - OSOEntry() - : m_exe_sym_idx(UINT32_MAX), m_oso_file_addr(LLDB_INVALID_ADDRESS) {} + OSOEntry() {} OSOEntry(uint32_t exe_sym_idx, lldb::addr_t oso_file_addr) : m_exe_sym_idx(exe_sym_idx), m_oso_file_addr(oso_file_addr) {} @@ -298,8 +296,8 @@ } protected: - uint32_t m_exe_sym_idx; - lldb::addr_t m_oso_file_addr; + uint32_t m_exe_sym_idx = UINT32_MAX; + lldb::addr_t m_oso_file_addr = LLDB_INVALID_ADDRESS; }; typedef lldb_private::RangeDataVector diff --git a/lldb/source/Plugins/SymbolFile/DWARF/UniqueDWARFASTType.h b/lldb/source/Plugins/SymbolFile/DWARF/UniqueDWARFASTType.h --- a/lldb/source/Plugins/SymbolFile/DWARF/UniqueDWARFASTType.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/UniqueDWARFASTType.h @@ -19,11 +19,7 @@ class UniqueDWARFASTType { public: // Constructors and Destructors - UniqueDWARFASTType() - : m_type_sp(), m_die(), m_declaration(), - m_byte_size( - -1) // Set to negative value to make sure we have a valid value - {} + UniqueDWARFASTType() : m_type_sp(), m_die(), m_declaration() {} UniqueDWARFASTType(lldb::TypeSP &type_sp, const DWARFDIE &die, const lldb_private::Declaration &decl, int32_t byte_size) @@ -49,7 +45,7 @@ lldb::TypeSP m_type_sp; DWARFDIE m_die; lldb_private::Declaration m_declaration; - int32_t m_byte_size; + int32_t m_byte_size = -1; }; class UniqueDWARFASTTypeList { diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.h b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.h --- a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.h +++ b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.h @@ -46,13 +46,12 @@ ~AppleGetItemInfoHandler(); struct GetItemInfoReturnInfo { - lldb::addr_t item_buffer_ptr; /* the address of the item buffer from - libBacktraceRecording */ - lldb::addr_t item_buffer_size; /* the size of the item buffer from + lldb::addr_t item_buffer_ptr = LLDB_INVALID_ADDRESS; /* the address of the + item buffer from libBacktraceRecording */ + lldb::addr_t item_buffer_size = 0; /* the size of the item buffer from libBacktraceRecording */ - GetItemInfoReturnInfo() - : item_buffer_ptr(LLDB_INVALID_ADDRESS), item_buffer_size(0) {} + GetItemInfoReturnInfo() {} }; /// Get the information about a work item by calling diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.h b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.h --- a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.h +++ b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.h @@ -48,16 +48,16 @@ ~AppleGetPendingItemsHandler(); struct GetPendingItemsReturnInfo { - lldb::addr_t items_buffer_ptr; /* the address of the pending items buffer - from libBacktraceRecording */ - lldb::addr_t - items_buffer_size; /* the size of the pending items buffer from - libBacktraceRecording */ - uint64_t count; /* the number of pending items included in the buffer */ + lldb::addr_t items_buffer_ptr = + LLDB_INVALID_ADDRESS; /* the address of the pending items buffer + from libBacktraceRecording */ + lldb::addr_t items_buffer_size = 0; /* the size of the pending items buffer + from libBacktraceRecording */ + uint64_t count = 0; /* the number of pending items included in the buffer */ GetPendingItemsReturnInfo() - : items_buffer_ptr(LLDB_INVALID_ADDRESS), items_buffer_size(0), - count(0) {} + + {} }; /// Get the list of pending items for a given queue via a call to diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.h b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.h --- a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.h +++ b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.h @@ -45,15 +45,16 @@ ~AppleGetQueuesHandler(); struct GetQueuesReturnInfo { - lldb::addr_t queues_buffer_ptr; /* the address of the queues buffer from + lldb::addr_t queues_buffer_ptr = + LLDB_INVALID_ADDRESS; /* the address of the queues buffer from + libBacktraceRecording */ + lldb::addr_t queues_buffer_size = 0; /* the size of the queues buffer from libBacktraceRecording */ - lldb::addr_t queues_buffer_size; /* the size of the queues buffer from - libBacktraceRecording */ - uint64_t count; /* the number of queues included in the queues buffer */ + uint64_t count = 0; /* the number of queues included in the queues buffer */ GetQueuesReturnInfo() - : queues_buffer_ptr(LLDB_INVALID_ADDRESS), queues_buffer_size(0), - count(0) {} + + {} }; /// Get the list of queues that exist (with any active or pending items) via diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.h b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.h --- a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.h +++ b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.h @@ -47,13 +47,12 @@ ~AppleGetThreadItemInfoHandler(); struct GetThreadItemInfoReturnInfo { - lldb::addr_t item_buffer_ptr; /* the address of the item buffer from - libBacktraceRecording */ - lldb::addr_t item_buffer_size; /* the size of the item buffer from + lldb::addr_t item_buffer_ptr = LLDB_INVALID_ADDRESS; /* the address of the + item buffer from libBacktraceRecording */ + lldb::addr_t item_buffer_size = 0; /* the size of the item buffer from libBacktraceRecording */ - GetThreadItemInfoReturnInfo() - : item_buffer_ptr(LLDB_INVALID_ADDRESS), item_buffer_size(0) {} + GetThreadItemInfoReturnInfo() {} }; /// Get the information about a work item by calling diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.h b/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.h --- a/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.h +++ b/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.h @@ -108,14 +108,12 @@ private: struct libBacktraceRecording_info { - uint16_t queue_info_version; - uint16_t queue_info_data_offset; - uint16_t item_info_version; - uint16_t item_info_data_offset; - - libBacktraceRecording_info() - : queue_info_version(0), queue_info_data_offset(0), - item_info_version(0), item_info_data_offset(0) {} + uint16_t queue_info_version = 0; + uint16_t queue_info_data_offset = 0; + uint16_t item_info_version = 0; + uint16_t item_info_data_offset = 0; + + libBacktraceRecording_info() {} }; // A structure which reflects the data recorded in the @@ -186,44 +184,39 @@ }; struct LibdispatchVoucherOffsets { - uint16_t vo_version; - uint16_t vo_activity_ids_count; - uint16_t vo_activity_ids_count_size; - uint16_t vo_activity_ids_array; - uint16_t vo_activity_ids_array_entry_size; + uint16_t vo_version = UINT16_MAX; + uint16_t vo_activity_ids_count = UINT16_MAX; + uint16_t vo_activity_ids_count_size = UINT16_MAX; + uint16_t vo_activity_ids_array = UINT16_MAX; + uint16_t vo_activity_ids_array_entry_size = UINT16_MAX; LibdispatchVoucherOffsets() - : vo_version(UINT16_MAX), vo_activity_ids_count(UINT16_MAX), - vo_activity_ids_count_size(UINT16_MAX), - vo_activity_ids_array(UINT16_MAX), - vo_activity_ids_array_entry_size(UINT16_MAX) {} + + {} bool IsValid() { return vo_version != UINT16_MAX; } }; struct LibdispatchTSDIndexes { - uint16_t dti_version; - uint64_t dti_queue_index; - uint64_t dti_voucher_index; - uint64_t dti_qos_class_index; + uint16_t dti_version = UINT16_MAX; + uint64_t dti_queue_index = UINT64_MAX; + uint64_t dti_voucher_index = UINT64_MAX; + uint64_t dti_qos_class_index = UINT64_MAX; - LibdispatchTSDIndexes() - : dti_version(UINT16_MAX), dti_queue_index(UINT64_MAX), - dti_voucher_index(UINT64_MAX), dti_qos_class_index(UINT64_MAX) {} + LibdispatchTSDIndexes() {} bool IsValid() { return dti_version != UINT16_MAX; } }; struct LibpthreadOffsets { - uint16_t plo_version; - uint16_t plo_pthread_tsd_base_offset; - uint16_t plo_pthread_tsd_base_address_offset; - uint16_t plo_pthread_tsd_entry_size; + uint16_t plo_version = UINT16_MAX; + uint16_t plo_pthread_tsd_base_offset = UINT16_MAX; + uint16_t plo_pthread_tsd_base_address_offset = UINT16_MAX; + uint16_t plo_pthread_tsd_entry_size = UINT16_MAX; LibpthreadOffsets() - : plo_version(UINT16_MAX), plo_pthread_tsd_base_offset(UINT16_MAX), - plo_pthread_tsd_base_address_offset(UINT16_MAX), - plo_pthread_tsd_entry_size(UINT16_MAX) {} + + {} bool IsValid() { return plo_version != UINT16_MAX; } }; diff --git a/lldb/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.h b/lldb/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.h --- a/lldb/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.h +++ b/lldb/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.h @@ -45,9 +45,9 @@ /// are called. This one takes a vector of register name and lldb /// register numbers. struct lldb_reg_info { - const char *name; - uint32_t lldb_regnum; - lldb_reg_info() : name(nullptr), lldb_regnum(LLDB_INVALID_REGNUM) {} + const char *name = nullptr; + uint32_t lldb_regnum = LLDB_INVALID_REGNUM; + lldb_reg_info() {} }; void Initialize(std::vector ®_info); diff --git a/lldb/source/Symbol/LineEntry.cpp b/lldb/source/Symbol/LineEntry.cpp --- a/lldb/source/Symbol/LineEntry.cpp +++ b/lldb/source/Symbol/LineEntry.cpp @@ -14,9 +14,8 @@ using namespace lldb_private; LineEntry::LineEntry() - : range(), file(), line(LLDB_INVALID_LINE_NUMBER), column(0), - is_start_of_statement(0), is_start_of_basic_block(0), is_prologue_end(0), - is_epilogue_begin(0), is_terminal_entry(0) {} + : range(), file(), is_start_of_statement(0), is_start_of_basic_block(0), + is_prologue_end(0), is_epilogue_begin(0), is_terminal_entry(0) {} LineEntry::LineEntry(const lldb::SectionSP §ion_sp, lldb::addr_t section_offset, lldb::addr_t byte_size, 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 @@ -23,13 +23,12 @@ using namespace lldb_private; Symbol::Symbol() - : SymbolContextScope(), m_uid(UINT32_MAX), m_type_data(0), - m_type_data_resolved(false), m_is_synthetic(false), m_is_debug(false), - m_is_external(false), m_size_is_sibling(false), + : SymbolContextScope(), m_type_data_resolved(false), m_is_synthetic(false), + m_is_debug(false), m_is_external(false), m_size_is_sibling(false), m_size_is_synthesized(false), m_size_is_valid(false), m_demangled_is_synthesized(false), m_contains_linker_annotations(false), - m_is_weak(false), m_type(eSymbolTypeInvalid), m_mangled(), m_addr_range(), - m_flags() {} + 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, 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 @@ -26,9 +26,7 @@ using namespace lldb; using namespace lldb_private; -SymbolContext::SymbolContext() - : target_sp(), module_sp(), comp_unit(nullptr), function(nullptr), - block(nullptr), line_entry(), symbol(nullptr), variable(nullptr) {} +SymbolContext::SymbolContext() : target_sp(), module_sp(), line_entry() {} SymbolContext::SymbolContext(const ModuleSP &m, CompileUnit *cu, Function *f, Block *b, LineEntry *le, Symbol *s) 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 @@ -161,10 +161,8 @@ } Type::Type() - : std::enable_shared_from_this(), UserID(0), m_name(""), - m_symbol_file(nullptr), m_context(nullptr), m_encoding_type(nullptr), - m_encoding_uid(LLDB_INVALID_UID), m_encoding_uid_type(eEncodingInvalid), - m_compiler_type_resolve_state(ResolveState::Unresolved) { + : std::enable_shared_from_this(), UserID(0), + m_name("") { m_byte_size = 0; m_byte_size_has_value = false; } diff --git a/lldb/source/Symbol/TypeSystem.cpp b/lldb/source/Symbol/TypeSystem.cpp --- a/lldb/source/Symbol/TypeSystem.cpp +++ b/lldb/source/Symbol/TypeSystem.cpp @@ -178,8 +178,7 @@ #pragma mark TypeSystemMap -TypeSystemMap::TypeSystemMap() - : m_mutex(), m_map(), m_clear_in_progress(false) {} +TypeSystemMap::TypeSystemMap() : m_mutex(), m_map() {} TypeSystemMap::~TypeSystemMap() {} diff --git a/lldb/source/Symbol/UnwindPlan.cpp b/lldb/source/Symbol/UnwindPlan.cpp --- a/lldb/source/Symbol/UnwindPlan.cpp +++ b/lldb/source/Symbol/UnwindPlan.cpp @@ -245,9 +245,7 @@ } } -UnwindPlan::Row::Row() - : m_offset(0), m_cfa_value(), m_afa_value(), m_register_locations(), - m_unspecified_registers_are_undefined(false) {} +UnwindPlan::Row::Row() : m_cfa_value(), m_afa_value(), m_register_locations() {} bool UnwindPlan::Row::GetRegisterInfo( uint32_t reg_num, 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 @@ -395,8 +395,7 @@ } ExecutionContextRef::ExecutionContextRef() - : 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() {} ExecutionContextRef::ExecutionContextRef(const ExecutionContext *exe_ctx) : m_target_wp(), m_process_wp(), m_thread_wp(), 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 @@ -37,8 +37,7 @@ } } // PathMappingList constructor -PathMappingList::PathMappingList() - : m_pairs(), m_callback(nullptr), m_callback_baton(nullptr), m_mod_id(0) {} +PathMappingList::PathMappingList() : m_pairs() {} PathMappingList::PathMappingList(ChangedCallback callback, void *callback_baton) : m_pairs(), m_callback(callback), m_callback_baton(callback_baton), 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 @@ -3843,9 +3843,7 @@ // Process Event Data -Process::ProcessEventData::ProcessEventData() - : EventData(), m_process_wp(), m_state(eStateInvalid), m_restarted(false), - m_update_state(0), m_interrupted(false) {} +Process::ProcessEventData::ProcessEventData() : EventData(), m_process_wp() {} Process::ProcessEventData::ProcessEventData(const ProcessSP &process_sp, StateType state) diff --git a/lldb/source/Target/RegisterNumber.cpp b/lldb/source/Target/RegisterNumber.cpp --- a/lldb/source/Target/RegisterNumber.cpp +++ b/lldb/source/Target/RegisterNumber.cpp @@ -26,9 +26,7 @@ } } -RegisterNumber::RegisterNumber() - : m_reg_ctx_sp(), m_regnum(LLDB_INVALID_REGNUM), - m_kind(lldb::kNumRegisterKinds), m_kind_regnum_map(), m_name(nullptr) {} +RegisterNumber::RegisterNumber() : m_reg_ctx_sp(), m_kind_regnum_map() {} void RegisterNumber::init(lldb_private::Thread &thread, lldb::RegisterKind kind, uint32_t num) { diff --git a/lldb/source/Target/ThreadSpec.cpp b/lldb/source/Target/ThreadSpec.cpp --- a/lldb/source/Target/ThreadSpec.cpp +++ b/lldb/source/Target/ThreadSpec.cpp @@ -17,9 +17,7 @@ ThreadSpec::OptionNames::LastOptionName)]{"Index", "ID", "Name", "QueueName"}; -ThreadSpec::ThreadSpec() - : m_index(UINT32_MAX), m_tid(LLDB_INVALID_THREAD_ID), m_name(), - m_queue_name() {} +ThreadSpec::ThreadSpec() : m_name(), m_queue_name() {} std::unique_ptr ThreadSpec::CreateFromStructuredData( const StructuredData::Dictionary &spec_dict, Status &error) { diff --git a/lldb/source/Utility/DataEncoder.cpp b/lldb/source/Utility/DataEncoder.cpp --- a/lldb/source/Utility/DataEncoder.cpp +++ b/lldb/source/Utility/DataEncoder.cpp @@ -24,8 +24,7 @@ // Default constructor. DataEncoder::DataEncoder() - : m_start(nullptr), m_end(nullptr), - m_byte_order(endian::InlHostByteOrder()), m_addr_size(sizeof(void *)), + : m_byte_order(endian::InlHostByteOrder()), m_addr_size(sizeof(void *)), m_data_sp() {} // This constructor allows us to use data that is owned by someone else. The 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 @@ -120,9 +120,8 @@ } DataExtractor::DataExtractor() - : m_start(nullptr), m_end(nullptr), - m_byte_order(endian::InlHostByteOrder()), m_addr_size(sizeof(void *)), - m_data_sp(), m_target_byte_size(1) {} + : m_byte_order(endian::InlHostByteOrder()), m_addr_size(sizeof(void *)), + m_data_sp() {} // This constructor allows us to use data that is owned by someone else. The // data must stay around as long as this object is valid. 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 @@ -22,8 +22,7 @@ using namespace lldb_private::repro; ProcessInfo::ProcessInfo() - : m_executable(), m_arguments(), m_environment(), m_uid(UINT32_MAX), - m_gid(UINT32_MAX), m_arch(), m_pid(LLDB_INVALID_PROCESS_ID) {} + : m_executable(), m_arguments(), m_environment(), m_arch() {} ProcessInfo::ProcessInfo(const char *name, const ArchSpec &arch, lldb::pid_t pid) diff --git a/lldb/source/Utility/ReproducerInstrumentation.cpp b/lldb/source/Utility/ReproducerInstrumentation.cpp --- a/lldb/source/Utility/ReproducerInstrumentation.cpp +++ b/lldb/source/Utility/ReproducerInstrumentation.cpp @@ -193,8 +193,8 @@ } Recorder::Recorder() - : m_serializer(nullptr), m_pretty_func(), m_pretty_args(), - m_local_boundary(false), m_result_recorded(true), + : m_pretty_func(), m_pretty_args(), + m_sequence(std::numeric_limits::max()) { if (!g_global_boundary) { g_global_boundary = true; 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 @@ -37,7 +37,7 @@ using namespace lldb; using namespace lldb_private; -Status::Status() : m_code(0), m_type(eErrorTypeInvalid), m_string() {} +Status::Status() : m_string() {} Status::Status(ValueType err, ErrorType type) : m_code(err), m_type(type), m_string() {} 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 @@ -28,8 +28,8 @@ m_indent_level(0), m_forwarder(*this, colors) {} Stream::Stream(bool colors) - : m_flags(0), m_addr_size(4), m_byte_order(endian::InlHostByteOrder()), - m_indent_level(0), m_forwarder(*this, colors) {} + : m_flags(0), m_byte_order(endian::InlHostByteOrder()), + m_forwarder(*this, colors) {} // Destructor Stream::~Stream() {} 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 @@ -26,7 +26,7 @@ } // StringExtractor constructor -StringExtractor::StringExtractor() : m_packet(), m_index(0) {} +StringExtractor::StringExtractor() : m_packet() {} StringExtractor::StringExtractor(llvm::StringRef packet_str) : m_packet(), m_index(0) {