[lldb] Use SWIG_fail in python-typemaps.swig (NFC)
authorDave Lee <davelee.com@gmail.com>
Tue, 13 Sep 2022 00:03:08 +0000 (17:03 -0700)
committerDave Lee <davelee.com@gmail.com>
Fri, 16 Sep 2022 15:25:01 +0000 (08:25 -0700)
commit6e450d134755c41bd4ac0ba356e31fc37ba88757
tree8e040ab4fb3c2268bbb04c8685cd4d9364a9e6d3
parentef8feb63590dc4e5988194962a37d8746f8d1ac6
[lldb] Use SWIG_fail in python-typemaps.swig (NFC)

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.

Differential Revision: https://reviews.llvm.org/D133961
lldb/bindings/python/python-typemaps.swig