Author: Jonas Devlieghere Date: 2020-01-28T17:11:12-08:00 New Revision: ede5cd9a45bd12c0676da80472e629801faa37bf
URL: https://github.com/llvm/llvm-project/commit/ede5cd9a45bd12c0676da80472e629801faa37bf DIFF: https://github.com/llvm/llvm-project/commit/ede5cd9a45bd12c0676da80472e629801faa37bf.diff LOG: [lldb/API] Fix bogus copy assignment operator The copy assignment operator is supposed to return the class and not void. Fix the methods and the reproducer instrumentation macros. Added: Modified: lldb/include/lldb/API/SBLaunchInfo.h lldb/include/lldb/API/SBPlatform.h lldb/source/API/SBLaunchInfo.cpp lldb/source/API/SBPlatform.cpp Removed: ################################################################################ diff --git a/lldb/include/lldb/API/SBLaunchInfo.h b/lldb/include/lldb/API/SBLaunchInfo.h index eef6bc78e5f2..d78106abf0c7 100644 --- a/lldb/include/lldb/API/SBLaunchInfo.h +++ b/lldb/include/lldb/API/SBLaunchInfo.h @@ -28,7 +28,7 @@ class LLDB_API SBLaunchInfo { SBLaunchInfo(const SBLaunchInfo &rhs); - void operator=(const SBLaunchInfo &rhs); + SBLaunchInfo &operator=(const SBLaunchInfo &rhs); lldb::pid_t GetProcessID(); diff --git a/lldb/include/lldb/API/SBPlatform.h b/lldb/include/lldb/API/SBPlatform.h index 9e3d03e9a84f..533bb4dce78a 100644 --- a/lldb/include/lldb/API/SBPlatform.h +++ b/lldb/include/lldb/API/SBPlatform.h @@ -28,7 +28,7 @@ class LLDB_API SBPlatformConnectOptions { ~SBPlatformConnectOptions(); - void operator=(const SBPlatformConnectOptions &rhs); + SBPlatformConnectOptions &operator=(const SBPlatformConnectOptions &rhs); const char *GetURL(); @@ -55,6 +55,8 @@ class LLDB_API SBPlatformShellCommand { SBPlatformShellCommand(const SBPlatformShellCommand &rhs); + SBPlatformShellCommand &operator=(const SBPlatformShellCommand &rhs); + ~SBPlatformShellCommand(); void Clear(); @@ -91,7 +93,7 @@ class LLDB_API SBPlatform { SBPlatform(const SBPlatform &rhs); - void operator=(const SBPlatform &rhs); + SBPlatform &operator=(const SBPlatform &rhs); ~SBPlatform(); diff --git a/lldb/source/API/SBLaunchInfo.cpp b/lldb/source/API/SBLaunchInfo.cpp index 9e7159995cc4..9e69b53bb3f8 100644 --- a/lldb/source/API/SBLaunchInfo.cpp +++ b/lldb/source/API/SBLaunchInfo.cpp @@ -49,11 +49,12 @@ SBLaunchInfo::SBLaunchInfo(const SBLaunchInfo &rhs) { m_opaque_sp = rhs.m_opaque_sp; } -void SBLaunchInfo::operator=(const SBLaunchInfo &rhs) { - LLDB_RECORD_METHOD(void, SBLaunchInfo, operator=,(const lldb::SBLaunchInfo &), - rhs); +SBLaunchInfo &SBLaunchInfo::operator=(const SBLaunchInfo &rhs) { + LLDB_RECORD_METHOD(SBLaunchInfo &, + SBLaunchInfo, operator=,(const lldb::SBLaunchInfo &), rhs); m_opaque_sp = rhs.m_opaque_sp; + return LLDB_RECORD_RESULT(*this); } SBLaunchInfo::~SBLaunchInfo() {} @@ -336,7 +337,7 @@ template <> void RegisterMethods<SBLaunchInfo>(Registry &R) { LLDB_REGISTER_CONSTRUCTOR(SBLaunchInfo, (const char **)); LLDB_REGISTER_CONSTRUCTOR(SBLaunchInfo, (const lldb::SBLaunchInfo &)); - LLDB_REGISTER_METHOD(void, + LLDB_REGISTER_METHOD(SBLaunchInfo &, SBLaunchInfo, operator=,(const lldb::SBLaunchInfo &)); LLDB_REGISTER_METHOD(lldb::pid_t, SBLaunchInfo, GetProcessID, ()); LLDB_REGISTER_METHOD(uint32_t, SBLaunchInfo, GetUserID, ()); diff --git a/lldb/source/API/SBPlatform.cpp b/lldb/source/API/SBPlatform.cpp index 76b851517e36..2603ac728065 100644 --- a/lldb/source/API/SBPlatform.cpp +++ b/lldb/source/API/SBPlatform.cpp @@ -80,14 +80,16 @@ SBPlatformConnectOptions::SBPlatformConnectOptions( SBPlatformConnectOptions::~SBPlatformConnectOptions() { delete m_opaque_ptr; } -void SBPlatformConnectOptions::operator=(const SBPlatformConnectOptions &rhs) { +SBPlatformConnectOptions &SBPlatformConnectOptions:: +operator=(const SBPlatformConnectOptions &rhs) { LLDB_RECORD_METHOD( - void, + SBPlatformConnectOptions &, SBPlatformConnectOptions, operator=,( const lldb::SBPlatformConnectOptions &), rhs); *m_opaque_ptr = *rhs.m_opaque_ptr; + return LLDB_RECORD_RESULT(*this); } const char *SBPlatformConnectOptions::GetURL() { @@ -174,6 +176,18 @@ SBPlatformShellCommand::SBPlatformShellCommand( *m_opaque_ptr = *rhs.m_opaque_ptr; } +SBPlatformShellCommand &SBPlatformShellCommand:: +operator=(const SBPlatformShellCommand &rhs) { + + LLDB_RECORD_METHOD( + SBPlatformShellCommand &, + SBPlatformShellCommand, operator=,(const lldb::SBPlatformShellCommand &), + rhs); + + *m_opaque_ptr = *rhs.m_opaque_ptr; + return LLDB_RECORD_RESULT(*this); +} + SBPlatformShellCommand::~SBPlatformShellCommand() { delete m_opaque_ptr; } void SBPlatformShellCommand::Clear() { @@ -279,11 +293,12 @@ SBPlatform::SBPlatform(const SBPlatform &rhs) { m_opaque_sp = rhs.m_opaque_sp; } -void SBPlatform::operator=(const SBPlatform &rhs) { - LLDB_RECORD_METHOD(void, SBPlatform, operator=,(const lldb::SBPlatform &), - rhs); +SBPlatform &SBPlatform::operator=(const SBPlatform &rhs) { + LLDB_RECORD_METHOD(SBPlatform &, + SBPlatform, operator=,(const lldb::SBPlatform &), rhs); m_opaque_sp = rhs.m_opaque_sp; + return LLDB_RECORD_RESULT(*this); } SBPlatform::~SBPlatform() {} @@ -637,7 +652,7 @@ void RegisterMethods<SBPlatformConnectOptions>(Registry &R) { LLDB_REGISTER_CONSTRUCTOR(SBPlatformConnectOptions, (const lldb::SBPlatformConnectOptions &)); LLDB_REGISTER_METHOD( - void, + SBPlatformConnectOptions &, SBPlatformConnectOptions, operator=,( const lldb::SBPlatformConnectOptions &)); LLDB_REGISTER_METHOD(const char *, SBPlatformConnectOptions, GetURL, ()); @@ -658,6 +673,9 @@ void RegisterMethods<SBPlatformShellCommand>(Registry &R) { LLDB_REGISTER_CONSTRUCTOR(SBPlatformShellCommand, (const char *)); LLDB_REGISTER_CONSTRUCTOR(SBPlatformShellCommand, (const lldb::SBPlatformShellCommand &)); + LLDB_REGISTER_METHOD( + SBPlatformShellCommand &, + SBPlatformShellCommand, operator=,(const lldb::SBPlatformShellCommand &)); LLDB_REGISTER_METHOD(void, SBPlatformShellCommand, Clear, ()); LLDB_REGISTER_METHOD(const char *, SBPlatformShellCommand, GetCommand, ()); LLDB_REGISTER_METHOD(void, SBPlatformShellCommand, SetCommand, @@ -680,7 +698,8 @@ void RegisterMethods<SBPlatform>(Registry &R) { LLDB_REGISTER_CONSTRUCTOR(SBPlatform, ()); LLDB_REGISTER_CONSTRUCTOR(SBPlatform, (const char *)); LLDB_REGISTER_CONSTRUCTOR(SBPlatform, (const lldb::SBPlatform &)); - LLDB_REGISTER_METHOD(void, SBPlatform, operator=,(const lldb::SBPlatform &)); + LLDB_REGISTER_METHOD(SBPlatform &, + SBPlatform, operator=,(const lldb::SBPlatform &)); LLDB_REGISTER_METHOD_CONST(bool, SBPlatform, IsValid, ()); LLDB_REGISTER_METHOD_CONST(bool, SBPlatform, operator bool, ()); LLDB_REGISTER_METHOD(void, SBPlatform, Clear, ()); _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits