[lldb/API] Implement the copy (assignment) constructor for SBPlatform
authorJonas Devlieghere <jonas@devlieghere.com>
Wed, 29 Jan 2020 00:13:15 +0000 (16:13 -0800)
committerJonas Devlieghere <jonas@devlieghere.com>
Wed, 29 Jan 2020 00:23:03 +0000 (16:23 -0800)
Currently the constructor is compiler generated which means it doesn't
get instrumented for the reproducers.

lldb/include/lldb/API/SBPlatform.h
lldb/source/API/SBPlatform.cpp

index 7207b2e..9e3d03e 100644 (file)
@@ -89,6 +89,10 @@ public:
 
   SBPlatform(const char *platform_name);
 
+  SBPlatform(const SBPlatform &rhs);
+
+  void operator=(const SBPlatform &rhs);
+
   ~SBPlatform();
 
   explicit operator bool() const;
index 8f98d2d..76b8515 100644 (file)
@@ -273,6 +273,19 @@ SBPlatform::SBPlatform(const char *platform_name) : m_opaque_sp() {
     m_opaque_sp = Platform::Create(ConstString(platform_name), error);
 }
 
+SBPlatform::SBPlatform(const SBPlatform &rhs) {
+  LLDB_RECORD_CONSTRUCTOR(SBPlatform, (const lldb::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);
+
+  m_opaque_sp = rhs.m_opaque_sp;
+}
+
 SBPlatform::~SBPlatform() {}
 
 bool SBPlatform::IsValid() const {
@@ -666,6 +679,8 @@ template <>
 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_CONST(bool, SBPlatform, IsValid, ());
   LLDB_REGISTER_METHOD_CONST(bool, SBPlatform, operator bool, ());
   LLDB_REGISTER_METHOD(void, SBPlatform, Clear, ());