[Lldb-commits] [PATCH] D144228: [lldb] Stop generating swig bindings for SBLaunchInfo copy constructor

Alex Langford via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Feb 16 15:42:31 PST 2023


bulbazord created this revision.
bulbazord added reviewers: saugustine, mib.
Herald added a project: All.
bulbazord requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D144228

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


Index: lldb/include/lldb/API/SBLaunchInfo.h
===================================================================
--- lldb/include/lldb/API/SBLaunchInfo.h
+++ lldb/include/lldb/API/SBLaunchInfo.h
@@ -26,7 +26,14 @@
 
   ~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);
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D144228.498178.patch
Type: text/x-patch
Size: 724 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230216/f145be86/attachment.bin>


More information about the lldb-commits mailing list