[all-commits] [llvm/llvm-project] 6e450d: [lldb] Use SWIG_fail in python-typemaps.swig (NFC)

Dave Lee via All-commits all-commits at lists.llvm.org
Fri Sep 16 08:25:24 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6e450d134755c41bd4ac0ba356e31fc37ba88757
      https://github.com/llvm/llvm-project/commit/6e450d134755c41bd4ac0ba356e31fc37ba88757
  Author: Dave Lee <davelee.com at gmail.com>
  Date:   2022-09-16 (Fri, 16 Sep 2022)

  Changed paths:
    M lldb/bindings/python/python-typemaps.swig

  Log Message:
  -----------
  [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




More information about the All-commits mailing list