forked from M-Labs/artiq
validators.escape: cache_get result lives forever.
This commit is contained in:
parent
f8e50f2b0c
commit
211af77e77
|
@ -610,8 +610,13 @@ def is_function(typ):
|
|||
def is_rpc_function(typ):
|
||||
return isinstance(typ.find(), TRPCFunction)
|
||||
|
||||
def is_c_function(typ):
|
||||
return isinstance(typ.find(), TCFunction)
|
||||
def is_c_function(typ, name=None):
|
||||
typ = typ.find()
|
||||
if name is None:
|
||||
return isinstance(typ, TCFunction)
|
||||
else:
|
||||
return isinstance(typ, TCFunction) and \
|
||||
typ.name == name
|
||||
|
||||
def is_builtin(typ, name=None):
|
||||
typ = typ.find()
|
||||
|
|
|
@ -87,7 +87,13 @@ class RegionOf(algorithm.Visitor):
|
|||
return None
|
||||
|
||||
visit_BinOpT = visit_sometimes_allocating
|
||||
visit_CallT = visit_sometimes_allocating
|
||||
|
||||
def visit_CallT(self, node):
|
||||
if types.is_c_function(node.func.type, "cache_get"):
|
||||
# The cache is borrow checked dynamically
|
||||
return None
|
||||
else:
|
||||
self.visit_sometimes_allocating(node)
|
||||
|
||||
# Value lives as long as the object/container, if it's mutable,
|
||||
# or else forever
|
||||
|
|
Loading…
Reference in New Issue