distrf_attr can be used to match a single attribute at a time. Add this matcher function to the PARAM functor.
Signed-off-by: Jaskaran Singh <jaskaransingh7654...@gmail.com> --- engine/cocci_vs_c.ml | 3 +++ engine/cocci_vs_c.mli | 3 +++ engine/pattern_c.ml | 1 + engine/transformation_c.ml | 5 +++++ 4 files changed, 12 insertions(+) diff --git a/engine/cocci_vs_c.ml b/engine/cocci_vs_c.ml index 2a3c3f94..e383aef8 100644 --- a/engine/cocci_vs_c.ml +++ b/engine/cocci_vs_c.ml @@ -700,6 +700,9 @@ module type PARAM = val distrf_exec_code_list : (A.meta_name A.mcode, (Ast_c.exec_code, Ast_c.il) either list) matcher + val distrf_attr : + (A.meta_name A.mcode, Ast_c.attribute) matcher + val distrf_attrs : (A.meta_name A.mcode, (Ast_c.attribute, Ast_c.il) either list) matcher diff --git a/engine/cocci_vs_c.mli b/engine/cocci_vs_c.mli index ef55d478..70354e19 100644 --- a/engine/cocci_vs_c.mli +++ b/engine/cocci_vs_c.mli @@ -162,6 +162,9 @@ module type PARAM = (Ast_cocci.meta_name Ast_cocci.mcode, (Ast_c.exec_code, Ast_c.il) Common.either list) matcher + val distrf_attr : + (Ast_cocci.meta_name Ast_cocci.mcode, Ast_c.attribute) matcher + val distrf_attrs : (Ast_cocci.meta_name Ast_cocci.mcode, (Ast_c.attribute, Ast_c.il) Common.either list) matcher diff --git a/engine/pattern_c.ml b/engine/pattern_c.ml index b1d80abb..12b1c170 100644 --- a/engine/pattern_c.ml +++ b/engine/pattern_c.ml @@ -335,6 +335,7 @@ module XMATCH = struct let distrf_define_params = distrf Lib_parsing_c.ii_of_define_params let distrf_ident_list = distrf Lib_parsing_c.ii_of_ident_list let distrf_exec_code_list = distrf Lib_parsing_c.ii_of_exec_code_list + let distrf_attr = distrf Lib_parsing_c.ii_of_attr let distrf_attrs = distrf Lib_parsing_c.ii_of_attrs diff --git a/engine/transformation_c.ml b/engine/transformation_c.ml index 4de8fe51..eecd4858 100644 --- a/engine/transformation_c.ml +++ b/engine/transformation_c.ml @@ -621,6 +621,9 @@ module XTRANS = struct let distribute_mck_ini (maxpos, minpos) = fun (lop,mop,rop,bop) -> fun x -> Visitor_c.vk_ini_s (mk_bigf (maxpos, minpos) (lop,mop,rop,bop)) x + let distribute_mck_attr (maxpos, minpos) = fun (lop,mop,rop,bop) -> fun x -> + Visitor_c.vk_attribute_s (mk_bigf (maxpos, minpos) (lop,mop,rop,bop)) x + let distribute_mck_inis (maxpos, minpos) = fun (lop,mop,rop,bop) -> fun x -> Visitor_c.vk_inis_splitted_s (mk_bigf (maxpos, minpos) (lop,mop,rop,bop)) x @@ -750,6 +753,8 @@ module XTRANS = struct distrf (Lib_parsing_c.ii_of_ident_list,distribute_mck_ident_list) let distrf_exec_code_list = distrf (Lib_parsing_c.ii_of_exec_code_list,distribute_mck_exec_code_list) + let distrf_attr = + distrf (Lib_parsing_c.ii_of_attr,distribute_mck_attr) let distrf_attrs = distrf (Lib_parsing_c.ii_of_attrs,distribute_mck_attrs) -- 2.21.1 _______________________________________________ Cocci mailing list Cocci@systeme.lip6.fr https://systeme.lip6.fr/mailman/listinfo/cocci