def visitConst(self, const):
return const.type
+ def visitAlias(self, alias):
+ type = self.visit(alias.type)
+ if type is alias.type:
+ return alias
+ return type
+
+ def visitReference(self, reference):
+ return reference.type
+
def visitOpaque(self, opaque):
return opaque
def visitLinearPointer(self, pointer, lvalue, rvalue):
print ' %s = static_cast<%s>(retrace::toPointer(%s));' % (lvalue, pointer, rvalue)
+ def visitReference(self, reference, lvalue, rvalue):
+ self.visit(reference.type, lvalue, rvalue);
+
def visitHandle(self, handle, lvalue, rvalue):
#OpaqueValueDeserializer().visit(handle.type, lvalue, rvalue);
self.visit(handle.type, lvalue, rvalue);
if pointer.size is not None:
print r' retrace::addRegion((%s).toUIntPtr(), %s, %s);' % (rvalue, lvalue, pointer.size)
+ def visitReference(self, reference, lvalue, rvalue):
+ pass
+
def visitHandle(self, handle, lvalue, rvalue):
print ' %s __orig_result;' % handle.type
OpaqueValueDeserializer().visit(handle.type, '__orig_result', rvalue);
return visitor.visitLinearPointer(self, *args, **kwargs)
+class Reference(Type):
+ '''C++ references.'''
+
+ def __init__(self, type):
+ Type.__init__(self, type.expr + " &", 'R' + type.tag)
+ self.type = type
+
+ def visit(self, visitor, *args, **kwargs):
+ return visitor.visitReference(self, *args, **kwargs)
+
+
class Handle(Type):
def __init__(self, name, type, range=None, key=None):
def visitLinearPointer(self, pointer, *args, **kwargs):
raise NotImplementedError
+ def visitReference(self, reference, *args, **kwargs):
+ raise NotImplementedError
+
def visitHandle(self, handle, *args, **kwargs):
raise NotImplementedError
type = self.visit(pointer.type)
return LinearPointer(type, pointer.size)
+ def visitReference(self, reference):
+ type = self.visit(reference.type)
+ return Reference(type)
+
def visitHandle(self, handle):
type = self.visit(handle.type)
return Handle(handle.name, type, range=handle.range, key=handle.key)
def visitLinearPointer(self, pointer):
self.visit(pointer.type)
+ def visitReference(self, reference):
+ self.visit(reference.type)
+
def visitHandle(self, handle):
self.visit(handle.type)
--- /dev/null
+s/\<__deref_out_bcount\>([^)]*)/[out]/g
+s/\<__deref_out_bcount\>([^)]*)/[out]/g
+s/\<__deref_out_bcount\>([^)]*)/[out]/g
+s/\<__field_ecount\>([^)]*)//g
+s/\<__field_ecount\>([^)]*)//g
+s/\<__field_ecount\>([^)]*)//g
+s/\<__in\>//g
+s/\<__in_bcount\>([^)]*)//g
+s/\<__in_bcount\>([^)]*)//g
+s/\<__in_ecount\>([^)]*)//g
+s/\<__in_ecount\>([^)]*)//g
+s/\<__in_ecount\>([^)]*)//g
+s/\<__in_ecount_opt\>([^)]*)//g
+s/\<__in_ecount_opt\>([^)]*)//g
+s/\<__in_ecount\>([^)]*)//g
+s/\<__in_ecount\>([^)]*)//g
+s/\<__in_opt\>//g
+s/\<__inout\>//g
+s/\<__in_z\>//g
+s/\<__in_z_opt\>//g
+s/\<__maybenull\>//g
+s/\<__notnull\>//g
+s/\<__nullterminated\>//g
+s/\<__out\>/[out]/g
+s/\<__out_bcount\>([^)]*)/[out]/g
+s/\<__out_ecount\>([^)]*)/[out]/g
+s/\<__out_ecount\>([^)]*)/[out]/g
+s/\<__out_ecount\>([^)]*)/[out]/g
+s/\<__out_ecount_opt\>([^)]*)/[out]/g
+s/\<__out_ecount_opt\>([^)]*)/[out]/g
+s/\<__out_ecount_opt\>([^)]*)/[out]/g
+s/\<__out_ecount_opt\>([^)]*)/[out]/g
+s/\<__out_ecount\>([^)]*)/[out]/g
+s/\<__out_ecount_z\>([^)]*)/[out]/g
+s/\<__out_ecount_z\>([^)]*)/[out]/g
+s/\<__out_ecount_z\>([^)]*)/[out]/g
+s/\<__out_opt\>/[out]/g
+s/\<__out_z\>/[out]/g
])
LPGUID = Pointer(GUID)
-#REFGUID = Alias("REFGUID", Pointer(GUID))
-REFGUID = Alias("REFGUID", GUID)
+REFGUID = Alias("REFGUID", Reference(GUID))
IID = Alias("IID", GUID)
-#REFIID = Alias("REFIID", Pointer(IID))
-REFIID = Alias("REFIID", IID)
+REFIID = Alias("REFIID", Reference(IID))
CLSID = Alias("CLSID", GUID)
-#REFCLSID = Alias("REFCLSID", Pointer(CLSID))
-REFCLSID = Alias("REFCLSID", CLSID)
+REFCLSID = Alias("REFCLSID", Reference(CLSID))
LUID = Struct("LUID", [
(DWORD, "LowPart"),
def visitHandle(self, handle):
self.visit(handle.type)
+ def visitReference(self, reference):
+ self.visit(reference.type)
+
def visitAlias(self, alias):
self.visit(alias.type)
def visitLinearPointer(self, pointer, instance):
print ' trace::localWriter.writeOpaque((const void *)%s);' % instance
+ def visitReference(self, reference, instance):
+ self.visit(reference.type, instance)
+
def visitHandle(self, handle, instance):
self.visit(handle.type, instance)
def visitLinearPointer(self, pointer, instance):
pass
+ def visitReference(self, reference, instance):
+ self.visit(reference.type, instance)
+
def visitHandle(self, handle, instance):
self.visit(handle.type, instance)