This is an archive of the discontinued LLVM Phabricator instance.

eliminate virtual methods from PythonDataObjects
ClosedPublic

Authored by lawrence_danna on Oct 12 2019, 3:21 PM.

Details

Summary

This patch eliminates a bunch of boilerplate from
PythonDataObjects, as well as the use of virtual methods.
In my opinion it also makes the Reset logic a lot more
clear and easy to follow. The price is yet another
template. I think it's worth it.

Diff Detail

Event Timeline

lawrence_danna created this revision.Oct 12 2019, 3:21 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 12 2019, 3:21 PM
labath accepted this revision.Oct 14 2019, 2:07 AM

Yes, this definitely looks better. Ideally, I'd like to get rid of the Reset functions altogether, and just ensure we already create/return fully valid objects (probably via factory functions returning Expecteds, Optionals or whatever)..

lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
207–211

BTW, is this needed? My impression was that PythonObject was/is not convertible to a PyObject*..

This revision is now accepted and ready to land.Oct 14 2019, 2:07 AM
JDevlieghere accepted this revision.Oct 14 2019, 9:31 AM
lawrence_danna marked an inline comment as done.Oct 14 2019, 3:04 PM
lawrence_danna added inline comments.
lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
207–211

Yea it's not actually convertible, i'll remove this.

rebased, and added in explicit default constructors for MSVC's sake.

This revision was automatically updated to reflect the committed changes.