Skip to content

Commit aee66d3

Browse files
committed
PROOF: add unique-pointer predicate
1 parent 4d8a418 commit aee66d3

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

chc/proof/CPOPredicate.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@
9494
'ub': 'upper-bound',
9595
'uio': 'uint-overflow',
9696
'uiu': 'uint-underflow',
97+
'up': 'unique-pointer',
9798
'va': 'var-args',
9899
'vc': 'value-constraint',
99100
'vm': 'valid-mem',
@@ -297,6 +298,10 @@ def is_stack_address_escape(self) -> bool:
297298
def is_type_at_offset(self) -> bool:
298299
return False
299300

301+
@property
302+
def is_unique_pointer(self) -> bool:
303+
return False
304+
300305
@property
301306
def is_upper_bound(self) -> bool:
302307
return False
@@ -2182,6 +2187,29 @@ def __str__(self) -> str:
21822187
return "value-constraint(" + str(self.exp) + ")"
21832188

21842189

2190+
@pdregistry.register_tag("up", CPOPredicate)
2191+
class CPOUniquePointer(CPOPredicate):
2192+
2193+
def __init__(
2194+
self, pd: "CFilePredicateDictionary", ixval: IT.IndexedTableValue
2195+
) -> None:
2196+
CPOPredicate.__init__(self, pd, ixval)
2197+
2198+
@property
2199+
def exp(self) -> "CExp":
2200+
return self.cd.get_exp(self.args[0])
2201+
2202+
@property
2203+
def is_unique_pointer(self) -> bool:
2204+
return True
2205+
2206+
def has_variable(self, vid: int) -> bool:
2207+
return self.exp.has_variable(vid)
2208+
2209+
def __str__(self) -> str:
2210+
return "unique-pointer(" + str(self.exp) + ")"
2211+
2212+
21852213
@pdregistry.register_tag("prm", CPOPredicate)
21862214
class CPOPreservedAllMemory(CPOPredicate):
21872215
"""preserves-all-memory(): true of a function that does not free any memory.

0 commit comments

Comments
 (0)