[Lldb-commits] [lldb] ffe982f - [lldb] Stop generating swig bindings for SBLaunchInfo copy constructor

Alex Langford via lldb-commits lldb-commits at lists.llvm.org
Thu Feb 16 18:33:38 PST 2023


Author: Alex Langford
Date: 2023-02-16T18:33:12-08:00
New Revision: ffe982f96bff77c1b326f5109e2dddfbcde4ca2a

URL: https://github.com/llvm/llvm-project/commit/ffe982f96bff77c1b326f5109e2dddfbcde4ca2a
DIFF: https://github.com/llvm/llvm-project/commit/ffe982f96bff77c1b326f5109e2dddfbcde4ca2a.diff

LOG: [lldb] Stop generating swig bindings for SBLaunchInfo copy constructor

Given the line
```
launch_info = lldb.SBLaunchInfo(None)
```

We see different behaviors across different versionf of swig. On some
older versions of swig (e.g. 3.0.2) this line fails because it attempts
to use the copy constructor and blows up with an invalid null reference.
On newer versions of swig, this is correctly routed to the constructor
taking a pointer.

Prior to generating the swig bindings with the API headers,
SBLaunchInfo's copy constructor was not exposed so we're effectively
going back to the old behavior anyway.

Differential Revision: https://reviews.llvm.org/D144228

Added: 
    

Modified: 
    lldb/include/lldb/API/SBLaunchInfo.h

Removed: 
    


################################################################################
diff  --git a/lldb/include/lldb/API/SBLaunchInfo.h b/lldb/include/lldb/API/SBLaunchInfo.h
index eb4f4a65833c8..ace448ed64bc2 100644
--- a/lldb/include/lldb/API/SBLaunchInfo.h
+++ b/lldb/include/lldb/API/SBLaunchInfo.h
@@ -26,7 +26,14 @@ class LLDB_API SBLaunchInfo {
 
   ~SBLaunchInfo();
 
+#ifndef SWIG
+  // The copy constructor for SBLaunchInfo presents some problems on some
+  // supported versions of swig (e.g. 3.0.2). When trying to create an
+  // SBLaunchInfo from python with the argument `None`, swig will try to call
+  // the copy constructor instead of SBLaunchInfo(const char **). For that
+  // reason, we avoid exposing the copy constructor to python.
   SBLaunchInfo(const SBLaunchInfo &rhs);
+#endif
 
   SBLaunchInfo &operator=(const SBLaunchInfo &rhs);
 


        


More information about the lldb-commits mailing list