X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=wrappers%2Ftrace.py;h=cbdc0c07122e2a9ee4390263f83746a68decb107;hb=cbe34810938b91291bc46a5de5535057b869f750;hp=da61e2a9660c5319abd6e6508bb47d38e86d3344;hpb=a33d0bb7742807d710005ff8fb257d8d6aa0e8b2;p=apitrace diff --git a/wrappers/trace.py b/wrappers/trace.py index da61e2a..cbdc0c0 100644 --- a/wrappers/trace.py +++ b/wrappers/trace.py @@ -340,6 +340,8 @@ class ValueWrapper(stdapi.Traverser, ExpanderMixin): elem_type = pointer.type.mutable() if isinstance(elem_type, stdapi.Interface): self.visitInterfacePointer(elem_type, instance) + elif isinstance(elem_type, stdapi.Alias) and isinstance(elem_type.type, stdapi.Interface): + self.visitInterfacePointer(elem_type.type, instance) else: self.visitPointer(pointer, instance) @@ -361,6 +363,23 @@ class ValueUnwrapper(ValueWrapper): allocated = False + def visitStruct(self, struct, instance): + if not self.allocated: + # Argument is constant. We need to create a non const + print ' {' + print " %s * _t = static_cast<%s *>(alloca(sizeof *_t));" % (struct, struct) + print ' *_t = %s;' % (instance,) + assert instance.startswith('*') + print ' %s = _t;' % (instance[1:],) + instance = '*_t' + self.allocated = True + try: + return ValueWrapper.visitStruct(self, struct, instance) + finally: + print ' }' + else: + return ValueWrapper.visitStruct(self, struct, instance) + def visitArray(self, array, instance): if self.allocated or isinstance(instance, stdapi.Interface): return ValueWrapper.visitArray(self, array, instance)