[Lldb-commits] [PATCH] D133961: [lldb] Use SWIG_fail in python-typemaps.swig (NFC)

Dave Lee via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Sep 15 11:45:56 PDT 2022


kastiglione created this revision.
kastiglione added a reviewer: JDevlieghere.
Herald added a project: All.
kastiglione requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

When attempting to use SWIG's `-builtin` flag, there were a few compile
failures caused by a mismatch between return type and return value. In those
cases, the return type was `int` but many of the type maps assume returning
`NULL`/`nullptr` (only the latter caused compile failures).

This fix abstracts failure paths to use the `SWIG_fail` macro, which performs
`goto fail;`. Each of the generated functions contain a `fail` label, which
performs any resource cleanup and returns the appropriate failure value.

This change isn't strictly necessary at this point, but seems like the right
thing to do, and for anyone who tries `-builtin` later, it resolves those
issues.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D133961

Files:
  lldb/bindings/python/python-typemaps.swig

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133961.460472.patch
Type: text/x-patch
Size: 5413 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220915/83a117c4/attachment.bin>


More information about the lldb-commits mailing list