diff --git a/lldb/.clang-tidy b/lldb/.clang-tidy index 53d48d5facdeb..e1f34ca5aa392 100644 --- 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 index be1ae18e9db53..2570099f7652f 100644 --- a/lldb/include/lldb/API/SBBlock.h +++ b/lldb/include/lldb/API/SBBlock.h @@ -87,7 +87,7 @@ class LLDB_API SBBlock { 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 index 20756113793ab..046473d4223b6 100644 --- a/lldb/include/lldb/API/SBBroadcaster.h +++ b/lldb/include/lldb/API/SBBroadcaster.h @@ -77,7 +77,7 @@ class LLDB_API SBBroadcaster { 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 index 84c341c0dfef1..e407d859d8850 100644 --- a/lldb/include/lldb/API/SBCommunication.h +++ b/lldb/include/lldb/API/SBCommunication.h @@ -75,8 +75,8 @@ class LLDB_API SBCommunication { 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 index 0c05ef44e31c8..d965b9d966b9f 100644 --- a/lldb/include/lldb/API/SBCompileUnit.h +++ b/lldb/include/lldb/API/SBCompileUnit.h @@ -87,7 +87,7 @@ class LLDB_API SBCompileUnit { 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 index 08682b52cd23b..2ce1b60372b70 100644 --- a/lldb/include/lldb/API/SBEvent.h +++ b/lldb/include/lldb/API/SBEvent.h @@ -79,7 +79,7 @@ class LLDB_API SBEvent { 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 index bd643a62206f4..71b372a818e4b 100644 --- a/lldb/include/lldb/API/SBFunction.h +++ b/lldb/include/lldb/API/SBFunction.h @@ -74,7 +74,7 @@ class LLDB_API SBFunction { 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 index 2144e7956b13e..eaa8b59d0c49b 100644 --- a/lldb/include/lldb/API/SBListener.h +++ b/lldb/include/lldb/API/SBListener.h @@ -100,7 +100,7 @@ class LLDB_API SBListener { 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 index a01fb0facc253..291109cbe93c3 100644 --- a/lldb/include/lldb/API/SBStream.h +++ b/lldb/include/lldb/API/SBStream.h @@ -105,7 +105,7 @@ class LLDB_API SBStream { 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 index 66f73c82a73a5..5935ccfed0245 100644 --- a/lldb/include/lldb/API/SBSymbol.h +++ b/lldb/include/lldb/API/SBSymbol.h @@ -78,7 +78,7 @@ class LLDB_API SBSymbol { 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 index 85b8e025a8e52..7b78265920a2e 100644 --- a/lldb/include/lldb/Breakpoint/BreakpointOptions.h +++ b/lldb/include/lldb/Breakpoint/BreakpointOptions.h @@ -43,9 +43,7 @@ friend class Breakpoint; | 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 @@ friend class Breakpoint; 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 index 36df77c4e91a7..6bb1b6a705bc2 100644 --- a/lldb/include/lldb/Breakpoint/Stoppoint.h +++ b/lldb/include/lldb/Breakpoint/Stoppoint.h @@ -33,7 +33,7 @@ class Stoppoint { 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 index db02ddd494fb2..6da8d10d3f335 100644 --- a/lldb/include/lldb/Breakpoint/StoppointCallbackContext.h +++ b/lldb/include/lldb/Breakpoint/StoppointCallbackContext.h @@ -37,13 +37,14 @@ class StoppointCallbackContext { 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 index 283f991b178a0..6f224b641396c 100644 --- a/lldb/include/lldb/Breakpoint/WatchpointList.h +++ b/lldb/include/lldb/Breakpoint/WatchpointList.h @@ -198,7 +198,7 @@ class WatchpointList { 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 index 0a18c52d36d0a..fbfcb91c4249e 100644 --- a/lldb/include/lldb/Breakpoint/WatchpointOptions.h +++ b/lldb/include/lldb/Breakpoint/WatchpointOptions.h @@ -166,13 +166,13 @@ class WatchpointOptions { 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 @@ class WatchpointOptions { // 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 index c9734e78ec0f0..ec393a1871e35 100644 --- a/lldb/include/lldb/Core/Address.h +++ b/lldb/include/lldb/Core/Address.h @@ -116,7 +116,7 @@ class Address { /// /// 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 @@ class Address { 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 index f14a9e9412152..6fbdc35c91684 100644 --- a/lldb/include/lldb/Core/AddressRange.h +++ b/lldb/include/lldb/Core/AddressRange.h @@ -239,7 +239,7 @@ class AddressRange { 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 index 5df8034ae3c4b..f81de21bc8f8b 100644 --- a/lldb/include/lldb/Core/Declaration.h +++ b/lldb/include/lldb/Core/Declaration.h @@ -24,7 +24,7 @@ namespace lldb_private { 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 @@ class Declaration { 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 index e33ddcf13229c..622c23ff64928 100644 --- a/lldb/include/lldb/Core/Disassembler.h +++ b/lldb/include/lldb/Core/Disassembler.h @@ -454,10 +454,10 @@ class Disassembler : public std::enable_shared_from_this, 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 @@ class Disassembler : public std::enable_shared_from_this, // 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 index 58cd3e8eb4dfc..b3e837d78a442 100644 --- a/lldb/include/lldb/Core/EmulateInstruction.h +++ b/lldb/include/lldb/Core/EmulateInstruction.h @@ -182,8 +182,8 @@ class EmulateInstruction : public PluginInterface { } 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 @@ class EmulateInstruction : public PluginInterface { 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 index d28cc117040ee..16b1db1b50c46 100644 --- a/lldb/include/lldb/Core/FileLineResolver.h +++ b/lldb/include/lldb/Core/FileLineResolver.h @@ -28,8 +28,8 @@ class FileLineResolver : public Searcher { 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 @@ class FileLineResolver : public Searcher { 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 index ca8ecda5b5677..ecae8500df40d 100644 --- a/lldb/include/lldb/Core/FormatEntity.h +++ b/lldb/include/lldb/Core/FormatEntity.h @@ -128,7 +128,7 @@ class FormatEntity { 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 @@ class FormatEntity { 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 @@ class FormatEntity { 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 index 49400f7f4908c..ad6da2bd75592 100644 --- a/lldb/include/lldb/Core/LoadedModuleInfoList.h +++ b/lldb/include/lldb/Core/LoadedModuleInfoList.h @@ -101,14 +101,14 @@ class LoadedModuleInfoList { 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 index 58634e5137278..7bd3c3a784490 100644 --- a/lldb/include/lldb/Core/MappedHash.h +++ b/lldb/include/lldb/Core/MappedHash.h @@ -47,19 +47,17 @@ class MappedHash { 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 index c848c6997eba4..a9ec1e890dabd 100644 --- a/lldb/include/lldb/Core/Module.h +++ b/lldb/include/lldb/Core/Module.h @@ -885,10 +885,7 @@ class Module : public std::enable_shared_from_this, /// 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 @@ class Module : public std::enable_shared_from_this, 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 @@ class Module : public std::enable_shared_from_this, 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 index 46ad44359fa1b..07dddd18357b7 100644 --- a/lldb/include/lldb/Core/ModuleList.h +++ b/lldb/include/lldb/Core/ModuleList.h @@ -471,7 +471,7 @@ class ModuleList { 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 index 005c3a440b17d..9ecf4d0848424 100644 --- a/lldb/include/lldb/Core/Opcode.h +++ b/lldb/include/lldb/Core/Opcode.h @@ -38,7 +38,7 @@ class Opcode { 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 @@ class Opcode { 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 index 61616d9ac27a4..48102ec0b1cf8 100644 --- a/lldb/include/lldb/Core/RichManglingContext.h +++ b/lldb/include/lldb/Core/RichManglingContext.h @@ -24,7 +24,7 @@ namespace lldb_private { /// 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 @@ class RichManglingContext { 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 @@ class RichManglingContext { /// 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 index dced9938ca545..1ee4fe639e6e9 100644 --- a/lldb/include/lldb/Core/Value.h +++ b/lldb/include/lldb/Core/Value.h @@ -148,9 +148,9 @@ class Value { 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 index caad9612909e7..5f1cbc65b3200 100644 --- a/lldb/include/lldb/Core/ValueObject.h +++ b/lldb/include/lldb/Core/ValueObject.h @@ -318,7 +318,7 @@ class ValueObject { 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 ValueObject { 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 @@ class ValueObject { 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 index 4d54f03a2e03c..5c3176dfc5943 100644 --- a/lldb/include/lldb/DataFormatters/DumpValueObjectOptions.h +++ b/lldb/include/lldb/DataFormatters/DumpValueObjectOptions.h @@ -35,12 +35,11 @@ class DumpValueObjectOptions { }; 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 index e3989133a602e..b8540de3d7408 100644 --- a/lldb/include/lldb/DataFormatters/FormatClasses.h +++ b/lldb/include/lldb/DataFormatters/FormatClasses.h @@ -105,7 +105,7 @@ class FormattersMatchData { 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 @@ class TypeNameSpecifierImpl { 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 index b8ed6a3443b3e..4e19d4cb14a17 100644 --- a/lldb/include/lldb/DataFormatters/TypeFormat.h +++ b/lldb/include/lldb/DataFormatters/TypeFormat.h @@ -25,7 +25,7 @@ class TypeFormatImpl { public: class Flags { public: - Flags() : m_flags(lldb::eTypeOptionCascade) {} + Flags() {} Flags(const Flags &other) : m_flags(other.m_flags) {} @@ -104,7 +104,7 @@ class TypeFormatImpl { 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 @@ class TypeFormatImpl { 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 index 48480d1d7e456..4c60aa6f09ef8 100644 --- a/lldb/include/lldb/DataFormatters/TypeSummary.h +++ b/lldb/include/lldb/DataFormatters/TypeSummary.h @@ -38,8 +38,8 @@ class TypeSummaryOptions { 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 TypeSummaryImpl { class Flags { public: - Flags() : m_flags(lldb::eTypeOptionCascade) {} + Flags() {} Flags(const Flags &other) : m_flags(other.m_flags) {} @@ -196,7 +196,7 @@ class TypeSummaryImpl { 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 index ea49e48a2d626..96b34c9f3020a 100644 --- a/lldb/include/lldb/DataFormatters/TypeSynthetic.h +++ b/lldb/include/lldb/DataFormatters/TypeSynthetic.h @@ -133,7 +133,7 @@ class SyntheticChildren { public: class Flags { public: - Flags() : m_flags(lldb::eTypeOptionCascade) {} + Flags() {} Flags(const Flags &other) : m_flags(other.m_flags) {} @@ -225,7 +225,7 @@ class SyntheticChildren { 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 index c7d4e4b1882fd..1490ac2d614a8 100644 --- a/lldb/include/lldb/Expression/DWARFExpression.h +++ b/lldb/include/lldb/Expression/DWARFExpression.h @@ -250,10 +250,10 @@ class DWARFExpression { /// 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 index 754e67c5dfa7a..f60e0fbe513f8 100644 --- a/lldb/include/lldb/Expression/Materializer.h +++ b/lldb/include/lldb/Expression/Materializer.h @@ -90,7 +90,7 @@ class Materializer { class Entity { public: - Entity() : m_alignment(1), m_size(0), m_offset(0) {} + Entity() {} virtual ~Entity() = default; @@ -113,9 +113,9 @@ class Materializer { 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 index 28d5d9d09ca5e..d364d954a1c16 100644 --- a/lldb/include/lldb/Host/File.h +++ b/lldb/include/lldb/Host/File.h @@ -65,10 +65,7 @@ class File : public IOObject { 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 @@ class File : public IOObject { 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 File : public IOObject { 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 @@ class NativeFile : public File { // 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 index 4d333bb327a54..d3166c16a5854 100644 --- a/lldb/include/lldb/Host/FileAction.h +++ b/lldb/include/lldb/Host/FileAction.h @@ -46,9 +46,9 @@ class FileAction { 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 index 02eba47772a47..93563d4d26e3f 100644 --- a/lldb/include/lldb/Host/FileSystem.h +++ b/lldb/include/lldb/Host/FileSystem.h @@ -33,7 +33,7 @@ class FileSystem { 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 @@ class FileSystem { 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 index 0dfd363cc8fb7..c6007300344be 100644 --- a/lldb/include/lldb/Host/HostNativeThreadBase.h +++ b/lldb/include/lldb/Host/HostNativeThreadBase.h @@ -46,7 +46,7 @@ class HostNativeThreadBase { 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 index 883133776214d..3ed21637de7fc 100644 --- a/lldb/include/lldb/Host/ProcessLaunchInfo.h +++ b/lldb/include/lldb/Host/ProcessLaunchInfo.h @@ -176,10 +176,10 @@ class ProcessLaunchInfo : public ProcessInfo { 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 index 56c8d91518908..fc3cbab3b1120 100644 --- a/lldb/include/lldb/Host/ProcessRunLock.h +++ b/lldb/include/lldb/Host/ProcessRunLock.h @@ -35,7 +35,7 @@ class ProcessRunLock { class ProcessRunLocker { public: - ProcessRunLocker() : m_lock(nullptr) {} + ProcessRunLocker() {} ~ProcessRunLocker() { Unlock(); } @@ -64,7 +64,7 @@ class ProcessRunLock { } } - ProcessRunLock *m_lock; + ProcessRunLock *m_lock = nullptr; private: ProcessRunLocker(const ProcessRunLocker &) = delete; @@ -73,7 +73,7 @@ class ProcessRunLock { 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 index 350f926dcac1e..bd1e2f56241b2 100644 --- a/lldb/include/lldb/Host/PseudoTerminal.h +++ b/lldb/include/lldb/Host/PseudoTerminal.h @@ -175,8 +175,8 @@ class PseudoTerminal { 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 index 61993223ea066..172b27787b7df 100644 --- a/lldb/include/lldb/Host/Terminal.h +++ b/lldb/include/lldb/Host/Terminal.h @@ -116,12 +116,12 @@ class TerminalState { // 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 @@ class TerminalStateSwitcher { 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 index a80f1e9e4d269..9edf46bf09df5 100644 --- a/lldb/include/lldb/Host/XML.h +++ b/lldb/include/lldb/Host/XML.h @@ -107,7 +107,7 @@ class XMLNode { void ForEachAttribute(AttributeCallback const &callback) const; protected: - XMLNodeImpl m_node; + XMLNodeImpl m_node = nullptr; }; class XMLDocument { @@ -138,7 +138,7 @@ class XMLDocument { 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 index 3ee8f9d9133e3..42be989dfa7b6 100644 --- a/lldb/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h +++ b/lldb/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h @@ -108,7 +108,7 @@ class ConnectionFileDescriptor : public Connection { 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 index 27e1a22b19dd8..06328e60133fe 100644 --- a/lldb/include/lldb/Initialization/SystemLifetimeManager.h +++ b/lldb/include/lldb/Initialization/SystemLifetimeManager.h @@ -30,7 +30,7 @@ class SystemLifetimeManager { 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 index 5b5f145b7e25d..a8475ca610463 100644 --- a/lldb/include/lldb/Interpreter/CommandInterpreter.h +++ b/lldb/include/lldb/Interpreter/CommandInterpreter.h @@ -33,8 +33,7 @@ class CommandInterpreter; 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 @@ class CommandInterpreterRunResult { 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 @@ class CommandInterpreterRunOptions { 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 @@ class CommandInterpreterRunOptions { 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 index 218fa6f029c13..d31c2048aada0 100644 --- a/lldb/include/lldb/Interpreter/OptionValue.h +++ b/lldb/include/lldb/Interpreter/OptionValue.h @@ -60,7 +60,7 @@ class OptionValue { eDumpGroupExport = (eDumpOptionCommand | eDumpOptionName | eDumpOptionValue) }; - OptionValue() : m_value_was_set(false) {} + OptionValue() {} virtual ~OptionValue() = default; @@ -329,12 +329,12 @@ class OptionValue { 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 index 80a38fc9ed7ed..83d36edc1e9a0 100644 --- 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 @@ class OptionValueFileColonLine : 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 index dbaeac6c60c12..6648bbac93e33 100644 --- 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 @@ class OptionValueFileSpec : public Cloneable { 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 index 0d86fac14dcc4..9b85ca04bbfe2 100644 --- a/lldb/include/lldb/Interpreter/Options.h +++ b/lldb/include/lldb/Interpreter/Options.h @@ -254,7 +254,7 @@ class OptionGroup { class OptionGroupOptions : public Options { public: - OptionGroupOptions() : m_did_finalize(false) {} + OptionGroupOptions() {} ~OptionGroupOptions() override = default; @@ -317,7 +317,7 @@ class OptionGroupOptions : public Options { 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 index fa713e66d000c..00883c8d3d510 100644 --- a/lldb/include/lldb/Interpreter/ScriptInterpreter.h +++ b/lldb/include/lldb/Interpreter/ScriptInterpreter.h @@ -94,8 +94,7 @@ class ScriptInterpreter : public PluginInterface { 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 @@ class ScriptInterpreter : public PluginInterface { } 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 index e622c5fde2290..a3b477e55efc7 100644 --- a/lldb/include/lldb/Symbol/CompactUnwindInfo.h +++ b/lldb/include/lldb/Symbol/CompactUnwindInfo.h @@ -50,21 +50,20 @@ class CompactUnwindInfo { // 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 @@ class CompactUnwindInfo { // 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 index 7e56ef814765b..698d89974dc63 100644 --- a/lldb/include/lldb/Symbol/LineEntry.h +++ b/lldb/include/lldb/Symbol/LineEntry.h @@ -140,10 +140,12 @@ struct LineEntry { 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 index 68b5406409874..5cd22bd831eef 100644 --- a/lldb/include/lldb/Symbol/LineTable.h +++ b/lldb/include/lldb/Symbol/LineTable.h @@ -209,10 +209,9 @@ class LineTable { 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 @@ class LineTable { // 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 @@ class LineTable { 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 index 3a235f260ba5b..3abe3114863de 100644 --- a/lldb/include/lldb/Symbol/Symbol.h +++ b/lldb/include/lldb/Symbol/Symbol.h @@ -233,8 +233,9 @@ class Symbol : public SymbolContextScope { 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 @@ class Symbol : public SymbolContextScope { 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 index 1cf26a6959b7f..cac951bc19b92 100644 --- a/lldb/include/lldb/Symbol/SymbolContext.h +++ b/lldb/include/lldb/Symbol/SymbolContext.h @@ -316,12 +316,13 @@ class SymbolContext { // 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 index 6614950c2437a..80f3ec547d845 100644 --- a/lldb/include/lldb/Symbol/Type.h +++ b/lldb/include/lldb/Symbol/Type.h @@ -213,17 +213,17 @@ class Type : public std::enable_shared_from_this, public UserID { 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 TypeListImpl { 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 @@ class TypeMemberImpl { 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 TypeAndOrName { 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 @@ class TypeMemberFunctionImpl { 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 @@ class TypeEnumMemberImpl { 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 index 1fad8f61ac370..a37c1040b16e7 100644 --- a/lldb/include/lldb/Symbol/TypeSystem.h +++ b/lldb/include/lldb/Symbol/TypeSystem.h @@ -524,7 +524,7 @@ class TypeSystemMap { 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 index f8d23d7b7f231..cc2302d25831b 100644 --- a/lldb/include/lldb/Symbol/UnwindPlan.h +++ b/lldb/include/lldb/Symbol/UnwindPlan.h @@ -71,7 +71,7 @@ class UnwindPlan { isDWARFExpression // reg = eval(dwarf_expr) }; - RegisterLocation() : m_type(unspecified), m_location() {} + RegisterLocation() : m_location() {} bool operator==(const RegisterLocation &rhs) const; @@ -181,7 +181,7 @@ class UnwindPlan { 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 @@ class UnwindPlan { isRaSearch, // FA = SP + offset + ??? }; - FAValue() : m_type(unspecified), m_value() {} + FAValue() : m_value() {} bool operator==(const FAValue &rhs) const; @@ -301,7 +301,7 @@ class UnwindPlan { 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 @@ class UnwindPlan { 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 index 169d56ac9b647..d8c233a666bb4 100644 --- a/lldb/include/lldb/Target/ExecutionContext.h +++ b/lldb/include/lldb/Target/ExecutionContext.h @@ -263,8 +263,9 @@ class ExecutionContextRef { 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 index 9e1e6eb26eb9b..bfc4da69ec0fa 100644 --- a/lldb/include/lldb/Target/PathMappingList.h +++ b/lldb/include/lldb/Target/PathMappingList.h @@ -118,9 +118,9 @@ class PathMappingList { 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 index f6a5386fe511a..b7b45184af2ab 100644 --- a/lldb/include/lldb/Target/Process.h +++ b/lldb/include/lldb/Target/Process.h @@ -113,9 +113,7 @@ class ProcessAttachInfo : public ProcessInstanceInfo { 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 @@ class ProcessAttachInfo : public ProcessInstanceInfo { 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 @@ class ProcessModID { 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 @@ class ProcessModID { } 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 @@ class Process : public std::enable_shared_from_this, } 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 index 362812bcffd06..90f9531989690 100644 --- a/lldb/include/lldb/Target/RegisterNumber.h +++ b/lldb/include/lldb/Target/RegisterNumber.h @@ -50,10 +50,10 @@ class RegisterNumber { 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 index 827ed1be7c0f1..95d12df6742c5 100644 --- a/lldb/include/lldb/Target/StackID.h +++ b/lldb/include/lldb/Target/StackID.h @@ -18,8 +18,8 @@ class StackID { 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 @@ class StackID { 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 index 8c22d53185ffb..7c7c832741196 100644 --- a/lldb/include/lldb/Target/ThreadSpec.h +++ b/lldb/include/lldb/Target/ThreadSpec.h @@ -120,8 +120,8 @@ class ThreadSpec { 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 index c7c9cfbccbad8..f6750171c54a6 100644 --- a/lldb/include/lldb/Target/UnwindLLDB.h +++ b/lldb/include/lldb/Target/UnwindLLDB.h @@ -109,17 +109,17 @@ class UnwindLLDB : public lldb_private::Unwind { 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 index 64e75f9043406..b944c09d5c47f 100644 --- a/lldb/include/lldb/Utility/DataEncoder.h +++ b/lldb/include/lldb/Utility/DataEncoder.h @@ -226,10 +226,10 @@ class DataEncoder { 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 index d4d9200e9bcd4..0923e5280cba9 100644 --- a/lldb/include/lldb/Utility/DataExtractor.h +++ b/lldb/include/lldb/Utility/DataExtractor.h @@ -997,15 +997,15 @@ class DataExtractor { } // 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 index f76085927aaad..f658818de8062 100644 --- a/lldb/include/lldb/Utility/GDBRemote.h +++ b/lldb/include/lldb/Utility/GDBRemote.h @@ -55,9 +55,7 @@ struct GDBRemotePacket { 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 @@ struct GDBRemotePacket { 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 index 8f5a5f6d21fbd..3c59569263912 100644 --- a/lldb/include/lldb/Utility/ProcessInfo.h +++ b/lldb/include/lldb/Utility/ProcessInfo.h @@ -95,10 +95,10 @@ class ProcessInfo { // 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 @@ class ProcessInfo { // 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 @@ class ProcessInstanceInfo : public ProcessInfo { 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 @@ typedef std::vector ProcessInstanceInfoList; 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 @@ class ProcessInstanceInfoMatch { 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 index 4211b0a599921..1ece4f0eb79f7 100644 --- a/lldb/include/lldb/Utility/RegisterValue.h +++ b/lldb/include/lldb/Utility/RegisterValue.h @@ -43,8 +43,7 @@ class RegisterValue { 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 @@ class RegisterValue { 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 index c8a98adf85c74..8812ef6b1d8f9 100644 --- a/lldb/include/lldb/Utility/ReproducerInstrumentation.h +++ b/lldb/include/lldb/Utility/ReproducerInstrumentation.h @@ -714,8 +714,7 @@ class InstrumentationData { 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 @@ class InstrumentationData { 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 @@ class Recorder { } #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 index f797aaf996260..2801b1bd63266 100644 --- a/lldb/include/lldb/Utility/Scalar.h +++ b/lldb/include/lldb/Utility/Scalar.h @@ -49,7 +49,7 @@ class Scalar { }; // 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 @@ class Scalar { 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 index b5f90bea2eebb..61d663bdccba4 100644 --- a/lldb/include/lldb/Utility/Status.h +++ b/lldb/include/lldb/Utility/Status.h @@ -196,8 +196,9 @@ class Status { 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 index a5422f5f4c2aa..1a5fd343e4df0 100644 --- a/lldb/include/lldb/Utility/Stream.h +++ b/lldb/include/lldb/Utility/Stream.h @@ -361,10 +361,10 @@ class Stream { 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 index 996e59e84ec49..a4819378ce322 100644 --- a/lldb/include/lldb/Utility/StringExtractor.h +++ b/lldb/include/lldb/Utility/StringExtractor.h @@ -115,7 +115,7 @@ class StringExtractor { /// 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 index bf99593249b2d..d78bd3b139b9d 100644 --- a/lldb/include/lldb/Utility/StringExtractorGDBRemote.h +++ b/lldb/include/lldb/Utility/StringExtractorGDBRemote.h @@ -23,7 +23,7 @@ class StringExtractorGDBRemote : public StringExtractor { 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 @@ class StringExtractorGDBRemote : public StringExtractor { 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 index d1dfa3adb0c35..3c7ac61cdd707 100644 --- a/lldb/include/lldb/Utility/VMRange.h +++ b/lldb/include/lldb/Utility/VMRange.h @@ -26,7 +26,7 @@ class VMRange { 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 @@ class VMRange { 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 index a5fee445d5c6a..5c49053dd972e 100644 --- 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 index d42d7ce2a536a..2e6d837f102b1 100644 --- 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 index fddf90b664814..9ebdbfc6080ce 100644 --- a/lldb/source/API/SBCommandReturnObject.cpp +++ b/lldb/source/API/SBCommandReturnObject.cpp @@ -21,8 +21,7 @@ using namespace lldb_private; 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 @@ class lldb_private::SBCommandReturnObjectImpl { 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 index d55ecd35b5570..9a2ab89d5e4ed 100644 --- 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 index 36df480dd094d..a44d3b8971100 100644 --- 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 index 2776ec49c0924..a0b606e3812ef 100644 --- 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 index 7d81716347525..2d0cb239de756 100644 --- 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 index f3463268b3b5e..6e5e15de7b3d4 100644 --- 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 index 7043367b13438..496c40a0678fe 100644 --- a/lldb/source/API/SBPlatform.cpp +++ b/lldb/source/API/SBPlatform.cpp @@ -32,7 +32,7 @@ using namespace lldb_private; 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 @@ struct PlatformConnectOptions { 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 @@ struct PlatformShellCommand { } 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 @@ struct PlatformShellCommand { 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 index 75674dbc00bb0..746df9e79d61b 100644 --- a/lldb/source/API/SBQueue.cpp +++ b/lldb/source/API/SBQueue.cpp @@ -27,9 +27,7 @@ namespace lldb_private { 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 @@ class QueueImpl { 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 index eb81153084e8c..66172d248bf36 100644 --- 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 index 7b9c90032e1a8..d3abc13675f5b 100644 --- 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 index 4ef16364e6280..1af582a0c3d70 100644 --- a/lldb/source/API/SBVariablesOptions.cpp +++ b/lldb/source/API/SBVariablesOptions.cpp @@ -21,9 +21,7 @@ class VariablesOptionsImpl { 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 @@ class VariablesOptionsImpl { 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 index b5c8334333cfb..b2c4a7eeb253f 100644 --- a/lldb/source/Breakpoint/Stoppoint.cpp +++ b/lldb/source/Breakpoint/Stoppoint.cpp @@ -14,7 +14,7 @@ using namespace lldb; 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 index 640db8bb9c96a..a561c99b1d924 100644 --- 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 index a6f651e84955b..8599c3cf30fad 100644 --- 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 index f01f5ad3dd271..a578e8744efbd 100644 --- a/lldb/source/Breakpoint/WatchpointOptions.cpp +++ b/lldb/source/Breakpoint/WatchpointOptions.cpp @@ -28,7 +28,7 @@ bool WatchpointOptions::NullCallback(void *baton, // 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 index 0844c56cef2f6..724eacdebd5ff 100644 --- a/lldb/source/Commands/CommandObjectBreakpoint.cpp +++ b/lldb/source/Commands/CommandObjectBreakpoint.cpp @@ -242,15 +242,8 @@ class CommandObjectBreakpointSet : public CommandObjectParsed { 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 @@ class CommandObjectBreakpointSet : public CommandObjectParsed { 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 CommandObjectBreakpointList : public CommandObjectParsed { class CommandOptions : public Options { public: - CommandOptions() - : Options(), m_level(lldb::eDescriptionLevelBrief), m_use_dummy(false) { - } + CommandOptions() : Options() {} ~CommandOptions() override = default; @@ -1179,10 +1170,10 @@ class CommandObjectBreakpointList : public CommandObjectParsed { // 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 CommandObjectBreakpointClear : public CommandObjectParsed { class CommandOptions : public Options { public: - CommandOptions() : Options(), m_filename(), m_line_num(0) {} + CommandOptions() : Options(), m_filename() {} ~CommandOptions() override = default; @@ -1305,7 +1296,7 @@ class CommandObjectBreakpointClear : public CommandObjectParsed { // 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 CommandObjectBreakpointDelete : public CommandObjectParsed { 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 @@ class CommandObjectBreakpointDelete : public CommandObjectParsed { } // 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 index 127cde061120d..81abc1ba726e0 100644 --- a/lldb/source/Commands/CommandObjectBreakpointCommand.cpp +++ b/lldb/source/Commands/CommandObjectBreakpointCommand.cpp @@ -283,10 +283,7 @@ are no syntax errors may indicate that a function was declared but never called. 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 @@ are no syntax errors may indicate that a function was declared but never called. // 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 CommandObjectBreakpointCommandDelete : public CommandObjectParsed { class CommandOptions : public Options { public: - CommandOptions() : Options(), m_use_dummy(false) {} + CommandOptions() : Options() {} ~CommandOptions() override = default; @@ -540,7 +537,7 @@ class CommandObjectBreakpointCommandDelete : public CommandObjectParsed { } // 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 index 74b16a613ffae..94e670a3fad29 100644 --- a/lldb/source/Commands/CommandObjectCommands.cpp +++ b/lldb/source/Commands/CommandObjectCommands.cpp @@ -1387,8 +1387,7 @@ class CommandObjectCommandsScriptAdd : public CommandObjectParsed, 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 @@ class CommandObjectCommandsScriptAdd : public CommandObjectParsed, 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.cpp b/lldb/source/Commands/CommandObjectDisassemble.cpp index 8d2b13a5a4c00..a6d5ab68d569b 100644 --- a/lldb/source/Commands/CommandObjectDisassemble.cpp +++ b/lldb/source/Commands/CommandObjectDisassemble.cpp @@ -31,10 +31,7 @@ using namespace lldb_private; #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/CommandObjectDisassemble.h b/lldb/source/Commands/CommandObjectDisassemble.h index 340bf648de176..a4b3df8724da6 100644 --- a/lldb/source/Commands/CommandObjectDisassemble.h +++ b/lldb/source/Commands/CommandObjectDisassemble.h @@ -46,22 +46,22 @@ class CommandObjectDisassemble : public CommandObjectParsed { 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/CommandObjectLog.cpp b/lldb/source/Commands/CommandObjectLog.cpp index 4016b07c91edb..288ffdb183b9e 100644 --- a/lldb/source/Commands/CommandObjectLog.cpp +++ b/lldb/source/Commands/CommandObjectLog.cpp @@ -76,7 +76,7 @@ class CommandObjectLogEnable : public CommandObjectParsed { class CommandOptions : public Options { public: - CommandOptions() : Options(), log_file(), log_options(0) {} + CommandOptions() : Options(), log_file() {} ~CommandOptions() override = default; @@ -136,7 +136,7 @@ class CommandObjectLogEnable : public CommandObjectParsed { // 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 index 19c13c089503d..e6decf120aebb 100644 --- a/lldb/source/Commands/CommandObjectMemory.cpp +++ b/lldb/source/Commands/CommandObjectMemory.cpp @@ -46,8 +46,8 @@ using namespace lldb_private; 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 @@ class OptionGroupReadMemory : public OptionGroup { } 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 index d0c58ac807ff5..b95b1c3d5655f 100644 --- a/lldb/source/Commands/CommandObjectPlatform.cpp +++ b/lldb/source/Commands/CommandObjectPlatform.cpp @@ -1215,8 +1215,7 @@ class CommandObjectPlatformProcessList : public CommandObjectParsed { 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 @@ class CommandObjectPlatformProcessList : public CommandObjectParsed { // 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 index 3e45b71cef085..031b7151d7af4 100644 --- a/lldb/source/Commands/CommandObjectProcess.cpp +++ b/lldb/source/Commands/CommandObjectProcess.cpp @@ -1250,7 +1250,7 @@ class CommandObjectProcessStatus : public CommandObjectParsed { class CommandOptions : public Options { public: - CommandOptions() : Options(), m_verbose(false) {} + CommandOptions() : Options() {} ~CommandOptions() override = default; @@ -1278,7 +1278,7 @@ class CommandObjectProcessStatus : public CommandObjectParsed { } // 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 index d869377c578cf..82335f432903e 100644 --- a/lldb/source/Commands/CommandObjectSettings.cpp +++ b/lldb/source/Commands/CommandObjectSettings.cpp @@ -87,7 +87,7 @@ insert-before or insert-after."); class CommandOptions : public Options { public: - CommandOptions() : Options(), m_global(false) {} + CommandOptions() : Options() {} ~CommandOptions() override = default; @@ -120,7 +120,7 @@ insert-before or insert-after."); } // 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 index bc038e326d976..1df2bca98aa7d 100644 --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -1969,7 +1969,7 @@ class CommandObjectTargetModulesDumpSymtab class CommandOptions : public Options { public: - CommandOptions() : Options(), m_sort_order(eSortOrderNone) {} + CommandOptions() : Options() {} ~CommandOptions() override = default; @@ -2005,7 +2005,7 @@ class CommandObjectTargetModulesDumpSymtab 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 @@ class CommandObjectTargetModulesList : public CommandObjectParsed { 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 @@ class CommandObjectTargetModulesList : public CommandObjectParsed { // 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 CommandObjectTargetModulesShowUnwind : public CommandObjectParsed { 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 @@ class CommandObjectTargetModulesShowUnwind : public CommandObjectParsed { // 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 @@ class CommandObjectTargetStopHookAdd : public CommandObjectParsed, 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 @@ class CommandObjectTargetStopHookAdd : public CommandObjectParsed, 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 index a88fda9fa3d4f..7e4709b33cc12 100644 --- a/lldb/source/Commands/CommandObjectThread.cpp +++ b/lldb/source/Commands/CommandObjectThread.cpp @@ -802,12 +802,10 @@ class CommandObjectThreadUntil : public CommandObjectParsed { 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 @@ class CommandObjectThreadReturn : public CommandObjectRaw { 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 @@ class CommandObjectThreadReturn : public CommandObjectRaw { 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 index cc6bca09b0182..025d9eadd2ae3 100644 --- a/lldb/source/Commands/CommandObjectType.cpp +++ b/lldb/source/Commands/CommandObjectType.cpp @@ -2712,8 +2712,7 @@ class CommandObjectTypeLookup : public CommandObjectRaw { class CommandOptions : public OptionGroup { public: - CommandOptions() - : OptionGroup(), m_show_help(false), m_language(eLanguageTypeUnknown) {} + CommandOptions() : OptionGroup() {} ~CommandOptions() override = default; @@ -2750,8 +2749,8 @@ class CommandObjectTypeLookup : public CommandObjectRaw { // 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 index e7b1f31f3960d..b8be19f385233 100644 --- a/lldb/source/Commands/CommandObjectWatchpoint.cpp +++ b/lldb/source/Commands/CommandObjectWatchpoint.cpp @@ -166,11 +166,7 @@ class CommandObjectWatchpointList : public CommandObjectParsed { 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 @@ class CommandObjectWatchpointList : public CommandObjectParsed { // 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 CommandObjectWatchpointDelete : public CommandObjectParsed { class CommandOptions : public Options { public: - CommandOptions() : Options(), m_force(false) {} + CommandOptions() : Options() {} ~CommandOptions() override = default; @@ -495,7 +491,7 @@ class CommandObjectWatchpointDelete : public CommandObjectParsed { } // Instance variables to hold the values for command options. - bool m_force; + bool m_force = false; }; protected: @@ -593,7 +589,7 @@ class CommandObjectWatchpointIgnore : public CommandObjectParsed { class CommandOptions : public Options { public: - CommandOptions() : Options(), m_ignore_count(0) {} + CommandOptions() : Options() {} ~CommandOptions() override = default; @@ -625,7 +621,7 @@ class CommandObjectWatchpointIgnore : public CommandObjectParsed { // 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 CommandObjectWatchpointModify : public CommandObjectParsed { class CommandOptions : public Options { public: - CommandOptions() : Options(), m_condition(), m_condition_passed(false) {} + CommandOptions() : Options(), m_condition() {} ~CommandOptions() override = default; @@ -754,7 +750,7 @@ class CommandObjectWatchpointModify : public CommandObjectParsed { // 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 index f22687ff4bd87..432ba447a41b2 100644 --- a/lldb/source/Commands/CommandObjectWatchpointCommand.cpp +++ b/lldb/source/Commands/CommandObjectWatchpointCommand.cpp @@ -314,10 +314,7 @@ are no syntax errors may indicate that a function was declared but never called. 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 @@ are no syntax errors may indicate that a function was declared but never called. // 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 index 7f3162a9f53d8..f55e17251887f 100644 --- a/lldb/source/Core/AddressRange.cpp +++ b/lldb/source/Core/AddressRange.cpp @@ -28,7 +28,7 @@ class SectionList; 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 index 112c257a62fff..4778cde4fbb53 100644 --- a/lldb/source/Core/IOHandlerCursesGUI.cpp +++ b/lldb/source/Core/IOHandlerCursesGUI.cpp @@ -2219,9 +2219,7 @@ class ThreadsTreeDelegate : public TreeDelegate { 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 @@ class ValueObjectListDelegate : public WindowDelegate { 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 index 64193b57b095f..2e8163af12c46 100644 --- a/lldb/source/Core/Module.cpp +++ b/lldb/source/Core/Module.cpp @@ -257,9 +257,7 @@ Module::Module(const FileSpec &file_spec, const ArchSpec &arch, 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 index 98f6ae2c62b0d..56bc4c72d8e9c 100644 --- a/lldb/source/Core/ModuleList.cpp +++ b/lldb/source/Core/ModuleList.cpp @@ -132,8 +132,7 @@ PathMappingList ModuleListProperties::GetSymlinkMappings() const { 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 index a224ba173677b..cb62e4e15b4eb 100644 --- a/lldb/source/Core/PluginManager.cpp +++ b/lldb/source/Core/PluginManager.cpp @@ -38,11 +38,11 @@ typedef bool (*PluginInitCallback)(); 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 index 6ce01d893c640..fb57c0fedf047 100644 --- 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 index 047fa9941723d..bbcce0dbf20a2 100644 --- a/lldb/source/Core/ValueObject.cpp +++ b/lldb/source/Core/ValueObject.cpp @@ -2796,8 +2796,7 @@ ValueObjectSP ValueObject::CastPointerType(const char *name, TypeSP &type_sp) { 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 index 82c8b645ec845..9078a6f48f842 100644 --- 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 index 5d4fe2e467f85..341bbc147448e 100644 --- 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 index 75bad047e095f..fd26071b9a3b9 100644 --- a/lldb/source/Expression/DWARFExpression.cpp +++ b/lldb/source/Expression/DWARFExpression.cpp @@ -55,9 +55,7 @@ ReadAddressFromDebugAddrSection(const DWARFUnit *dwarf_cu, } // 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 index 8b4e7f4c22083..e399c7ec47cd5 100644 --- a/lldb/source/Host/common/FileAction.cpp +++ b/lldb/source/Host/common/FileAction.cpp @@ -16,8 +16,7 @@ using namespace lldb_private; // 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 index ad7743c92e715..d14ebe99fd155 100644 --- a/lldb/source/Host/common/Host.cpp +++ b/lldb/source/Host/common/Host.cpp @@ -442,14 +442,12 @@ bool Host::FindProcessThreads(const lldb::pid_t pid, TidMap &tids_to_attach) { #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 index a79431f61d884..331b2671e88c7 100644 --- a/lldb/source/Host/common/HostNativeThreadBase.cpp +++ b/lldb/source/Host/common/HostNativeThreadBase.cpp @@ -18,7 +18,7 @@ using namespace lldb; 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 index 8becd5aadecab..8d281b80e8f0b 100644 --- a/lldb/source/Host/common/ProcessLaunchInfo.cpp +++ b/lldb/source/Host/common/ProcessLaunchInfo.cpp @@ -30,10 +30,9 @@ using namespace lldb_private; 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 index 3b6f033d33ab6..aee15779d9199 100644 --- 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 index ce062afb9c5ab..6533d659ce317 100644 --- a/lldb/source/Host/common/PseudoTerminal.cpp +++ b/lldb/source/Host/common/PseudoTerminal.cpp @@ -29,8 +29,7 @@ int posix_openpt(int flags); 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 index c9999bd7f8351..e59b2198f5061 100644 --- a/lldb/source/Host/common/Terminal.cpp +++ b/lldb/source/Host/common/Terminal.cpp @@ -83,11 +83,12 @@ bool Terminal::SetCanonical(bool enabled) { // 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 @@ bool TerminalState::ProcessGroupIsValid() const { } // 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 index 456c879b0148e..dd40f1acc3fb2 100644 --- a/lldb/source/Host/common/XML.cpp +++ b/lldb/source/Host/common/XML.cpp @@ -17,7 +17,7 @@ using namespace lldb_private; #pragma mark-- XMLDocument -XMLDocument::XMLDocument() : m_document(nullptr) {} +XMLDocument::XMLDocument() {} XMLDocument::~XMLDocument() { Clear(); } @@ -91,7 +91,7 @@ bool XMLDocument::XMLEnabled() { #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 index 5c60caa33e6f4..0a1cfa9456843 100644 --- 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 @@ static void PThreadDestructor(void *v) { } 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 index 548a3767e3173..2f4cc960f02d0 100644 --- a/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp +++ b/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp @@ -76,7 +76,7 @@ llvm::Optional GetURLAddress(llvm::StringRef url, 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 index 00ab3198c363c..f9de41a675356 100644 --- 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 index 6f954e99f9b00..e1d673ed213ba 100644 --- a/lldb/source/Interpreter/OptionValueFileColonLine.cpp +++ b/lldb/source/Interpreter/OptionValueFileColonLine.cpp @@ -22,9 +22,8 @@ using namespace lldb_private; // 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 index 9f80cc86db506..3987a36b1b65f 100644 --- 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 index 8659cd575bc31..1fa78bf77f37f 100644 --- a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h +++ b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h @@ -125,11 +125,7 @@ class DynamicLoaderDarwinKernel : public lldb_private::DynamicLoader { 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 @@ class DynamicLoaderDarwinKernel : public lldb_private::DynamicLoader { 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 index 5707f8858f6c9..01542bcc4b53e 100644 --- a/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/HexagonDYLDRendezvous.h +++ b/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/HexagonDYLDRendezvous.h @@ -35,15 +35,13 @@ class HexagonDYLDRendezvous { // 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 index 4c9a27f085377..1b705e9444680 100644 --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.h +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.h @@ -73,19 +73,17 @@ class DynamicLoaderDarwin : public lldb_private::DynamicLoader { 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 index b3cb3e50fa30f..190898c01091f 100644 --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h @@ -98,20 +98,17 @@ class DynamicLoaderMacOSXDYLD : public lldb_private::DynamicLoaderDarwin { 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 index 3e88d88f407a0..3cc58dd805b8e 100644 --- a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.h +++ b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.h @@ -38,13 +38,13 @@ class DYLDRendezvous { // 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 index 274b1215eb21f..df2096aa50b0e 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.h +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.h @@ -216,7 +216,7 @@ class ClangASTImporter { 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 @@ class ClangASTImporter { 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 index e3d2f449683d9..1af5df95821e5 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h @@ -248,10 +248,10 @@ class ClangExpressionDeclMap : public ClangASTSource { 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 @@ class ClangExpressionDeclMap : public ClangASTSource { /// 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 index 6bae52edd5a26..d8a77b94ebdc6 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionVariable.h +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionVariable.h @@ -116,19 +116,19 @@ class ClangExpressionVariable : public ExpressionVariable { /// 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 @@ class ClangExpressionVariable : public ExpressionVariable { /// 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 index d15d80c97e38f..5c80bbe0fea92 100644 --- a/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.h +++ b/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.h @@ -19,7 +19,7 @@ namespace lldb_private { // 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 @@ class ITSession { 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.cpp b/lldb/source/Plugins/Instruction/ARM/EmulationStateARM.cpp index aef08baa8ae95..cc030670a8c7e 100644 --- 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/Instruction/ARM/EmulationStateARM.h b/lldb/source/Plugins/Instruction/ARM/EmulationStateARM.h index 955c7c6420589..28bc5d98649da 100644 --- a/lldb/source/Plugins/Instruction/ARM/EmulationStateARM.h +++ b/lldb/source/Plugins/Instruction/ARM/EmulationStateARM.h @@ -61,7 +61,7 @@ class EmulationStateARM { 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/Language/CPlusPlus/CPlusPlusLanguage.h b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h index d2a239da9b08a..9163be4807ec2 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h +++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h @@ -28,8 +28,7 @@ class CPlusPlusLanguage : public Language { 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 @@ class CPlusPlusLanguage : public Language { 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 index a15b0f64954a8..068bca9e7b94b 100644 --- a/lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp +++ b/lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp @@ -209,14 +209,13 @@ class NSIndexPathSyntheticFrontEnd : public SyntheticChildrenFrontEnd { 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 @@ class NSIndexPathSyntheticFrontEnd : public SyntheticChildrenFrontEnd { 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 @@ class NSIndexPathSyntheticFrontEnd : public SyntheticChildrenFrontEnd { 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 index e2aa53f9047e5..7401e54ea1efc 100644 --- a/lldb/source/Plugins/Language/ObjC/ObjCLanguage.h +++ b/lldb/source/Plugins/Language/ObjC/ObjCLanguage.h @@ -27,9 +27,7 @@ class ObjCLanguage : public Language { 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 @@ class ObjCLanguage : public Language { 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.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp index bdd5c29db8484..c1082100f2746 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp @@ -514,8 +514,7 @@ uint64_t ClassDescriptorV2::GetInstanceSize() { 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/AppleObjCClassDescriptorV2.h b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.h index 1bea314f63fca..16e94f6790841 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.h +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.h @@ -77,16 +77,14 @@ class ClassDescriptorV2 : public ObjCLanguageRuntime::ClassDescriptor { 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 @@ class ClassDescriptorV2 : public ObjCLanguageRuntime::ClassDescriptor { 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/AppleObjCRuntimeV1.h b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h index 0164f83a06002..5683679a8f127 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h @@ -126,8 +126,7 @@ class AppleObjCRuntimeV1 : public AppleObjCRuntime { 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 @@ class AppleObjCRuntimeV1 : public AppleObjCRuntime { } 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.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp index ab9cfab850a5b..83f4356c3fb37 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp @@ -1032,11 +1032,7 @@ bool AppleObjCRuntimeV2::IsTaggedPointer(addr_t ptr) { 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 @@ class RemoteNXMapTable { 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/AppleObjCRuntimeV2.h b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h index 9ed9a6f71b828..2da1670a3a0c0 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h @@ -116,9 +116,9 @@ class AppleObjCRuntimeV2 : public AppleObjCRuntime { 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/AppleObjCTrampolineHandler.h b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.h index 27aebd8594dfa..3fae5255c8ffb 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.h +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.h @@ -76,10 +76,7 @@ class AppleObjCTrampolineHandler { 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 @@ class AppleObjCTrampolineHandler { 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.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp index b19d3d90d4b72..7b0121503bc40 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp @@ -59,7 +59,7 @@ uint32_t AppleObjCTypeEncodingParser::ReadNumber(StringLexer &type) { // "{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/AppleObjCRuntime/AppleObjCTypeEncodingParser.h b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.h index 9a108967e1ab6..6e533b591ecab 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.h +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.h @@ -29,7 +29,7 @@ class AppleObjCTypeEncodingParser : public ObjCLanguageRuntime::EncodingToType { 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/ObjCLanguageRuntime.h b/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h index 9fc858648bcda..15fce04ea4652 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h @@ -49,9 +49,7 @@ class ObjCLanguageRuntime : public LanguageRuntime { // 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 @@ class ObjCLanguageRuntime : public LanguageRuntime { 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.cpp b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp index cd36a83ae680c..8a9be6d40c7c3 100644 --- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp +++ b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp @@ -61,7 +61,7 @@ namespace { 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 @@ template class empirical_type { } protected: - bool valid; + bool valid = false; type_t data; }; @@ -4087,9 +4087,7 @@ class CommandObjectRenderScriptRuntimeReductionBreakpointSet class CommandOptions : public Options { public: - CommandOptions() - : Options(), - m_kernel_types(RSReduceBreakpointResolver::eKernelTypeAll) {} + CommandOptions() : Options() {} ~CommandOptions() override = default; @@ -4175,7 +4173,7 @@ class CommandObjectRenderScriptRuntimeReductionBreakpointSet 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 CommandObjectRenderScriptRuntimeAllocationList class CommandOptions : public Options { public: - CommandOptions() : Options(), m_id(0) {} + CommandOptions() : Options() {} ~CommandOptions() override = default; @@ -4681,7 +4679,7 @@ class CommandObjectRenderScriptRuntimeAllocationList 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/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h index 5e37265483692..982d24dc8a7a7 100644 --- 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 RSKernelDescriptorSP; 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/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp b/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp index 211eb9ce0d3aa..000ed78a77075 100644 --- a/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp +++ b/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp @@ -42,9 +42,7 @@ using namespace lldb_private; 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/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h b/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h index f6862afff8a0b..9830e9b5d1b27 100644 --- a/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h +++ b/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h @@ -84,25 +84,25 @@ class ObjectContainerBSDArchive : public lldb_private::ObjectContainer { 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/ObjectFile/ELF/ObjectFileELF.h b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h index 4fde0d141727a..8563af9d4eef4 100644 --- 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.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp index 8a11f40ba0aba..86b5a3e2e3e6d 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp @@ -39,9 +39,7 @@ PlatformRemoteDarwinDevice::SDKDirectoryInfo::SDKDirectoryInfo( 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/PlatformRemoteDarwinDevice.h b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.h index 6f6ede7c34b74..3b578a3fe917e 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.h +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.h @@ -64,8 +64,8 @@ class PlatformRemoteDarwinDevice : public PlatformDarwin { 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/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.h b/lldb/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.h index 5104e488189f5..a35efd53f313e 100644 --- a/lldb/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.h +++ b/lldb/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.h @@ -93,7 +93,7 @@ class DeviceType { ProductFamilyID GetProductFamilyID(); private: - id m_dev; + id m_dev = nullptr; llvm::Optional m_model_identifier; }; @@ -129,7 +129,7 @@ class DeviceRuntime { bool IsAvailable(); private: - id m_dev; + id m_dev = nullptr; llvm::Optional m_os_version; }; @@ -169,7 +169,7 @@ class Device { 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 index 66fe569f6779e..91d6252aa0b16 100644 --- a/lldb/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.mm +++ b/lldb/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.mm @@ -66,8 +66,7 @@ - (BOOL)spawnWithPath:(NSString *)path 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 @@ - (BOOL)spawnWithPath:(NSString *)path 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 @@ - (BOOL)spawnWithPath:(NSString *)path 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.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp index deb254e932a1a..0abc80250d48f 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp @@ -55,41 +55,7 @@ llvm::raw_ostream &process_gdb_remote::operator<<(llvm::raw_ostream &os, // 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 @@ GDBRemoteCommunicationClient::GDBRemoteCommunicationClient() 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/GDBRemoteCommunicationClient.h b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h index 1891842a69444..975baa2f08df2 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h @@ -522,42 +522,42 @@ class GDBRemoteCommunicationClient : public GDBRemoteClientBase { 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 @@ class GDBRemoteCommunicationClient : public GDBRemoteClientBase { 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 @@ class GDBRemoteCommunicationClient : public GDBRemoteClientBase { 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/GDBRemoteCommunicationHistory.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationHistory.cpp index 3984a45c3da1e..9aca9e1e33453 100644 --- 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; 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/GDBRemoteCommunicationHistory.h b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationHistory.h index e783e59c34559..eda464a758e49 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationHistory.h +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationHistory.h @@ -74,9 +74,9 @@ class GDBRemoteCommunicationHistory { } 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/GDBRemoteCommunicationReplayServer.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationReplayServer.cpp index 992adeea8fa1d..c91d7cb5ac30f 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationReplayServer.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationReplayServer.cpp @@ -74,7 +74,7 @@ GDBRemoteCommunicationReplayServer::GDBRemoteCommunicationReplayServer() 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/Process/gdb-remote/GDBRemoteCommunicationReplayServer.h b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationReplayServer.h index c13e5ee0bf923..2f8770d0accfc 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationReplayServer.h +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationReplayServer.h @@ -73,7 +73,7 @@ class GDBRemoteCommunicationReplayServer : public GDBRemoteCommunication { 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/ScriptInterpreter/Python/PythonDataObjects.h b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h index 22f6c67eb7a5d..6ca0e754c9d45 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h +++ b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h @@ -229,7 +229,7 @@ struct PythonFormat< class PythonObject { public: - PythonObject() : m_py_obj(nullptr) {} + PythonObject() {} PythonObject(PyRefType type, PyObject *py_obj) { m_py_obj = py_obj; @@ -378,7 +378,7 @@ class PythonObject { } 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 index 025c2eb4860de..fd4157d1d2504 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp @@ -236,8 +236,7 @@ namespace { // 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 @@ struct InitializePythonRAII { } 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 index ce9b346ae6bef..c0dbc86fb0704 100644 --- a/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp +++ b/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp @@ -473,13 +473,9 @@ static constexpr OptionDefinition g_enable_option_table[] = { 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 @@ class EnableOptions : public Options { 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.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.cpp index 6a952ff887729..2f6b36c79b802 100644 --- 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/DWARFAbbreviationDeclaration.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.h index b9e0204363c1e..378ba888f4e0f 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.h @@ -55,9 +55,9 @@ class DWARFAbbreviationDeclaration { 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/DWARFBaseDIE.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.h index 059b84864be7e..8b6268aba33ab 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.h @@ -24,7 +24,7 @@ class SymbolFileDWARF; 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 @@ class DWARFBaseDIE { 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 index 555864f449670..ec6b93ce0e7f8 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.h @@ -26,8 +26,7 @@ typedef DWARFAbbreviationDeclarationColl::const_iterator 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 @@ class DWARFAbbreviationDeclarationSet { /// @} 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 index 0ba56a0a41614..64e86c71ac09e 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h @@ -35,8 +35,7 @@ class DWARFDebugInfoEntry { 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 @@ class DWARFDebugInfoEntry { 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 index 9072b2dc0115f..c306816d186bb 100644 --- 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 @@ class DWARFDeclContext { // 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 @@ class DWARFDeclContext { 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 index 9ca4cc1c8d970..9406bcf0c0384 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h @@ -20,14 +20,14 @@ class DWARFDIE; 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.cpp b/lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp index d36f2a8bccf7f..ce71281db8bd1 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp @@ -130,8 +130,7 @@ DWARFMappedHash::DIEInfo::DIEInfo(dw_offset_t o, dw_tag_t t, uint32_t f, : 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/HashedNameToDIE.h b/lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h index ad178fc6a9876..efc08e47a2800 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h @@ -101,9 +101,9 @@ class DWARFMappedHash { /// 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/SymbolFileDWARFDebugMap.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h index 4267544a3e966..1876de09945bf 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h @@ -170,18 +170,17 @@ class SymbolFileDWARFDebugMap : public lldb_private::SymbolFile { 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 @@ class SymbolFileDWARFDebugMap : public lldb_private::SymbolFile { // 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 @@ class SymbolFileDWARFDebugMap : public lldb_private::SymbolFile { } 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 index 40240a1f2a12e..a1ac1c4a746d7 100644 --- 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 @@ class UniqueDWARFASTType { 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 index f1119a9562ea2..855604bc62b23 100644 --- a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.h +++ b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.h @@ -46,13 +46,12 @@ class AppleGetItemInfoHandler { ~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 index 20895ca146c1e..c275800b87e6d 100644 --- a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.h +++ b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.h @@ -48,16 +48,16 @@ class AppleGetPendingItemsHandler { ~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 index 0c828d782a1ac..996e7b4b85662 100644 --- a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.h +++ b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.h @@ -45,15 +45,16 @@ class AppleGetQueuesHandler { ~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 index 0f7201a0e8100..9229e540a384b 100644 --- a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.h +++ b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.h @@ -47,13 +47,12 @@ class AppleGetThreadItemInfoHandler { ~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 index 844682e53ad94..c822c7beb4bfb 100644 --- a/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.h +++ b/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.h @@ -108,14 +108,12 @@ class SystemRuntimeMacOSX : public lldb_private::SystemRuntime { 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 @@ class SystemRuntimeMacOSX : public lldb_private::SystemRuntime { }; 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 index f39dce1afaa68..ceb2047f7091c 100644 --- a/lldb/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.h +++ b/lldb/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.h @@ -45,9 +45,9 @@ class x86AssemblyInspectionEngine { /// 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 index a3907f4dd9c03..58bf8509a9589 100644 --- 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 index e6695c5008ea8..a25911d1734da 100644 --- a/lldb/source/Symbol/Symbol.cpp +++ b/lldb/source/Symbol/Symbol.cpp @@ -23,13 +23,12 @@ using namespace lldb; 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 index d20d6aa5a5d40..7703c9d9aa17d 100644 --- 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 index 78419704cfee6..5b4169d256d29 100644 --- a/lldb/source/Symbol/Type.cpp +++ b/lldb/source/Symbol/Type.cpp @@ -161,10 +161,8 @@ Type::Type(lldb::user_id_t uid, SymbolFile *symbol_file, ConstString name, } 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 index 2adf36fa82761..52ab359bad383 100644 --- a/lldb/source/Symbol/TypeSystem.cpp +++ b/lldb/source/Symbol/TypeSystem.cpp @@ -178,8 +178,7 @@ TypeSystem::CreateUtilityFunction(std::string text, std::string name) { #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 index d74c78f084afa..41bd8cd46ad83 100644 --- a/lldb/source/Symbol/UnwindPlan.cpp +++ b/lldb/source/Symbol/UnwindPlan.cpp @@ -245,9 +245,7 @@ void UnwindPlan::Row::Dump(Stream &s, const UnwindPlan *unwind_plan, } } -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 index 20932ee63dce2..b5cf13582af1c 100644 --- a/lldb/source/Target/ExecutionContext.cpp +++ b/lldb/source/Target/ExecutionContext.cpp @@ -395,8 +395,7 @@ bool ExecutionContext::HasFrameScope() const { } 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 index b22673f554712..35e0c74fb97c0 100644 --- a/lldb/source/Target/PathMappingList.cpp +++ b/lldb/source/Target/PathMappingList.cpp @@ -37,8 +37,7 @@ namespace { } } // 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 index 2c5b5d8ffae48..1449501fbe911 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -3843,9 +3843,7 @@ thread_result_t Process::RunPrivateStateThread(bool is_secondary_thread) { // 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 index 0ea9f212c6934..e5610bf588543 100644 --- a/lldb/source/Target/RegisterNumber.cpp +++ b/lldb/source/Target/RegisterNumber.cpp @@ -26,9 +26,7 @@ RegisterNumber::RegisterNumber(lldb_private::Thread &thread, } } -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 index 1f6639379c45b..ba4c3aa894553 100644 --- a/lldb/source/Target/ThreadSpec.cpp +++ b/lldb/source/Target/ThreadSpec.cpp @@ -17,9 +17,7 @@ const char *ThreadSpec::g_option_names[static_cast( 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 index 9c8f10d8c142a..e88cd23c1d84f 100644 --- a/lldb/source/Utility/DataEncoder.cpp +++ b/lldb/source/Utility/DataEncoder.cpp @@ -24,8 +24,7 @@ using namespace llvm::support::endian; // 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 index b31f44c8f7f9c..bdd79fd9b4112 100644 --- a/lldb/source/Utility/DataExtractor.cpp +++ b/lldb/source/Utility/DataExtractor.cpp @@ -120,9 +120,8 @@ static inline uint64_t ReadMaxInt64(const uint8_t *data, size_t byte_size, } 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 index 310d2b22b1744..c9759bbe513e6 100644 --- a/lldb/source/Utility/ProcessInfo.cpp +++ b/lldb/source/Utility/ProcessInfo.cpp @@ -22,8 +22,7 @@ using namespace lldb_private; 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 index 6b729dacb6e0a..e5bd2ba4b6259 100644 --- a/lldb/source/Utility/ReproducerInstrumentation.cpp +++ b/lldb/source/Utility/ReproducerInstrumentation.cpp @@ -193,8 +193,8 @@ unsigned ObjectToIndex::GetIndexForObjectImpl(const void *object) { } 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 index 02e2697488680..72fd087decc06 100644 --- a/lldb/source/Utility/Status.cpp +++ b/lldb/source/Utility/Status.cpp @@ -37,7 +37,7 @@ class raw_ostream; 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 index ea9c2dabdfa73..effe69dcca527 100644 --- a/lldb/source/Utility/Stream.cpp +++ b/lldb/source/Utility/Stream.cpp @@ -28,8 +28,8 @@ Stream::Stream(uint32_t flags, uint32_t addr_size, ByteOrder byte_order, 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 index f5d3577c4a9cb..9ebd2c94eb2fc 100644 --- a/lldb/source/Utility/StringExtractor.cpp +++ b/lldb/source/Utility/StringExtractor.cpp @@ -26,7 +26,7 @@ static inline int xdigit_to_sint(char ch) { } // StringExtractor constructor -StringExtractor::StringExtractor() : m_packet(), m_index(0) {} +StringExtractor::StringExtractor() : m_packet() {} StringExtractor::StringExtractor(llvm::StringRef packet_str) : m_packet(), m_index(0) {