29
29
30
30
type inv = {
31
31
exp : Cil .exp ;
32
- uuid : string ;
32
+ token : WideningToken .t ;
33
33
}
34
34
35
35
let invs: inv NH. t = NH. create 100
90
90
let uuid = entry.metadata.uuid in
91
91
let target_type = YamlWitnessType.EntryType. entry_type entry.entry_type in
92
92
93
- let unassume_nodes_invariant ~loc ~nodes inv =
93
+ let unassume_nodes_invariant ~loc ~nodes ? i inv =
94
94
let msgLoc: M.Location. t = CilLocation loc in
95
95
match InvariantParser. parse_cabs inv with
96
96
| Ok inv_cabs ->
@@ -101,7 +101,7 @@ struct
101
101
match InvariantParser. parse_cil inv_parser ~check: false ~fundec ~loc inv_cabs with
102
102
| Ok inv_exp ->
103
103
M. debug ~category: Witness ~loc: msgLoc " located invariant to %a: %a" Node. pretty n Cil. d_exp inv_exp;
104
- NH. add invs n {exp = inv_exp; uuid}
104
+ NH. add invs n {exp = inv_exp; token = ( uuid, i) }
105
105
| Error e ->
106
106
M. error ~category: Witness ~loc: msgLoc " CIL couldn't parse invariant: %s" inv;
107
107
M. info ~category: Witness ~loc: msgLoc " invariant has undefined variables or side effects: %s" inv
@@ -154,7 +154,7 @@ struct
154
154
M. debug ~category: Witness ~loc: msgLoc " located invariant to %a: %a" Node. pretty n Cil. d_exp inv_exp;
155
155
if not (NH. mem pre_invs n) then
156
156
NH. replace pre_invs n (EH. create 10 );
157
- EH. add (NH. find pre_invs n) pre_exp {exp = inv_exp; uuid}
157
+ EH. add (NH. find pre_invs n) pre_exp {exp = inv_exp; token = ( uuid, None ) }
158
158
| Error e ->
159
159
M. error ~category: Witness ~loc: msgLoc " CIL couldn't parse invariant: %s" inv;
160
160
M. info ~category: Witness ~loc: msgLoc " invariant has undefined variables or side effects: %s" inv
@@ -189,42 +189,42 @@ struct
189
189
190
190
let unassume_invariant_set (invariant_set : YamlWitnessType.InvariantSet.t ) =
191
191
192
- let unassume_location_invariant (location_invariant : YamlWitnessType.InvariantSet.LocationInvariant.t ) =
192
+ let unassume_location_invariant ~ i (location_invariant : YamlWitnessType.InvariantSet.LocationInvariant.t ) =
193
193
let loc = YamlWitness. loc_of_location location_invariant.location in
194
194
let inv = location_invariant.value in
195
195
let msgLoc: M.Location. t = CilLocation loc in
196
196
197
197
match Locator. find_opt location_locator loc with
198
198
| Some nodes ->
199
- unassume_nodes_invariant ~loc ~nodes inv
199
+ unassume_nodes_invariant ~loc ~nodes ~i inv
200
200
| None ->
201
201
M. warn ~category: Witness ~loc: msgLoc " couldn't locate invariant: %s" inv
202
202
in
203
203
204
- let unassume_loop_invariant (loop_invariant : YamlWitnessType.InvariantSet.LoopInvariant.t ) =
204
+ let unassume_loop_invariant ~ i (loop_invariant : YamlWitnessType.InvariantSet.LoopInvariant.t ) =
205
205
let loc = YamlWitness. loc_of_location loop_invariant.location in
206
206
let inv = loop_invariant.value in
207
207
let msgLoc: M.Location. t = CilLocation loc in
208
208
209
209
match Locator. find_opt loop_locator loc with
210
210
| Some nodes ->
211
- unassume_nodes_invariant ~loc ~nodes inv
211
+ unassume_nodes_invariant ~loc ~nodes ~i inv
212
212
| None ->
213
213
M. warn ~category: Witness ~loc: msgLoc " couldn't locate invariant: %s" inv
214
214
in
215
215
216
- let validate_invariant (invariant : YamlWitnessType.InvariantSet.Invariant.t ) =
216
+ let validate_invariant i (invariant : YamlWitnessType.InvariantSet.Invariant.t ) =
217
217
let target_type = YamlWitnessType.InvariantSet.InvariantType. invariant_type invariant.invariant_type in
218
218
match YamlWitness. invariant_type_enabled target_type, invariant.invariant_type with
219
219
| true , LocationInvariant x ->
220
- unassume_location_invariant x
220
+ unassume_location_invariant ~i x
221
221
| true , LoopInvariant x ->
222
- unassume_loop_invariant x
222
+ unassume_loop_invariant ~i x
223
223
| false , (LocationInvariant _ | LoopInvariant _ ) ->
224
224
M. info_noloc ~category: Witness " disabled invariant of type %s" target_type
225
225
in
226
226
227
- List. iter validate_invariant invariant_set.content
227
+ List. iteri validate_invariant invariant_set.content
228
228
in
229
229
230
230
match YamlWitness. entry_type_enabled target_type, entry.entry_type with
@@ -262,9 +262,9 @@ struct
262
262
M. info ~category: Witness " unassume invariant: %a" CilType.Exp. pretty e;
263
263
if not ! AnalysisState. postsolving then (
264
264
if not (GobConfig. get_bool " ana.unassume.precheck" && Queries.ID. to_bool (ctx.ask (EvalInt e)) = Some false ) then (
265
- let uuids = x.uuid :: List. map (fun {uuid ; _} -> uuid ) xs in
266
- ctx.emit (Unassume {exp = e; uuids });
267
- List. iter WideningTokens . add uuids
265
+ let tokens = x.token :: List. map (fun {token ; _} -> token ) xs in
266
+ ctx.emit (Unassume {exp = e; tokens });
267
+ List. iter WideningTokenLifter . add tokens
268
268
)
269
269
);
270
270
ctx.local
0 commit comments