Delete unnecessary copy ctors/copy assignment operators

It's the simplest and gives the cleanest semantics.

llvm-svn: 360762
This commit is contained in:
Fangrui Song 2019-05-15 11:23:54 +00:00
parent 9de9b5e950
commit 71a44224e5
30 changed files with 3 additions and 202 deletions

View File

@ -25,12 +25,6 @@ public:
/// class.
ModuleChild(const lldb::ModuleSP &module_sp);
/// Copy constructor.
///
/// \param[in] rhs
/// A const ModuleChild class reference to copy.
ModuleChild(const ModuleChild &rhs);
/// Destructor.
~ModuleChild();

View File

@ -88,14 +88,10 @@ public:
/// The Target that provides the module list to search.
SearchFilter(const lldb::TargetSP &target_sp);
SearchFilter(const SearchFilter &rhs);
SearchFilter(const lldb::TargetSP &target_sp, unsigned char filterType);
virtual ~SearchFilter();
SearchFilter &operator=(const SearchFilter &rhs);
/// Call this method with a file spec to see if that spec passes the filter.
///
/// \param[in] spec
@ -317,12 +313,8 @@ public:
/// The Module that limits the search.
SearchFilterByModule(const lldb::TargetSP &targetSP, const FileSpec &module);
SearchFilterByModule(const SearchFilterByModule &rhs);
~SearchFilterByModule() override;
SearchFilterByModule &operator=(const SearchFilterByModule &rhs);
bool ModulePasses(const lldb::ModuleSP &module_sp) override;
bool ModulePasses(const FileSpec &spec) override;

View File

@ -22,13 +22,6 @@ class ValueObject;
// A collection of ValueObject values that
class ValueObjectList {
public:
// Constructors and Destructors
ValueObjectList();
ValueObjectList(const ValueObjectList &rhs);
~ValueObjectList();
const ValueObjectList &operator=(const ValueObjectList &rhs);
void Append(const lldb::ValueObjectSP &val_obj_sp);

View File

@ -26,12 +26,9 @@ namespace lldb_private {
class TypeSummaryOptions {
public:
TypeSummaryOptions();
TypeSummaryOptions(const TypeSummaryOptions &rhs);
~TypeSummaryOptions() = default;
TypeSummaryOptions &operator=(const TypeSummaryOptions &rhs);
lldb::LanguageType GetLanguage() const;
lldb::TypeSummaryCapping GetCapping() const;

View File

@ -61,9 +61,6 @@ public:
DWARFUnit *dwarf_cu, lldb::offset_t data_offset,
lldb::offset_t data_length);
/// Copy constructor
DWARFExpression(const DWARFExpression &rhs);
/// Destructor
virtual ~DWARFExpression();

View File

@ -45,7 +45,6 @@ public:
SocketAddress(const struct sockaddr_in &s);
SocketAddress(const struct sockaddr_in6 &s);
SocketAddress(const struct sockaddr_storage &s);
SocketAddress(const SocketAddress &rhs);
~SocketAddress();
// Operators

View File

@ -82,14 +82,6 @@ public:
LineEntry *line_entry = nullptr,
Symbol *symbol = nullptr);
/// Copy constructor
///
/// Makes a copy of the another SymbolContext object \a rhs.
///
/// \param[in] rhs
/// A const SymbolContext object reference to copy.
SymbolContext(const SymbolContext &rhs);
~SymbolContext();
/// Assignment operator.

View File

@ -102,10 +102,6 @@ public:
// they get an error.
Type();
Type(const Type &rhs);
const Type &operator=(const Type &rhs);
void Dump(Stream *s, bool show_context);
void DumpTypeName(Stream *s);
@ -240,12 +236,10 @@ protected:
class TypeImpl {
public:
TypeImpl();
TypeImpl() = default;
~TypeImpl() {}
TypeImpl(const TypeImpl &rhs);
TypeImpl(const lldb::TypeSP &type_sp);
TypeImpl(const CompilerType &compiler_type);
@ -262,8 +256,6 @@ public:
void SetType(const CompilerType &compiler_type, const CompilerType &dynamic);
TypeImpl &operator=(const TypeImpl &rhs);
bool operator==(const TypeImpl &rhs) const;
bool operator!=(const TypeImpl &rhs) const;
@ -481,9 +473,7 @@ public:
TypeEnumMemberImpl(const lldb::TypeImplSP &integer_type_sp,
ConstString name, const llvm::APSInt &value);
TypeEnumMemberImpl(const TypeEnumMemberImpl &rhs)
: m_integer_type_sp(rhs.m_integer_type_sp), m_name(rhs.m_name),
m_value(rhs.m_value), m_valid(rhs.m_valid) {}
TypeEnumMemberImpl(const TypeEnumMemberImpl &rhs) = default;
TypeEnumMemberImpl &operator=(const TypeEnumMemberImpl &rhs);

View File

@ -34,10 +34,6 @@ class ThreadSpec {
public:
ThreadSpec();
ThreadSpec(const ThreadSpec &rhs);
const ThreadSpec &operator=(const ThreadSpec &rhs);
static std::unique_ptr<ThreadSpec>
CreateFromStructuredData(const StructuredData::Dictionary &data_dict,
Status &error);

View File

@ -42,8 +42,6 @@ public:
BroadcastEventSpec(ConstString broadcaster_class, uint32_t event_bits)
: m_broadcaster_class(broadcaster_class), m_event_bits(event_bits) {}
BroadcastEventSpec(const BroadcastEventSpec &rhs);
~BroadcastEventSpec() = default;
ConstString GetBroadcasterClass() const { return m_broadcaster_class; }

View File

@ -66,7 +66,6 @@ public:
explicit Status(const char *format, ...)
__attribute__((format(printf, 2, 3)));
Status(const Status &rhs);
/// Assignment operator.
///
/// \param[in] err

View File

@ -23,12 +23,8 @@ public:
StringExtractor();
StringExtractor(llvm::StringRef packet_str);
StringExtractor(const char *packet_cstr);
StringExtractor(const StringExtractor &rhs);
virtual ~StringExtractor();
// Operators
const StringExtractor &operator=(const StringExtractor &rhs);
void Reset(llvm::StringRef str) {
m_packet = str;
m_index = 0;

View File

@ -24,8 +24,6 @@ public:
StringLexer(std::string s);
StringLexer(const StringLexer &rhs);
// These APIs are not bounds-checked. Use HasAtLeast() if you're not sure.
Character Peek();

View File

@ -13,9 +13,6 @@ using namespace lldb_private;
ModuleChild::ModuleChild(const lldb::ModuleSP &module_sp)
: m_module_wp(module_sp) {}
ModuleChild::ModuleChild(const ModuleChild &rhs)
: m_module_wp(rhs.m_module_wp) {}
ModuleChild::~ModuleChild() {}
const ModuleChild &ModuleChild::operator=(const ModuleChild &rhs) {

View File

@ -72,10 +72,6 @@ void Searcher::GetDescription(Stream *s) {}
SearchFilter::SearchFilter(const TargetSP &target_sp, unsigned char filterType)
: m_target_sp(target_sp), SubclassID(filterType) {}
SearchFilter::SearchFilter(const SearchFilter &rhs) = default;
SearchFilter &SearchFilter::operator=(const SearchFilter &rhs) = default;
SearchFilter::~SearchFilter() = default;
SearchFilterSP SearchFilter::CreateFromStructuredData(
@ -404,16 +400,6 @@ SearchFilterByModule::SearchFilterByModule(const lldb::TargetSP &target_sp,
const FileSpec &module)
: SearchFilter(target_sp, FilterTy::ByModule), m_module_spec(module) {}
SearchFilterByModule::SearchFilterByModule(const SearchFilterByModule &rhs) =
default;
SearchFilterByModule &SearchFilterByModule::
operator=(const SearchFilterByModule &rhs) {
m_target_sp = rhs.m_target_sp;
m_module_spec = rhs.m_module_spec;
return *this;
}
SearchFilterByModule::~SearchFilterByModule() = default;
bool SearchFilterByModule::ModulePasses(const ModuleSP &module_sp) {

View File

@ -17,13 +17,6 @@
using namespace lldb;
using namespace lldb_private;
ValueObjectList::ValueObjectList() : m_value_objects() {}
ValueObjectList::ValueObjectList(const ValueObjectList &rhs)
: m_value_objects(rhs.m_value_objects) {}
ValueObjectList::~ValueObjectList() {}
const ValueObjectList &ValueObjectList::operator=(const ValueObjectList &rhs) {
if (this != &rhs)
m_value_objects = rhs.m_value_objects;

View File

@ -29,16 +29,6 @@ using namespace lldb_private;
TypeSummaryOptions::TypeSummaryOptions()
: m_lang(eLanguageTypeUnknown), m_capping(eTypeSummaryCapped) {}
TypeSummaryOptions::TypeSummaryOptions(const TypeSummaryOptions &rhs)
: m_lang(rhs.m_lang), m_capping(rhs.m_capping) {}
TypeSummaryOptions &TypeSummaryOptions::
operator=(const TypeSummaryOptions &rhs) {
m_lang = rhs.m_lang;
m_capping = rhs.m_capping;
return *this;
}
lldb::LanguageType TypeSummaryOptions::GetLanguage() const { return m_lang; }
lldb::TypeSummaryCapping TypeSummaryOptions::GetCapping() const {

View File

@ -55,11 +55,6 @@ DWARFExpression::DWARFExpression(DWARFUnit *dwarf_cu)
: m_module_wp(), m_data(), m_dwarf_cu(dwarf_cu),
m_reg_kind(eRegisterKindDWARF), m_loclist_slide(LLDB_INVALID_ADDRESS) {}
DWARFExpression::DWARFExpression(const DWARFExpression &rhs)
: m_module_wp(rhs.m_module_wp), m_data(rhs.m_data),
m_dwarf_cu(rhs.m_dwarf_cu), m_reg_kind(rhs.m_reg_kind),
m_loclist_slide(rhs.m_loclist_slide) {}
DWARFExpression::DWARFExpression(lldb::ModuleSP module_sp,
const DataExtractor &data,
DWARFUnit *dwarf_cu,

View File

@ -92,10 +92,6 @@ SocketAddress::SocketAddress(const struct addrinfo *addr_info) {
*this = addr_info;
}
// SocketAddress copy constructor
SocketAddress::SocketAddress(const SocketAddress &rhs)
: m_socket_addr(rhs.m_socket_addr) {}
// Destructor
SocketAddress::~SocketAddress() {}

View File

@ -47,11 +47,6 @@ SymbolContext::SymbolContext(const TargetSP &t, const ModuleSP &m,
line_entry = *le;
}
SymbolContext::SymbolContext(const SymbolContext &rhs)
: target_sp(rhs.target_sp), module_sp(rhs.module_sp),
comp_unit(rhs.comp_unit), function(rhs.function), block(rhs.block),
line_entry(rhs.line_entry), symbol(rhs.symbol), variable(rhs.variable) {}
SymbolContext::SymbolContext(SymbolContextScope *sc_scope)
: target_sp(), module_sp(), comp_unit(nullptr), function(nullptr),
block(nullptr), line_entry(), symbol(nullptr), variable(nullptr) {

View File

@ -138,15 +138,6 @@ Type::Type()
m_flags.is_complete_objc_class = false;
}
Type::Type(const Type &rhs)
: std::enable_shared_from_this<Type>(rhs), UserID(rhs), m_name(rhs.m_name),
m_symbol_file(rhs.m_symbol_file), m_context(rhs.m_context),
m_encoding_type(rhs.m_encoding_type), m_encoding_uid(rhs.m_encoding_uid),
m_encoding_uid_type(rhs.m_encoding_uid_type),
m_byte_size(rhs.m_byte_size),
m_byte_size_has_value(rhs.m_byte_size_has_value), m_decl(rhs.m_decl),
m_compiler_type(rhs.m_compiler_type), m_flags(rhs.m_flags) {}
void Type::GetDescription(Stream *s, lldb::DescriptionLevel level,
bool show_name) {
*s << "id = " << (const UserID &)*this;
@ -760,12 +751,6 @@ bool TypeAndOrName::HasCompilerType() const {
return m_compiler_type.IsValid();
}
TypeImpl::TypeImpl() : m_module_wp(), m_static_type(), m_dynamic_type() {}
TypeImpl::TypeImpl(const TypeImpl &rhs)
: m_module_wp(rhs.m_module_wp), m_static_type(rhs.m_static_type),
m_dynamic_type(rhs.m_dynamic_type) {}
TypeImpl::TypeImpl(const lldb::TypeSP &type_sp)
: m_module_wp(), m_static_type(), m_dynamic_type() {
SetType(type_sp);
@ -815,15 +800,6 @@ void TypeImpl::SetType(const CompilerType &compiler_type,
m_dynamic_type = dynamic;
}
TypeImpl &TypeImpl::operator=(const TypeImpl &rhs) {
if (rhs != *this) {
m_module_wp = rhs.m_module_wp;
m_static_type = rhs.m_static_type;
m_dynamic_type = rhs.m_dynamic_type;
}
return *this;
}
bool TypeImpl::CheckModule(lldb::ModuleSP &module_sp) const {
// Check if we have a module for this type. If we do and the shared pointer
// is can be successfully initialized with m_module_wp, return true. Else

View File

@ -21,18 +21,6 @@ ThreadSpec::ThreadSpec()
: m_index(UINT32_MAX), m_tid(LLDB_INVALID_THREAD_ID), m_name(),
m_queue_name() {}
ThreadSpec::ThreadSpec(const ThreadSpec &rhs)
: m_index(rhs.m_index), m_tid(rhs.m_tid), m_name(rhs.m_name),
m_queue_name(rhs.m_queue_name) {}
const ThreadSpec &ThreadSpec::operator=(const ThreadSpec &rhs) {
m_index = rhs.m_index;
m_tid = rhs.m_tid;
m_name = rhs.m_name;
m_queue_name = rhs.m_queue_name;
return *this;
}
std::unique_ptr<ThreadSpec> ThreadSpec::CreateFromStructuredData(
const StructuredData::Dictionary &spec_dict, Status &error) {
uint32_t index = UINT32_MAX;

View File

@ -316,8 +316,6 @@ ConstString &Broadcaster::GetBroadcasterClass() const {
return class_name;
}
BroadcastEventSpec::BroadcastEventSpec(const BroadcastEventSpec &rhs) = default;
bool BroadcastEventSpec::operator<(const BroadcastEventSpec &rhs) const {
if (GetBroadcasterClass() == rhs.GetBroadcasterClass()) {
return GetEventBits() < rhs.GetEventBits();

View File

@ -47,8 +47,6 @@ Status::Status(std::error_code EC)
: m_code(EC.value()), m_type(ErrorType::eErrorTypeGeneric),
m_string(EC.message()) {}
Status::Status(const Status &rhs) = default;
Status::Status(const char *format, ...)
: m_code(0), m_type(eErrorTypeInvalid), m_string() {
va_list args;

View File

@ -38,19 +38,6 @@ StringExtractor::StringExtractor(const char *packet_cstr)
m_packet.assign(packet_cstr);
}
// StringExtractor copy constructor
StringExtractor::StringExtractor(const StringExtractor &rhs)
: m_packet(rhs.m_packet), m_index(rhs.m_index) {}
// StringExtractor assignment operator
const StringExtractor &StringExtractor::operator=(const StringExtractor &rhs) {
if (this != &rhs) {
m_packet = rhs.m_packet;
m_index = rhs.m_index;
}
return *this;
}
// Destructor
StringExtractor::~StringExtractor() {}

View File

@ -15,9 +15,6 @@ using namespace lldb_utility;
StringLexer::StringLexer(std::string s) : m_data(s), m_position(0) {}
StringLexer::StringLexer(const StringLexer &rhs)
: m_data(rhs.m_data), m_position(rhs.m_position) {}
StringLexer::Character StringLexer::Peek() { return m_data[m_position]; }
bool StringLexer::NextIf(Character c) {

View File

@ -13,11 +13,6 @@ using namespace ptdecoder;
using namespace ptdecoder_private;
// PTInstruction class member functions definitions
PTInstruction::PTInstruction() : m_opaque_sp() {}
PTInstruction::PTInstruction(const PTInstruction &insn)
: m_opaque_sp(insn.m_opaque_sp) {}
PTInstruction::PTInstruction(
const std::shared_ptr<ptdecoder_private::Instruction> &ptr)
: m_opaque_sp(ptr) {}
@ -41,13 +36,6 @@ bool PTInstruction::GetSpeculative() const {
}
// PTInstructionList class member functions definitions
PTInstructionList::PTInstructionList() : m_opaque_sp() {}
PTInstructionList::PTInstructionList(const PTInstructionList &insn_list)
: m_opaque_sp(insn_list.m_opaque_sp) {}
PTInstructionList::~PTInstructionList() {}
size_t PTInstructionList::GetSize() const {
return (m_opaque_sp ? m_opaque_sp->GetSize() : 0);
}

View File

@ -36,9 +36,7 @@ namespace ptdecoder {
/// context.
class PTInstruction {
public:
PTInstruction();
PTInstruction(const PTInstruction &insn);
PTInstruction() = default;
PTInstruction(const std::shared_ptr<ptdecoder_private::Instruction> &ptr);
@ -82,12 +80,6 @@ private:
/// type PTInstruction.
class PTInstructionList {
public:
PTInstructionList();
PTInstructionList(const PTInstructionList &insn_list);
~PTInstructionList();
// Get number of instructions in the list
size_t GetSize() const;

View File

@ -22,19 +22,6 @@ MemoryStats::MemoryStats(mach_vm_size_t virtual_size,
: m_virtual_size(virtual_size), m_resident_size(resident_size),
m_max_resident_size(max_resident_size) {}
MemoryStats::MemoryStats(const MemoryStats &rhs)
: m_virtual_size(rhs.m_virtual_size), m_resident_size(rhs.m_resident_size),
m_max_resident_size(rhs.m_max_resident_size) {}
MemoryStats &MemoryStats::operator=(const MemoryStats &rhs) {
if (this != &rhs) {
m_virtual_size = rhs.m_virtual_size;
m_resident_size = rhs.m_resident_size;
m_max_resident_size = rhs.m_max_resident_size;
}
return *this;
}
MemoryStats &MemoryStats::operator+=(const MemoryStats &rhs) {
m_virtual_size += rhs.m_virtual_size;
m_resident_size += rhs.m_resident_size;

View File

@ -20,9 +20,6 @@ class MemoryStats {
public:
MemoryStats(mach_vm_size_t virtual_size = 0, mach_vm_size_t resident_size = 0,
mach_vm_size_t max_resident_size = 0);
MemoryStats(const MemoryStats &rhs);
MemoryStats &operator=(const MemoryStats &rhs);
MemoryStats &operator+=(const MemoryStats &rhs);