X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=wrappers%2Ftrace.py;h=4563f454f710822887ad9bd5eaa4de5606db7d4f;hb=4647f208f5a2b87391281e0f1202f66c23943bd9;hp=5d0a566f413b77119cf26ccf8b4831d038e88090;hpb=f6b0513bc280589d1c79037a1e878e68c6c35e86;p=apitrace diff --git a/wrappers/trace.py b/wrappers/trace.py index 5d0a566..4563f45 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)