From a6b7f4e717091222a7c76de435e2545ca55550f0 Mon Sep 17 00:00:00 2001 From: Simmo Saan Date: Mon, 4 Mar 2024 14:33:59 +0200 Subject: [PATCH] Create visitors in InvariantCil only once --- src/cdomain/value/domains/invariantCil.ml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/cdomain/value/domains/invariantCil.ml b/src/cdomain/value/domains/invariantCil.ml index 9a8c11fff7..813ec25818 100644 --- a/src/cdomain/value/domains/invariantCil.ml +++ b/src/cdomain/value/domains/invariantCil.ml @@ -13,9 +13,9 @@ class exp_replace_original_name_visitor = object method! vvrbl (vi: varinfo) = ChangeTo (var_replace_original_name vi) end -let exp_replace_original_name e = (* TODO: curry to create object only once *) +let exp_replace_original_name = let visitor = new exp_replace_original_name_visitor in - visitCilExpr visitor e + visitCilExpr visitor class exp_deep_unroll_types_visitor = object inherit nopCilVisitor @@ -93,11 +93,12 @@ class exp_contains_anon_type_visitor = object | _ -> DoChildren end -let exp_contains_anon_type e = (* TODO: curry to create object only once *) +let exp_contains_anon_type = let visitor = new exp_contains_anon_type_visitor in - match visitCilExpr visitor e with - | _ -> false - | exception Stdlib.Exit -> true + fun e -> + match visitCilExpr visitor e with + | _ -> false + | exception Stdlib.Exit -> true (* TODO: synchronize magic constant with BaseDomain *)