This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Deobfuscate python-swigsafecast.swig
ClosedPublic

Authored by labath on Nov 18 2021, 2:53 AM.

Details

Summary

This file was way more complicated than it needed to be.

This patch removes the automagic reference-to-pointer delegation and
replaces the template specializations with regular free functions
(taking reference arguments).

The reason I chose references is twofold:

  • there are more arguments being passed by reference than by pointer
  • the reference arguments make it more obvious that there is a lot of leaking going on in there.

Currently, the code was assuming that the pointer arguments have some
kind of a special meaning and that pointer functions take ownership of
their arguments, which isn't true (it's possible it was true at some
point in the past, I haven't done the archeology).

This makes it easier to implement proper lifetime management in
follow-up patches.

Diff Detail

Event Timeline

labath requested review of this revision.Nov 18 2021, 2:53 AM
labath created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptNov 18 2021, 2:53 AM
This revision is now accepted and ready to land.Nov 18 2021, 8:31 AM
This revision was automatically updated to reflect the committed changes.