This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Use SWIG_fail in python-typemaps.swig (NFC)
ClosedPublic

Authored by kastiglione on Sep 15 2022, 11:45 AM.

Details

Summary

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.

Diff Detail

Event Timeline

kastiglione created this revision.Sep 15 2022, 11:45 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 15 2022, 11:45 AM
kastiglione requested review of this revision.Sep 15 2022, 11:45 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 15 2022, 11:45 AM
This revision is now accepted and ready to land.Sep 15 2022, 1:16 PM
This revision was automatically updated to reflect the committed changes.