From 91688716ba49942051dccdf7b9c4f81a7ec8feaf Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Fri, 17 Jun 2022 15:03:12 -0700 Subject: [PATCH] [lldb] Fix modernize-use-equals-default warnings (NFC) Fix modernize-use-equals-default warnings. Because this check is listed in LLDB's top level .clang-tidy configuration, the check is enabled by default and the resulting warnings show up in my editor. I've audited the modified lines. This is not a blind change. --- lldb/include/lldb/Breakpoint/BreakpointOptions.h | 2 +- lldb/include/lldb/Breakpoint/WatchpointOptions.h | 2 +- lldb/include/lldb/Core/Address.h | 2 +- lldb/include/lldb/Core/DebuggerEvents.h | 2 +- lldb/include/lldb/Core/Declaration.h | 2 +- lldb/include/lldb/Core/Disassembler.h | 4 ++-- lldb/include/lldb/Core/LoadedModuleInfoList.h | 2 +- lldb/include/lldb/Core/Module.h | 2 +- lldb/include/lldb/Core/ModuleSpec.h | 4 ++-- lldb/include/lldb/Core/StructuredDataImpl.h | 2 +- lldb/include/lldb/Core/ValueObject.h | 2 +- lldb/include/lldb/DataFormatters/FormatClasses.h | 2 +- lldb/include/lldb/Host/Debug.h | 2 +- lldb/include/lldb/Symbol/CompactUnwindInfo.h | 2 +- lldb/include/lldb/Symbol/Type.h | 8 ++++---- lldb/include/lldb/Target/MemoryTagManager.h | 2 +- lldb/include/lldb/Target/Platform.h | 2 +- lldb/include/lldb/Target/Process.h | 2 +- lldb/include/lldb/Target/SectionLoadHistory.h | 2 +- lldb/include/lldb/Target/SectionLoadList.h | 2 +- lldb/include/lldb/Target/StackID.h | 4 +--- lldb/include/lldb/Target/UnwindLLDB.h | 2 +- lldb/include/lldb/Utility/GDBRemote.h | 2 +- lldb/include/lldb/Utility/ProcessInfo.h | 4 ++-- lldb/include/lldb/Utility/StringExtractorGDBRemote.h | 2 +- lldb/source/Commands/CommandObjectHelp.h | 2 +- lldb/source/Commands/CommandObjectScript.h | 2 +- lldb/source/Core/Section.cpp | 2 +- lldb/source/Symbol/SymbolFileOnDemand.cpp | 2 +- 29 files changed, 35 insertions(+), 37 deletions(-) diff --git a/lldb/include/lldb/Breakpoint/BreakpointOptions.h b/lldb/include/lldb/Breakpoint/BreakpointOptions.h index c245602..7bf5457 100644 --- a/lldb/include/lldb/Breakpoint/BreakpointOptions.h +++ b/lldb/include/lldb/Breakpoint/BreakpointOptions.h @@ -43,7 +43,7 @@ public: | eCondition | eAutoContinue) }; struct CommandData { - CommandData() {} + CommandData() = default; CommandData(const StringList &user_source, lldb::ScriptLanguage interp) : user_source(user_source), interpreter(interp), stop_on_error(true) {} diff --git a/lldb/include/lldb/Breakpoint/WatchpointOptions.h b/lldb/include/lldb/Breakpoint/WatchpointOptions.h index c5ad90c..369120e 100644 --- a/lldb/include/lldb/Breakpoint/WatchpointOptions.h +++ b/lldb/include/lldb/Breakpoint/WatchpointOptions.h @@ -166,7 +166,7 @@ public: lldb::user_id_t watch_id); struct CommandData { - CommandData() {} + CommandData() = default; ~CommandData() = default; diff --git a/lldb/include/lldb/Core/Address.h b/lldb/include/lldb/Core/Address.h index 4121f6c..b19e694 100644 --- a/lldb/include/lldb/Core/Address.h +++ b/lldb/include/lldb/Core/Address.h @@ -116,7 +116,7 @@ public: /// /// Initialize with a invalid section (NULL) and an invalid offset /// (LLDB_INVALID_ADDRESS). - Address() {} + Address() = default; /// Copy constructor /// diff --git a/lldb/include/lldb/Core/DebuggerEvents.h b/lldb/include/lldb/Core/DebuggerEvents.h index df64798..b584b62 100644 --- a/lldb/include/lldb/Core/DebuggerEvents.h +++ b/lldb/include/lldb/Core/DebuggerEvents.h @@ -57,7 +57,7 @@ public: DiagnosticEventData(Type type, std::string message, bool debugger_specific) : m_message(std::move(message)), m_type(type), m_debugger_specific(debugger_specific) {} - ~DiagnosticEventData() override {} + ~DiagnosticEventData() override = default; const std::string &GetMessage() const { return m_message; } bool IsDebuggerSpecific() const { return m_debugger_specific; } diff --git a/lldb/include/lldb/Core/Declaration.h b/lldb/include/lldb/Core/Declaration.h index 6ae21eb..4a0e904 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() {} + Declaration() = default; /// Construct with file specification, and optional line and column. /// diff --git a/lldb/include/lldb/Core/Disassembler.h b/lldb/include/lldb/Core/Disassembler.h index 87979fd..2dd1153 100644 --- a/lldb/include/lldb/Core/Disassembler.h +++ b/lldb/include/lldb/Core/Disassembler.h @@ -465,7 +465,7 @@ protected: uint32_t line = LLDB_INVALID_LINE_NUMBER; uint32_t column = 0; - SourceLine() {} + SourceLine() = default; bool operator==(const SourceLine &rhs) const { return file == rhs.file && line == rhs.line && rhs.column == column; @@ -489,7 +489,7 @@ protected: // Whether to print a blank line at the end of the source lines. bool print_source_context_end_eol = true; - SourceLinesToDisplay() {} + SourceLinesToDisplay() = default; }; // Get the function's declaration line number, hopefully a line number diff --git a/lldb/include/lldb/Core/LoadedModuleInfoList.h b/lldb/include/lldb/Core/LoadedModuleInfoList.h index 3f65ddc..6ff4565 100644 --- a/lldb/include/lldb/Core/LoadedModuleInfoList.h +++ b/lldb/include/lldb/Core/LoadedModuleInfoList.h @@ -101,7 +101,7 @@ public: lldb::addr_t m_dynamic; }; - LoadedModuleInfoList() {} + LoadedModuleInfoList() = default; void add(const LoadedModuleInfo &mod) { m_list.push_back(mod); } diff --git a/lldb/include/lldb/Core/Module.h b/lldb/include/lldb/Core/Module.h index c97abea..3805178 100644 --- a/lldb/include/lldb/Core/Module.h +++ b/lldb/include/lldb/Core/Module.h @@ -911,7 +911,7 @@ public: /// correctly. class LookupInfo { public: - LookupInfo() {} + LookupInfo() = default; LookupInfo(ConstString name, lldb::FunctionNameType name_type_mask, lldb::LanguageType language); diff --git a/lldb/include/lldb/Core/ModuleSpec.h b/lldb/include/lldb/Core/ModuleSpec.h index 5789e6c..451e347 100644 --- a/lldb/include/lldb/Core/ModuleSpec.h +++ b/lldb/include/lldb/Core/ModuleSpec.h @@ -26,7 +26,7 @@ namespace lldb_private { class ModuleSpec { public: - ModuleSpec() {} + ModuleSpec() = default; /// If the \c data argument is passed, its contents will be used /// as the module contents instead of trying to read them from @@ -274,7 +274,7 @@ protected: class ModuleSpecList { public: - ModuleSpecList() {} + ModuleSpecList() = default; ModuleSpecList(const ModuleSpecList &rhs) { std::lock_guard lhs_guard(m_mutex); diff --git a/lldb/include/lldb/Core/StructuredDataImpl.h b/lldb/include/lldb/Core/StructuredDataImpl.h index 355aa77..e755c53 100644 --- a/lldb/include/lldb/Core/StructuredDataImpl.h +++ b/lldb/include/lldb/Core/StructuredDataImpl.h @@ -25,7 +25,7 @@ namespace lldb_private { class StructuredDataImpl { public: - StructuredDataImpl() {} + StructuredDataImpl() = default; StructuredDataImpl(const StructuredDataImpl &rhs) = default; diff --git a/lldb/include/lldb/Core/ValueObject.h b/lldb/include/lldb/Core/ValueObject.h index 4a4bd4d..58a0535 100644 --- a/lldb/include/lldb/Core/ValueObject.h +++ b/lldb/include/lldb/Core/ValueObject.h @@ -795,7 +795,7 @@ protected: class ChildrenManager { public: - ChildrenManager() {} + ChildrenManager() = default; bool HasChildAtIndex(size_t idx) { std::lock_guard guard(m_mutex); diff --git a/lldb/include/lldb/DataFormatters/FormatClasses.h b/lldb/include/lldb/DataFormatters/FormatClasses.h index 2b47bcd..158d253 100644 --- a/lldb/include/lldb/DataFormatters/FormatClasses.h +++ b/lldb/include/lldb/DataFormatters/FormatClasses.h @@ -105,7 +105,7 @@ private: class TypeNameSpecifierImpl { public: - TypeNameSpecifierImpl() {} + TypeNameSpecifierImpl() = default; TypeNameSpecifierImpl(llvm::StringRef name, bool is_regex) : m_is_regex(is_regex) { diff --git a/lldb/include/lldb/Host/Debug.h b/lldb/include/lldb/Host/Debug.h index e4e4104..622b720 100644 --- a/lldb/include/lldb/Host/Debug.h +++ b/lldb/include/lldb/Host/Debug.h @@ -32,7 +32,7 @@ struct ResumeAction { // send a signal to the thread when the action is run or step. class ResumeActionList { public: - ResumeActionList() {} + ResumeActionList() = default; ResumeActionList(lldb::StateType default_action, int signal) { SetDefaultThreadActionIfNeeded(default_action, signal); diff --git a/lldb/include/lldb/Symbol/CompactUnwindInfo.h b/lldb/include/lldb/Symbol/CompactUnwindInfo.h index 5f7c228..e38d012 100644 --- a/lldb/include/lldb/Symbol/CompactUnwindInfo.h +++ b/lldb/include/lldb/Symbol/CompactUnwindInfo.h @@ -86,7 +86,7 @@ private: // valid for (start of the function) uint32_t valid_range_offset_end = 0; // the offset of the start of the next function - FunctionInfo() {} + FunctionInfo() = default; }; struct UnwindHeader { diff --git a/lldb/include/lldb/Symbol/Type.h b/lldb/include/lldb/Symbol/Type.h index 24b9492..4b512de 100644 --- a/lldb/include/lldb/Symbol/Type.h +++ b/lldb/include/lldb/Symbol/Type.h @@ -314,7 +314,7 @@ private: class TypeListImpl { public: - TypeListImpl() {} + TypeListImpl() = default; void Append(const lldb::TypeImplSP &type) { m_content.push_back(type); } @@ -345,7 +345,7 @@ private: class TypeMemberImpl { public: - TypeMemberImpl() {} + TypeMemberImpl() = default; TypeMemberImpl(const lldb::TypeImplSP &type_impl_sp, uint64_t bit_offset, ConstString name, uint32_t bitfield_bit_size = 0, @@ -437,7 +437,7 @@ private: class TypeMemberFunctionImpl { public: - TypeMemberFunctionImpl() {} + TypeMemberFunctionImpl() = default; TypeMemberFunctionImpl(const CompilerType &type, const CompilerDecl &decl, const std::string &name, @@ -502,7 +502,7 @@ protected: class TypeEnumMemberListImpl { public: - TypeEnumMemberListImpl() {} + TypeEnumMemberListImpl() = default; void Append(const lldb::TypeEnumMemberImplSP &type) { m_content.push_back(type); diff --git a/lldb/include/lldb/Target/MemoryTagManager.h b/lldb/include/lldb/Target/MemoryTagManager.h index 859c43c..28a8acc 100644 --- a/lldb/include/lldb/Target/MemoryTagManager.h +++ b/lldb/include/lldb/Target/MemoryTagManager.h @@ -144,7 +144,7 @@ public: RepeatTagsForRange(const std::vector &tags, TagRange range) const = 0; - virtual ~MemoryTagManager() {} + virtual ~MemoryTagManager() = default; }; } // namespace lldb_private diff --git a/lldb/include/lldb/Target/Platform.h b/lldb/include/lldb/Target/Platform.h index 6032008..aa09b34 100644 --- a/lldb/include/lldb/Target/Platform.h +++ b/lldb/include/lldb/Target/Platform.h @@ -945,7 +945,7 @@ private: class PlatformList { public: - PlatformList() {} + PlatformList() = default; ~PlatformList() = default; diff --git a/lldb/include/lldb/Target/Process.h b/lldb/include/lldb/Target/Process.h index c8e874f..a556592 100644 --- a/lldb/include/lldb/Target/Process.h +++ b/lldb/include/lldb/Target/Process.h @@ -112,7 +112,7 @@ protected: class ProcessAttachInfo : public ProcessInstanceInfo { public: - ProcessAttachInfo() {} + ProcessAttachInfo() = default; ProcessAttachInfo(const ProcessLaunchInfo &launch_info) : m_resume_count(0), m_wait_for_launch(false), m_ignore_existing(true), diff --git a/lldb/include/lldb/Target/SectionLoadHistory.h b/lldb/include/lldb/Target/SectionLoadHistory.h index 0240ceb..64bb828 100644 --- a/lldb/include/lldb/Target/SectionLoadHistory.h +++ b/lldb/include/lldb/Target/SectionLoadHistory.h @@ -24,7 +24,7 @@ public: eStopIDNow = UINT32_MAX }; // Constructors and Destructors - SectionLoadHistory() {} + SectionLoadHistory() = default; ~SectionLoadHistory() { // Call clear since this takes a lock and clears the section load list in diff --git a/lldb/include/lldb/Target/SectionLoadList.h b/lldb/include/lldb/Target/SectionLoadList.h index 548d44a..ac86e63 100644 --- a/lldb/include/lldb/Target/SectionLoadList.h +++ b/lldb/include/lldb/Target/SectionLoadList.h @@ -22,7 +22,7 @@ namespace lldb_private { class SectionLoadList { public: // Constructors and Destructors - SectionLoadList() {} + SectionLoadList() = default; SectionLoadList(const SectionLoadList &rhs); diff --git a/lldb/include/lldb/Target/StackID.h b/lldb/include/lldb/Target/StackID.h index 95d12df..0939279 100644 --- a/lldb/include/lldb/Target/StackID.h +++ b/lldb/include/lldb/Target/StackID.h @@ -17,9 +17,7 @@ namespace lldb_private { class StackID { public: // Constructors and Destructors - StackID() - - {} + StackID() = default; explicit StackID(lldb::addr_t pc, lldb::addr_t cfa, SymbolContextScope *symbol_scope) diff --git a/lldb/include/lldb/Target/UnwindLLDB.h b/lldb/include/lldb/Target/UnwindLLDB.h index 939226c..f80212c 100644 --- a/lldb/include/lldb/Target/UnwindLLDB.h +++ b/lldb/include/lldb/Target/UnwindLLDB.h @@ -119,7 +119,7 @@ private: RegisterContextLLDBSP reg_ctx_lldb_sp; // These are all RegisterContextUnwind's - Cursor() {} + Cursor() = default; private: Cursor(const Cursor &) = delete; diff --git a/lldb/include/lldb/Utility/GDBRemote.h b/lldb/include/lldb/Utility/GDBRemote.h index 4511816..e39bce5 100644 --- a/lldb/include/lldb/Utility/GDBRemote.h +++ b/lldb/include/lldb/Utility/GDBRemote.h @@ -55,7 +55,7 @@ struct GDBRemotePacket { enum Type { ePacketTypeInvalid = 0, ePacketTypeSend, ePacketTypeRecv }; - GDBRemotePacket() {} + GDBRemotePacket() = default; void Clear() { packet.data.clear(); diff --git a/lldb/include/lldb/Utility/ProcessInfo.h b/lldb/include/lldb/Utility/ProcessInfo.h index fc8b127..42a851f0 100644 --- a/lldb/include/lldb/Utility/ProcessInfo.h +++ b/lldb/include/lldb/Utility/ProcessInfo.h @@ -107,7 +107,7 @@ protected: // to that process. class ProcessInstanceInfo : public ProcessInfo { public: - ProcessInstanceInfo() {} + ProcessInstanceInfo() = default; ProcessInstanceInfo(const char *name, const ArchSpec &arch, lldb::pid_t pid) : ProcessInfo(name, arch, pid), m_euid(UINT32_MAX), m_egid(UINT32_MAX), @@ -162,7 +162,7 @@ typedef std::vector ProcessInstanceInfoList; class ProcessInstanceInfoMatch { public: - ProcessInstanceInfoMatch() {} + ProcessInstanceInfoMatch() = default; ProcessInstanceInfoMatch(const char *process_name, NameMatch process_name_match_type) diff --git a/lldb/include/lldb/Utility/StringExtractorGDBRemote.h b/lldb/include/lldb/Utility/StringExtractorGDBRemote.h index f10bfb1..c1bf593 100644 --- a/lldb/include/lldb/Utility/StringExtractorGDBRemote.h +++ b/lldb/include/lldb/Utility/StringExtractorGDBRemote.h @@ -23,7 +23,7 @@ public: typedef bool (*ResponseValidatorCallback)( void *baton, const StringExtractorGDBRemote &response); - StringExtractorGDBRemote() {} + StringExtractorGDBRemote() = default; StringExtractorGDBRemote(llvm::StringRef str) : StringExtractor(str), m_validator(nullptr) {} diff --git a/lldb/source/Commands/CommandObjectHelp.h b/lldb/source/Commands/CommandObjectHelp.h index 71799eb..a0ed157 100644 --- a/lldb/source/Commands/CommandObjectHelp.h +++ b/lldb/source/Commands/CommandObjectHelp.h @@ -32,7 +32,7 @@ public: class CommandOptions : public Options { public: - CommandOptions() {} + CommandOptions() = default; ~CommandOptions() override = default; diff --git a/lldb/source/Commands/CommandObjectScript.h b/lldb/source/Commands/CommandObjectScript.h index 97fc054..9d164e8 100644 --- a/lldb/source/Commands/CommandObjectScript.h +++ b/lldb/source/Commands/CommandObjectScript.h @@ -21,7 +21,7 @@ public: class CommandOptions : public Options { public: - CommandOptions() {} + CommandOptions() = default; ~CommandOptions() override = default; Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override; diff --git a/lldb/source/Core/Section.cpp b/lldb/source/Core/Section.cpp index acad3a2..50c1562 100644 --- a/lldb/source/Core/Section.cpp +++ b/lldb/source/Core/Section.cpp @@ -184,7 +184,7 @@ Section::Section(const lldb::SectionSP &parent_section_sp, m_parent_wp = parent_section_sp; } -Section::~Section() {} +Section::~Section() = default; addr_t Section::GetFileAddress() const { SectionSP parent_sp(GetParent()); diff --git a/lldb/source/Symbol/SymbolFileOnDemand.cpp b/lldb/source/Symbol/SymbolFileOnDemand.cpp index 5c2cbc7..b97bc54 100644 --- a/lldb/source/Symbol/SymbolFileOnDemand.cpp +++ b/lldb/source/Symbol/SymbolFileOnDemand.cpp @@ -22,7 +22,7 @@ SymbolFileOnDemand::SymbolFileOnDemand( std::unique_ptr &&symbol_file) : m_sym_file_impl(std::move(symbol_file)) {} -SymbolFileOnDemand::~SymbolFileOnDemand() {} +SymbolFileOnDemand::~SymbolFileOnDemand() = default; uint32_t SymbolFileOnDemand::CalculateAbilities() { // Explicitly allow ability checking to pass though. -- 2.7.4