66
77 Copyright (c) 2005-2019 Kestrel Technology LLC
88 Copyright (c) 2020-2023 Henny B. Sipma
9- Copyright (c) 2024 Aarno Labs LLC
9+ Copyright (c) 2024-2025 Aarno Labs LLC
1010
1111 Permission is hereby granted, free of charge, to any person obtaining a copy
1212 of this software and associated documentation files (the "Software"), to deal
@@ -60,6 +60,7 @@ let po_predicate_tag p =
6060 | PIndexLowerBound _ -> " index-lower-bound"
6161 | PIndexUpperBound _ -> " index-upper-bound"
6262 | PInitialized _ -> " initialized"
63+ | PLocallyInitialized _ -> " locally-initialized"
6364 | PInitializedRange _ -> " initialized-range"
6465 | PInScope _ -> " in-scope"
6566 | PIntOverflow _ -> " int-overflow"
@@ -92,12 +93,16 @@ let po_predicate_tag p =
9293 | PValidMem _ -> " valid-mem"
9394 | PPreservedAllMemory -> " preserved-all-memory"
9495 | PPreservedAllMemoryX _ -> " preserved-all-memory-x"
96+ | POutputParameterInitialized _ -> " outputparameter-initialized"
97+ | POutputParameterUnaltered _ -> " outputparameter-unaltered"
9598 | _ -> " misc"
9699
97100
98101class po_predicate_walker_t =
99102object (self )
100103
104+ method walk_varinfo (_index : int ) (_v : varinfo ) = ()
105+
101106 method walk_exp (_index :int ) (_e :exp ) = ()
102107
103108 method walk_type (_index :int ) (_t :typ ) = ()
@@ -119,6 +124,7 @@ object (self)
119124 let we = self#walk_exp in
120125 let wt = self#walk_type in
121126 let wl = self#walk_lval in
127+ let wv = self#walk_varinfo in
122128 match p with
123129 | PNotNull e | PNull e | PValidMem e | PInScope e
124130 | PControlledResource (_, e)
@@ -138,6 +144,11 @@ object (self)
138144 we 2 e2
139145 end
140146 | PInitialized l -> wl 1 l
147+ | PLocallyInitialized (v , l ) ->
148+ begin
149+ wv 1 v;
150+ wl 2 l;
151+ end
141152 | PStackAddressEscape (None,e ) -> we 2 e
142153 | PStackAddressEscape (Some l ,e ) ->
143154 begin
@@ -235,6 +246,8 @@ object (self)
235246 | PPreservedAllMemory -> ()
236247 | PPreservedAllMemoryX l -> List. iteri (fun i e -> we (i+ 1 ) e) l
237248 | PContractObligation _ -> ()
249+ | POutputParameterInitialized v -> wv 1 v
250+ | POutputParameterUnaltered v -> wv 1 v
238251
239252end
240253
@@ -364,7 +377,14 @@ let po_predicate_to_full_pretty p =
364377 | PIndexUpperBound (e1 , e2 ) ->
365378 LBLOCK [exp_to_pretty e1; STR " < " ; exp_to_pretty e2]
366379 | PInitialized lval ->
367- LBLOCK [STR " initialized(" ; lval_to_pretty lval; STR " )" ]
380+ LBLOCK [STR " initialized(" ; lval_to_pretty lval; STR " )" ]
381+ | PLocallyInitialized (vinfo , lval ) ->
382+ LBLOCK [
383+ STR " locally-initialized(" ;
384+ STR vinfo.vname;
385+ STR " ," ;
386+ lval_to_pretty lval;
387+ STR " )" ]
368388 | PInitializedRange (base , len ) ->
369389 LBLOCK [
370390 STR " initialized-range(" ;
@@ -615,6 +635,10 @@ let po_predicate_to_full_pretty p =
615635 STR " preserved-all-memory-x" ;
616636 pretty_print_list l exp_to_pretty " (" " ," " )" ]
617637 | PContractObligation s -> LBLOCK [STR " contract-obligation:" ; STR s]
638+ | POutputParameterInitialized vinfo ->
639+ LBLOCK [STR " outputparameter-initialized(" ; STR vinfo.vname; STR " )" ]
640+ | POutputParameterUnaltered vinfo ->
641+ LBLOCK [STR " outputparameter-unaltered(" ; STR vinfo.vname; STR " )" ]
618642
619643
620644let pr_expr op e1 e2 t = exp_to_pretty (BinOp (op, e1, e2,t ))
@@ -659,6 +683,9 @@ let po_predicate_to_pretty ?(full=false) (p:po_predicate_t) =
659683 | PIndexUpperBound (e1 , e2 ) ->
660684 LBLOCK [STR " index-upperbound(" ; pe e1; STR " ," ; pe e2; STR " )" ]
661685 | PInitialized lval -> LBLOCK [STR " initialized(" ; pl lval; STR " )" ]
686+ | PLocallyInitialized (vinfo , lval ) ->
687+ LBLOCK [
688+ STR " locally-initialized(" ; STR vinfo.vname; STR " ," ; pl lval; STR " )" ]
662689 | PInitializedRange (base , len ) ->
663690 LBLOCK [STR " initialized-range(" ; pe base; STR " , " ; pe len; STR " )" ]
664691 | PCast (fromt , tot , e ) ->
@@ -837,6 +864,10 @@ let po_predicate_to_pretty ?(full=false) (p:po_predicate_t) =
837864 STR " preserved-all-memory-x" ;
838865 pretty_print_list l exp_to_pretty " (" " ," " )" ]
839866 | PContractObligation s -> LBLOCK [STR " contract-obligation:" ; STR s]
867+ | POutputParameterInitialized vinfo ->
868+ LBLOCK [STR " outputparameter-initialized(" ; STR vinfo.vname; STR " )" ]
869+ | POutputParameterUnaltered vinfo ->
870+ LBLOCK [STR " outputparameter-unaltered(" ; STR vinfo.vname; STR " )" ]
840871
841872
842873let get_global_vars_in_exp (env :cfundeclarations_int ) (e :exp ) =
0 commit comments