X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;ds=sidebyside;f=wrappers%2Ftrace.py;fp=wrappers%2Ftrace.py;h=4e52cf652a661fab24931ec65508280e3d84f91e;hb=e7cb2b98575d5ff3801bd3527a648e0dbfdebdad;hp=30668365ee3fc27eded75d3f4111f64d0951b0e7;hpb=c7af8d42532f3447ea7ba5c24781a44bf010681b;p=apitrace diff --git a/wrappers/trace.py b/wrappers/trace.py index 3066836..4e52cf6 100644 --- a/wrappers/trace.py +++ b/wrappers/trace.py @@ -299,6 +299,8 @@ class ValueWrapper(stdapi.Traverser): 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) @@ -320,6 +322,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)