X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=retrace.py;h=d6e838755c39a02cd6f517af2866f9d0736c6074;hb=12a22803faa06a0db229b6dfb6130a0e8156ba31;hp=15cdaf5038e328d05e8646c564670d9ffe8c13fa;hpb=ee659c84695e9f94b1f6a5f8be203dc0012ca685;p=apitrace diff --git a/retrace.py b/retrace.py index 15cdaf5..d6e8387 100644 --- a/retrace.py +++ b/retrace.py @@ -72,7 +72,7 @@ class ValueDeserializer(stdapi.Visitor): print ' const trace::Array *__a%s = dynamic_cast(&%s);' % (array.tag, rvalue) print ' if (__a%s) {' % (array.tag) length = '__a%s->values.size()' % array.tag - print ' %s = new %s[%s];' % (lvalue, array.type, length) + print ' %s = _allocator.alloc<%s>(%s);' % (lvalue, array.type, length) index = '__j' + array.tag print ' for (size_t {i} = 0; {i} < {length}; ++{i}) {{'.format(i = index, length = length) try: @@ -86,7 +86,7 @@ class ValueDeserializer(stdapi.Visitor): def visitPointer(self, pointer, lvalue, rvalue): print ' const trace::Array *__a%s = dynamic_cast(&%s);' % (pointer.tag, rvalue) print ' if (__a%s) {' % (pointer.tag) - print ' %s = new %s;' % (lvalue, pointer.type) + print ' %s = _allocator.alloc<%s>();' % (lvalue, pointer.type) try: self.visit(pointer.type, '%s[0]' % (lvalue,), '*__a%s->values[0]' % (pointer.tag,)) finally: @@ -242,6 +242,8 @@ class Retracer: # FIXME def deserializeArgs(self, function): + print ' retrace::ScopedAllocator _allocator;' + print ' (void)_allocator;' success = True for arg in function.args: arg_type = ConstRemover().visit(arg.type)