================
@@ -14,7 +14,7 @@
#include "ScriptedInterface.h"
namespace lldb_private {
-class ScriptedHookInterface : public ScriptedInterface {
+class ScriptedHookInterface : virtual public ScriptedInterface {
----------------
medismailben wrote:
> That talk didn't in fact mention that both ScriptedInterfaceBreakpoint and
> ScriptedInterfacePython (which seems more like a helper than an interface per
> se) both inherit from ScriptedInterface...
I don't think ScriptedInterfaceBreakpoint existed back then.
> I couldn't see anything in this patch that would require you have a diamond
> graph rather than two copies of the ScriptedInterface data. What required
> that?
Without the virtual inheritance, each leaf class (derived from 2 subclasses of
`ScriptedInterface`) would see each of the `ScriptedInterface` members
(`m_object_instance_sp`) & methods twice. Virtual inheritance collapses that
into a single shared `ScriptedInterface` subobject at the top of the hierarchy
so every path down to it resolves to the same instance.
https://github.com/llvm/llvm-project/pull/198153
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits