File tree Expand file tree Collapse file tree 1 file changed +25
-1
lines changed
src/cdomain/value/domains Expand file tree Collapse file tree 1 file changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -91,11 +91,35 @@ let exp_contains_tmp e =
9191 ! acc
9292
9393
94+ let fieldinfo_is_anon (fi : fieldinfo ) =
95+ String. starts_with ~prefix: " __annonCompField" fi.fname (* TODO: what if CIL-ed program explicitly has this? *)
96+
97+ let rec offset_contains_anon_comp_offset = function
98+ | NoOffset -> false
99+ | Index (e , offs' ) -> offset_contains_anon_comp_offset offs' (* does not check e!, done by visitor *)
100+ | Field (fi , offs' ) -> fieldinfo_is_anon fi || offset_contains_anon_comp_offset offs'
101+
102+ class exp_contains_anon_comp_offset_visitor = object
103+ inherit nopCilVisitor
104+ method! voffs (offs: offset ) =
105+ if offset_contains_anon_comp_offset offs then
106+ raise Stdlib. Exit
107+ else
108+ DoChildren (* recurse to Index offset expressions! *)
109+ end
110+ let exp_contains_anon_comp_offset =
111+ let visitor = new exp_contains_anon_comp_offset_visitor in
112+ fun e ->
113+ match visitCilExpr visitor e with
114+ | _ -> false
115+ | exception Stdlib. Exit -> true
116+
117+
94118let var_is_suitable ?scope v =
95119 not (var_is_tmp v) && GobOption. for_all (fun scope -> var_is_in_scope scope v) scope
96120
97121let exp_is_suitable ?scope e =
98- not (exp_contains_tmp e) && GobOption. for_all (fun scope -> exp_is_in_scope scope e) scope
122+ not (exp_contains_tmp e || exp_contains_anon_comp_offset e ) && GobOption. for_all (fun scope -> exp_is_in_scope scope e) scope
99123
100124
101125class exp_contains_anon_type_visitor = object
You can’t perform that action at this time.
0 commit comments