Skip to content
Snippets Groups Projects
Commit 9494c510 authored by Jonas Devlieghere's avatar Jonas Devlieghere
Browse files

[lldb] Use C++11 default member initializers

This converts a default constructor's member initializers into C++11
default member initializers. This patch was automatically generated with
clang-tidy and the modernize-use-default-member-init check.

$ run-clang-tidy.py -header-filter='lldb' -checks='-*,modernize-use-default-member-init' -fix

This is a mass-refactoring patch and this commit will be added to
.git-blame-ignore-revs.

Differential revision: https://reviews.llvm.org/D103483
parent 9b496c23
No related branches found
No related tags found
No related merge requests found
Showing
with 48 additions and 44 deletions
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'
......@@ -87,7 +87,7 @@ private:
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
......
......@@ -77,7 +77,7 @@ protected:
private:
lldb::BroadcasterSP m_opaque_sp;
lldb_private::Broadcaster *m_opaque_ptr;
lldb_private::Broadcaster *m_opaque_ptr = nullptr;
};
} // namespace lldb
......
......@@ -75,8 +75,8 @@ private:
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
......
......@@ -87,7 +87,7 @@ private:
void reset(lldb_private::CompileUnit *lldb_object_ptr);
lldb_private::CompileUnit *m_opaque_ptr;
lldb_private::CompileUnit *m_opaque_ptr = nullptr;
};
} // namespace lldb
......
......@@ -79,7 +79,7 @@ protected:
private:
mutable lldb::EventSP m_event_sp;
mutable lldb_private::Event *m_opaque_ptr;
mutable lldb_private::Event *m_opaque_ptr = nullptr;
};
} // namespace lldb
......
......@@ -74,7 +74,7 @@ private:
SBFunction(lldb_private::Function *lldb_object_ptr);
lldb_private::Function *m_opaque_ptr;
lldb_private::Function *m_opaque_ptr = nullptr;
};
} // namespace lldb
......
......@@ -100,7 +100,7 @@ private:
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
......
......@@ -105,7 +105,7 @@ private:
SBStream(const SBStream &) = delete;
const SBStream &operator=(const SBStream &) = delete;
std::unique_ptr<lldb_private::Stream> m_opaque_up;
bool m_is_file;
bool m_is_file = false;
};
} // namespace lldb
......
......@@ -78,7 +78,7 @@ private:
void SetSymbol(lldb_private::Symbol *lldb_object_ptr);
lldb_private::Symbol *m_opaque_ptr;
lldb_private::Symbol *m_opaque_ptr = nullptr;
};
} // namespace lldb
......
......@@ -43,9 +43,7 @@ public:
| 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 @@ public:
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 {
......
......@@ -33,7 +33,7 @@ public:
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
......
......@@ -37,13 +37,14 @@ public:
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
......
......@@ -198,7 +198,7 @@ protected:
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
......
......@@ -166,13 +166,13 @@ public:
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<CommandData> {
......@@ -191,7 +191,7 @@ private:
// 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<ThreadSpec>
m_thread_spec_up; // Thread for which this watchpoint will take
};
......
......@@ -116,7 +116,7 @@ public:
///
/// 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 @@ public:
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
......
......@@ -239,7 +239,7 @@ public:
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);
......
......@@ -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 @@ protected:
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);
......
......@@ -454,10 +454,10 @@ protected:
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 @@ protected:
// 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
......
......@@ -182,8 +182,8 @@ public:
} 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 @@ public:
uint32_t isa;
} info;
Context() : type(eContextInvalid), info_type(eInfoTypeNoArgs) {}
Context() {}
void SetRegisterPlusOffset(RegisterInfo base_reg, int64_t signed_offset) {
info_type = eInfoTypeRegisterPlusOffset;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment