parsing_cocci: Add attributefn to the SmPL AST visitor
cover parsing_cocci: Add attributefn to the SmPL AST visitor
This patch series aims to add a public function for visiting attributes to the SmPL AST visitor. This is needed to support meta attributes.
Jaskaran Singh (17):
parsing_cocci: visitor_ast: Add attributefn to SmPL AST visitor
parsing_cocci: parse_cocci: Reflect attributefn in AST visitor
parsing_cocci: cleanup_rules: Reflect attributefn in AST visitor
parsing_cocci: disjdistr: Reflect attributefn in AST visitor
parsing_cocci: free_vars: Reflect attributefn in AST visitor
parsing_cocci: get_constants2: Reflect attributefn in AST visitor
parsing_cocci: re_constraints: Reflect attributefn in AST visitor
parsing_cocci: safe_for_multi_decls: Reflect attributefn in AST visitor
parsing_cocci: stmtlist: Reflect attributefn in AST visitor
parsing_cocci: unify_ast: Reflect attributefn in AST visitor
parsing_c: unparse_hrule: Reflect attributefn in AST visitor
cocci: Reflect attributefn in AST visitor
engine: asttoctl2: Reflect attributefn in AST visitor
engine: asttomember: Reflect attributefn in AST visitor
engine: cocci_vs_c: Reflect attributefn in AST visitor
engine: transformation_c: Reflect attributefn in AST visitor
popl09: popltoctl: Reflect attributefn in AST visitor
cocci.ml | 2 +- engine/asttoctl2.ml | 11 ++++++----- engine/asttomember.ml | 8 ++++---- engine/cocci_vs_c.ml | 4 ++-- engine/transformation_c.ml | 2 +- parsing_c/unparse_hrule.ml | 2 +- parsing_cocci/cleanup_rules.ml | 2 +- parsing_cocci/disjdistr.ml | 5 +++-- parsing_cocci/free_vars.ml | 16 +++++++++------- parsing_cocci/get_constants2.ml | 3 ++- parsing_cocci/parse_cocci.ml | 2 +- parsing_cocci/re_constraints.ml | 8 +++++--- parsing_cocci/safe_for_multi_decls.ml | 6 +++--- parsing_cocci/stmtlist.ml | 2 +- parsing_cocci/unify_ast.ml | 20 +++++++++++++------- parsing_cocci/visitor_ast.ml | 12 ++++++++---- parsing_cocci/visitor_ast.mli | 4 ++++ popl09/popltoctl.ml | 2 +- 18 files changed, 66 insertions(+), 45 deletions(-)
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci
PATCH 1/17 parsing_cocci: visitor_ast: Add attributefn to SmPL AST visitor
Add a public function to visit attributes in the SmPL AST visitor.
--- parsing_cocci/visitor_ast.ml | 12 ++++++++---- parsing_cocci/visitor_ast.mli | 4 ++++ 2 files changed, 12 insertions(+), 4 deletions(-)
parsing_cocci/visitor_ast.ml +8 -4
@@ -34,6 +34,7 @@ type 'a combiner = combiner_rule_elem : Ast.rule_elem -> 'a; combiner_statement : Ast.statement -> 'a; combiner_case_line : Ast.case_line -> 'a; + combiner_attribute : Ast.attr -> 'a; combiner_top_level : Ast.top_level -> 'a; combiner_anything : Ast.anything -> 'a; combiner_expression_dots : Ast.expression Ast.dots -> 'a;
@@ -57,7 +58,7 @@ let combiner bind option_default identfn exprfn fragfn fmtfn assignOpfn binaryOpfn ftfn tyfn initfn paramfn define_paramfn declfn annotated_declfn fieldfn annotated_fieldfn enum_declfn rulefn stmtfn - casefn topfn anyfn = + casefn attributefn topfn anyfn = let multibind l = let rec loop = function [] -> option_default
@@ -921,7 +922,7 @@ let combiner bind option_default let k a = match Ast.unwrap a with Ast.Attribute(attr) -> string_mcode attr in - k a + attributefn all_functions k a and whencode notfn alwaysfn = function
@@ -1027,6 +1028,7 @@ let combiner bind option_default combiner_rule_elem = rule_elem; combiner_statement = statement; combiner_case_line = case_line; + combiner_attribute = attribute; combiner_top_level = top_level; combiner_anything = anything; combiner_expression_dots = expression_dots;
@@ -1059,6 +1061,7 @@ type rebuilder = rebuilder_parameter_list : Ast.parameter_list inout; rebuilder_statement : Ast.statement inout; rebuilder_case_line : Ast.case_line inout; + rebuilder_attribute : Ast.attr inout; rebuilder_rule_elem : Ast.rule_elem inout; rebuilder_top_level : Ast.top_level inout; rebuilder_expression_dots : Ast.expression Ast.dots inout;
@@ -1085,7 +1088,7 @@ let rebuilder enumdecldotsfn initdotsfn identfn exprfn fragfn fmtfn assignOpfn binaryOpfn ftfn tyfn initfn paramfn define_paramfn declfn annotated_declfn fieldfn annotated_fieldfn - enum_declfn rulefn stmtfn casefn topfn anyfn = + enum_declfn rulefn stmtfn casefn attributefn topfn anyfn = let get_option f = function Some x -> Some (f x) | None -> None in
@@ -1917,7 +1920,7 @@ let rebuilder Ast.rewrap a (match Ast.unwrap a with Ast.Attribute(attr) -> Ast.Attribute(string_mcode attr)) in - k a + attributefn all_functions k a and whencode notfn alwaysfn = function Ast.WhenNot a -> Ast.WhenNot (notfn a)
@@ -2026,6 +2029,7 @@ let rebuilder rebuilder_rule_elem = rule_elem; rebuilder_statement = statement; rebuilder_case_line = case_line; + rebuilder_attribute = attribute; rebuilder_top_level = top_level; rebuilder_expression_dots = expression_dots; rebuilder_statement_dots = statement_dots;
parsing_cocci/visitor_ast.mli +4 -0
@@ -23,6 +23,7 @@ type 'a combiner = combiner_rule_elem : Ast_cocci.rule_elem -> 'a; combiner_statement : Ast_cocci.statement -> 'a; combiner_case_line : Ast_cocci.case_line -> 'a; + combiner_attribute : Ast_cocci.attr -> 'a; combiner_top_level : Ast_cocci.top_level -> 'a; combiner_anything : Ast_cocci.anything -> 'a; combiner_expression_dots : Ast_cocci.expression Ast_cocci.dots -> 'a;
@@ -77,6 +78,7 @@ val combiner : ((Ast_cocci.rule_elem,'a) ccode) -> ((Ast_cocci.statement,'a) ccode) -> ((Ast_cocci.case_line,'a) ccode) -> + ((Ast_cocci.attr,'a) ccode) -> ((Ast_cocci.top_level,'a) ccode) -> ((Ast_cocci.anything,'a) ccode) -> 'a combiner
@@ -101,6 +103,7 @@ type rebuilder = rebuilder_parameter_list : Ast_cocci.parameter_list inout; rebuilder_statement : Ast_cocci.statement inout; rebuilder_case_line : Ast_cocci.case_line inout; + rebuilder_attribute : Ast_cocci.attr inout; rebuilder_rule_elem : Ast_cocci.rule_elem inout; rebuilder_top_level : Ast_cocci.top_level inout; rebuilder_expression_dots : Ast_cocci.expression Ast_cocci.dots inout;
@@ -158,6 +161,7 @@ val rebuilder : (Ast_cocci.rule_elem rcode) -> (Ast_cocci.statement rcode) -> (Ast_cocci.case_line rcode) -> + (Ast_cocci.attr rcode) -> (Ast_cocci.top_level rcode) -> (Ast_cocci.anything rcode) -> rebuilder
Signature · 6 lines
2.21.3 _______________________________________________ Cocci mailing list [email protected] https://systeme.lip6.fr/mailman/listinfo/cocci
PATCH 2/17 parsing_cocci: parse_cocci: Reflect attributefn in AST visitor
In reply to Jaskaran SinghThe SmPL AST visitor has a function for attributes. Reflect these changes in parse_cocci.ml.
--- parsing_cocci/parse_cocci.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
parsing_cocci/parse_cocci.ml +1 -1
@@ -2620,7 +2620,7 @@ let contains_modifs ast = donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing - donothing donothing donothing donothing in + donothing donothing donothing donothing donothing in List.exists (function Ast.CocciRule(nm,infos,ast,_,_) ->
Signature · 6 lines
2.21.3 _______________________________________________ Cocci mailing list [email protected] https://systeme.lip6.fr/mailman/listinfo/cocci
PATCH 3/17 parsing_cocci: cleanup_rules: Reflect attributefn in AST visitor
In reply to Jaskaran SinghThe SmPL AST visitor has a function for attributes. Reflect these changes in cleanup_rules.ml.
--- parsing_cocci/cleanup_rules.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
parsing_cocci/cleanup_rules.ml +1 -1
@@ -254,7 +254,7 @@ let do_cleanup = ident expression string_fragment string_format assignOp binaryOp fullType typeC initialiser parameterTypeDef define_param declaration donothing field ann_field donothing - rule_elem statement donothing donothing donothing + rule_elem statement donothing donothing donothing donothing let cleanup_rules rules d = dropped := d;
Signature · 6 lines
2.21.3 _______________________________________________ Cocci mailing list [email protected] https://systeme.lip6.fr/mailman/listinfo/cocci
PATCH 4/17 parsing_cocci: disjdistr: Reflect attributefn in AST visitor
In reply to Jaskaran SinghThe SmPL AST visitor has a function for attributes. Reflect these changes in disjdistr.ml.
--- parsing_cocci/disjdistr.ml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
parsing_cocci/disjdistr.ml +3 -2
@@ -483,6 +483,7 @@ let disj_all = donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing disj_rule_elem donothing donothing donothing donothing + donothing (* ----------------------------------------------------------------------- *) (* collect iso information at the rule_elem level *)
@@ -500,7 +501,7 @@ let collect_all_isos = donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing doanything donothing doanything donothing donothing donothing donothing - donothing doanything + donothing donothing doanything let collect_iso_info = let mcode x = x in
@@ -518,7 +519,7 @@ let collect_iso_info = donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing rule_elem donothing donothing - donothing donothing + donothing donothing donothing (* ----------------------------------------------------------------------- *)
Signature · 6 lines
2.21.3 _______________________________________________ Cocci mailing list [email protected] https://systeme.lip6.fr/mailman/listinfo/cocci
PATCH 5/17 parsing_cocci: free_vars: Reflect attributefn in AST visitor
In reply to Jaskaran SinghThe SmPL AST visitor has a function for attributes. Reflect these changes in free_vars.ml.
--- parsing_cocci/free_vars.ml | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
parsing_cocci/free_vars.ml +9 -7
@@ -253,7 +253,7 @@ let collect_refs include_constraints = astfvident astfvexpr astfvfrag astfvfmt astfvassignop astfvbinaryop astfvfullType astfvtypeC astfvinit astfvparam astfvdefine_param astfvdecls donothing astfvfields astafvfields donothing - astfvrule_elem astfvstatement donothing donothing donothing_a + astfvrule_elem astfvstatement donothing donothing donothing donothing_a let collect_all_refs = collect_refs true let collect_non_constraint_refs = collect_refs false
@@ -303,7 +303,7 @@ let collect_pos_positions = donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing - cprule_elem cpstmt donothing donothing donothing + cprule_elem cpstmt donothing donothing donothing donothing (* ---------------------------------------------------------------- *)
@@ -479,7 +479,7 @@ let collect_saved = astfvident astfvexpr astfvfrag astfvfmt astfvassign astfvbinary donothing astfvtypeC astfvinit astfvparam astfvdefine_param astfvdecls donothing astfvfields donothing donothing astfvrule_elem donothing donothing - donothing donothing + donothing donothing donothing (* ---------------------------------------------------------------- *)
@@ -612,7 +612,7 @@ let collect_in_plus_term = donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing astfvrule_elem - astfvstatement donothing donothing donothing + astfvstatement donothing donothing donothing donothing let collect_in_plus metavars minirules = nub
@@ -905,7 +905,7 @@ let classify_variables metavar_decls minirules used_after = ident expression string_fragment string_format assignop binaryop donothing typeC init param define_param decl donothing field donothing donothing - rule_elem donothing donothing donothing donothing in + rule_elem donothing donothing donothing donothing donothing in List.map fn.V.rebuilder_top_level minirules
@@ -1091,7 +1091,8 @@ let astfvs metavars bound = donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing - astfvrule_elem astfvstatement astfvcase_line astfvtoplevel donothing + astfvrule_elem astfvstatement astfvcase_line donothing astfvtoplevel + donothing (* let collect_astfvs rules =
@@ -1175,7 +1176,8 @@ let get_neg_pos_list (_,rule) used_after_list = donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing - donothing donothing donothing donothing donothing donothing donothing in + donothing donothing donothing donothing donothing donothing donothing + donothing in match rule with Ast.CocciRule(rule_name,_,minirules,_,_) -> List.map
Signature · 6 lines
2.21.3 _______________________________________________ Cocci mailing list [email protected] https://systeme.lip6.fr/mailman/listinfo/cocci
PATCH 6/17 parsing_cocci: get_constants2: Reflect attributefn in AST visitor
In reply to Jaskaran SinghThe SmPL AST visitor has a function for attributes. Reflect these changes in get_constants2.ml.
--- parsing_cocci/get_constants2.ml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
parsing_cocci/get_constants2.ml +2 -1
@@ -646,6 +646,7 @@ let do_get_constants constants keywords env (neg_pos,_) = ident expression string_fragment string_format donothing donothing fullType typeC initialiser parameter define_parameter declaration donothing field ann_field donothing rule_elem statement donothing donothing donothing + donothing (* ------------------------------------------------------------------------ *)
@@ -714,7 +715,7 @@ let all_context = donothing donothing donothing donothing donothing donothing donothing donothing initialiser donothing donothing donothing donothing donothing donothing - donothing rule_elem statement donothing donothing donothing + donothing rule_elem statement donothing donothing donothing donothing (* ------------------------------------------------------------------------ *)
Signature · 6 lines
2.21.3 _______________________________________________ Cocci mailing list [email protected] https://systeme.lip6.fr/mailman/listinfo/cocci
PATCH 7/17 parsing_cocci: re_constraints: Reflect attributefn in AST visitor
In reply to Jaskaran SinghThe SmPL AST visitor has a function for attributes. Reflect these changes in re_constraints.ml.
--- parsing_cocci/re_constraints.ml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
parsing_cocci/re_constraints.ml +5 -3
@@ -44,7 +44,7 @@ let disj_free re = donothing donothing donothing donothing donothing donothing donothing ident expr donothing donothing donothing donothing ty donothing donothing donothing donothing decl donothing donothing ann_field donothing - rule_elem statement donothing donothing donothing in + rule_elem statement donothing donothing donothing donothing in try Hashtbl.find disj_free_table re with Not_found -> let res = v.V.combiner_rule_elem re in
@@ -90,7 +90,8 @@ let ok_for_all_rule_elems cstr minirules = donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing - donothing donothing rule_elem donothing donothing donothing donothing in + donothing donothing rule_elem donothing donothing donothing donothing + donothing in List.for_all v.V.combiner_top_level minirules let update_for_all_rule_elems cstr minirules =
@@ -113,7 +114,8 @@ let update_for_all_rule_elems cstr minirules = donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing - donothing rule_elem donothing donothing donothing donothing in + donothing rule_elem donothing donothing donothing donothing + donothing in List.map v.V.rebuilder_top_level minirules let remove rule_name ((nm,_) as x) =
Signature · 6 lines
2.21.3 _______________________________________________ Cocci mailing list [email protected] https://systeme.lip6.fr/mailman/listinfo/cocci
PATCH 8/17 parsing_cocci: safe_for_multi_decls: Reflect attributefn in AST visitor
In reply to Jaskaran SinghThe SmPL AST visitor has a function for attributes. Reflect these changes in safe_for_multi_decls.ml.
--- parsing_cocci/safe_for_multi_decls.ml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
parsing_cocci/safe_for_multi_decls.ml +3 -3
@@ -43,7 +43,7 @@ let all_removed_recursor = do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing - do_nothing do_nothing do_nothing do_nothing + do_nothing do_nothing do_nothing do_nothing do_nothing let all_removed_decl = all_removed_recursor.V.combiner_declaration
@@ -100,7 +100,7 @@ let contains_modif = do_nothing do_nothing do_nothing init do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing rule_elem do_nothing do_nothing do_nothing - do_nothing in + do_nothing do_nothing in recursor.V.combiner_fullType let attribute a =
@@ -178,7 +178,7 @@ let process = donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing decl anndecl field annfield - donothing donothing donothing donothing donothing donothing in + donothing donothing donothing donothing donothing donothing donothing in List.map fn.V.rebuilder_top_level let safe_for_multi_decls rules =
Signature · 6 lines
2.21.3 _______________________________________________ Cocci mailing list [email protected] https://systeme.lip6.fr/mailman/listinfo/cocci
PATCH 9/17 parsing_cocci: stmtlist: Reflect attributefn in AST visitor
In reply to Jaskaran SinghThe SmPL AST visitor has a function for attributes. Reflect these changes in stmtlist.ml.
--- parsing_cocci/stmtlist.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
parsing_cocci/stmtlist.ml +1 -1
@@ -56,7 +56,7 @@ let stmtlist_rebuilder = donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing - statement donothing donothing donothing + statement donothing donothing donothing donothing let stmtlist rule = match rule with
Signature · 6 lines
2.21.3 _______________________________________________ Cocci mailing list [email protected] https://systeme.lip6.fr/mailman/listinfo/cocci
PATCH 10/17 parsing_cocci: unify_ast: Reflect attributefn in AST visitor
In reply to Jaskaran SinghThe SmPL AST visitor has a function for attributes. Reflect these changes in unify_ast.ml. Also add a few fixes w/r/t the usage of for_all2 for comparing attributes.
--- parsing_cocci/unify_ast.ml | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-)
parsing_cocci/unify_ast.ml +13 -7
@@ -221,7 +221,8 @@ and unify_expression e1 e2 = | (Ast.RecordPtAccess(e1,pt1,fld1),Ast.RecordPtAccess(e2,pt2,fld2)) -> unify_expression e1 e2 && unify_ident fld1 fld2 | (Ast.Cast(lp1,ty1,attr1,rp1,e1),Ast.Cast(lp2,ty2,attr2,rp2,e2)) -> - if List.for_all2 unify_attribute attr1 attr2 + if (List.length attr1 = List.length attr2) && + List.for_all2 unify_attribute attr1 attr2 then unify_fullType ty1 ty2 && unify_expression e1 e2 else false | (Ast.SizeOfExpr(szf1,e1),Ast.SizeOfExpr(szf2,e2)) ->
@@ -386,6 +387,7 @@ and unify_declaration d1 d2 = | (Ast.Init(stg1,ft1,id1,attr1,eq1,i1,s1), Ast.Init(stg2,ft2,id2,attr2,eq2,i2,s2)) -> if bool_unify_option unify_mcode stg1 stg2 && + (List.length attr1 = List.length attr2) && List.for_all2 unify_attribute attr1 attr2 then unify_fullType ft1 ft2 &&
@@ -394,6 +396,7 @@ and unify_declaration d1 d2 = else false | (Ast.UnInit(stg1,ft1,id1,attr1,s1),Ast.UnInit(stg2,ft2,id2,attr2,s2)) -> if bool_unify_option unify_mcode stg1 stg2 && + (List.length attr1 = List.length attr2) && List.for_all2 unify_attribute attr1 attr2 then unify_fullType ft1 ft2 && unify_ident id1 id2 else false
@@ -414,6 +417,7 @@ and unify_declaration d1 d2 = | (Ast.MacroDecl(s1,n1,lp1,args1,rp1,attr1,sem1), Ast.MacroDecl(s2,n2,lp2,args2,rp2,attr2,sem2)) -> if bool_unify_option unify_mcode s1 s2 && + (List.length attr1 = List.length attr2) && List.for_all2 unify_attribute attr1 attr2 then unify_ident n1 n2 &&
@@ -428,7 +432,8 @@ and unify_declaration d1 d2 = unify_initialiser ini1 ini2 else false | (Ast.TyDecl(ft1,attr1,s1),Ast.TyDecl(ft2,attr2,s2)) -> - if List.for_all2 unify_attribute attr1 attr2 + if (List.length attr1 = List.length attr2) && + List.for_all2 unify_attribute attr1 attr2 then unify_fullType ft1 ft2 else false | (Ast.Typedef(stg1,ft1,id1,s1),Ast.Typedef(stg2,ft2,id2,s2)) ->
@@ -549,12 +554,13 @@ and unify_designator d1 d2 = and unify_parameterTypeDef p1 p2 = match (Ast.unwrap p1,Ast.unwrap p2) with (Ast.VoidParam(ft1,attr1),Ast.VoidParam(ft2,attr2)) -> - if List.for_all2 unify_attribute attr1 attr2 + if (List.length attr1 = List.length attr2) && + List.for_all2 unify_attribute attr1 attr2 then unify_fullType ft1 ft2 else false | (Ast.Param(ft1,i1,attr1),Ast.Param(ft2,i2,attr2)) -> - - if List.for_all2 unify_attribute attr1 attr2 + if (List.length attr1 = List.length attr2) && + List.for_all2 unify_attribute attr1 attr2 then unify_fullType ft1 ft2 && unify_option unify_ident i1 i2
@@ -740,7 +746,7 @@ and subexp f = donothing expr donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing - donothing donothing donothing donothing donothing in + donothing donothing donothing donothing donothing donothing in recursor.V.combiner_rule_elem and subtype f =
@@ -756,7 +762,7 @@ and subtype f = donothing donothing donothing donothing donothing donothing fullType donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing - donothing donothing in + donothing donothing donothing in recursor.V.combiner_rule_elem let rec unify_statement s1 s2 =
Signature · 6 lines
2.21.3 _______________________________________________ Cocci mailing list [email protected] https://systeme.lip6.fr/mailman/listinfo/cocci
PATCH 11/17 parsing_c: unparse_hrule: Reflect attributefn in AST visitor
In reply to Jaskaran SinghThe SmPL AST visitor has a function for attributes. Reflect these changes in unparse_hrule.ml.
--- parsing_c/unparse_hrule.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
parsing_c/unparse_hrule.ml +1 -1
@@ -136,7 +136,7 @@ let get_function_name rule env = donothing donothing donothing donothing donothing donothing donothing donothing expression donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing - donothing donothing + donothing donothing donothing donothing donothing donothing donothing donothing).V.combiner_top_level rule in match names with
Signature · 6 lines
2.21.3 _______________________________________________ Cocci mailing list [email protected] https://systeme.lip6.fr/mailman/listinfo/cocci
PATCH 12/17 cocci: Reflect attributefn in AST visitor
In reply to Jaskaran SinghThe SmPL AST visitor has a function for attributes. Reflect these changes in cocci.ml.
--- cocci.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
cocci.ml +1 -1
@@ -600,7 +600,7 @@ let sp_contain_typed_metavar_z toplevel_list_list = donothing expression donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing - donothing donothing + donothing donothing donothing in toplevel_list_list +> List.exists
Signature · 6 lines
2.21.3 _______________________________________________ Cocci mailing list [email protected] https://systeme.lip6.fr/mailman/listinfo/cocci
PATCH 13/17 engine: asttoctl2: Reflect attributefn in AST visitor
In reply to Jaskaran SinghThe SmPL AST visitor has a function for attributes. Reflect these changes in asttoctl2.ml.
--- engine/asttoctl2.ml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
engine/asttoctl2.ml +6 -5
@@ -344,7 +344,7 @@ let elim_opt = donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing - donothing + donothing donothing (* --------------------------------------------------------------------- *) (* after management *)
@@ -470,7 +470,7 @@ let contains_modif = do_nothing do_nothing do_nothing do_nothing init do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing rule_elem do_nothing do_nothing do_nothing - do_nothing in + do_nothing do_nothing in recursor.V.combiner_rule_elem let contains_pos =
@@ -499,7 +499,7 @@ let contains_pos = do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing rule_elem do_nothing do_nothing do_nothing - do_nothing in + do_nothing do_nothing in recursor.V.combiner_rule_elem (* code is not a DisjRuleElem *)
@@ -598,7 +598,8 @@ let count_nested_braces s = donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing - donothing donothing donothing stmt_count donothing donothing donothing in + donothing donothing donothing stmt_count donothing donothing donothing + donothing in let res = string_of_int (recursor.V.combiner_statement s) in string2var ("p"^res)
@@ -2688,7 +2689,7 @@ and drop_minuses stmt_dots = donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing - donothing donothing donothing donothing donothing donothing donothing in + donothing donothing donothing donothing donothing donothing donothing donothing in v.V.rebuilder_statement_dots stmt_dots and find_xx = function
Signature · 6 lines
2.21.3 _______________________________________________ Cocci mailing list [email protected] https://systeme.lip6.fr/mailman/listinfo/cocci
PATCH 14/17 engine: asttomember: Reflect attributefn in AST visitor
In reply to Jaskaran SinghThe SmPL AST visitor has a function for attributes. Reflect these changes in asttomember.ml.
--- engine/asttomember.ml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
engine/asttomember.ml +4 -4
@@ -48,7 +48,7 @@ let contains_modif used_after x = do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing rule_elem do_nothing do_nothing do_nothing - do_nothing in + do_nothing do_nothing in recursor.V.combiner_rule_elem x (* contains an inherited metavariable or contains a constant *)
@@ -76,7 +76,7 @@ let contains_constant x = ident expr do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing - do_nothing do_nothing in + do_nothing do_nothing do_nothing in recursor.V.combiner_rule_elem x | _ -> true
@@ -138,7 +138,7 @@ let strip x = do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing decl_or_field do_absolutely_nothing decl_or_field do_absolutely_nothing do_nothing rule_elem - do_nothing do_nothing do_nothing do_absolutely_nothing in + do_nothing do_nothing do_nothing do_nothing do_absolutely_nothing in r.V.rebuilder_rule_elem x (* --------------------------------------------------------------------- *)
@@ -205,7 +205,7 @@ let find_commonalities res : Ast_cocci.rule_elem option = do_nothing do_nothing expression do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing - do_nothing do_nothing do_nothing + do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing in recursor.V.combiner_rule_elem x in match res with
Signature · 6 lines
2.21.3 _______________________________________________ Cocci mailing list [email protected] https://systeme.lip6.fr/mailman/listinfo/cocci
PATCH 15/17 engine: cocci_vs_c: Reflect attributefn in AST visitor
In reply to Jaskaran SinghThe SmPL AST visitor has a function for attributes. Reflect these changes in cocci_vs_c.ml.
--- engine/cocci_vs_c.ml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
engine/cocci_vs_c.ml +2 -2
@@ -609,7 +609,7 @@ let check_allminus = donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing - donothing donothing donothing donothing + donothing donothing donothing donothing donothing (*****************************************************************************) (* Functor parameter combinators *)
@@ -2335,7 +2335,7 @@ and (declaration: (A.mcodekind * bool * A.declaration,B.declaration) matcher) = donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing - donothing donothing donothing donothing in + donothing donothing donothing donothing donothing in v.Visitor_ast.rebuilder_declaration decla in xs +> List.fold_left (fun acc var ->
Signature · 6 lines
2.21.3 _______________________________________________ Cocci mailing list [email protected] https://systeme.lip6.fr/mailman/listinfo/cocci
PATCH 16/17 engine: transformation_c: Reflect attributefn in AST visitor
In reply to Jaskaran SinghThe SmPL AST visitor has a function for attributes. Reflect these changes in transformation_c.ml.
--- engine/transformation_c.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
engine/transformation_c.ml +1 -1
@@ -291,7 +291,7 @@ module XTRANS = struct ident expression donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing - donothing donothing donothing in + donothing donothing donothing donothing in fn.Visitor_ast.rebuilder_anything anything
Signature · 6 lines
2.21.3 _______________________________________________ Cocci mailing list [email protected] https://systeme.lip6.fr/mailman/listinfo/cocci
PATCH 17/17 popl09: popltoctl: Reflect attributefn in AST visitor
In reply to Jaskaran SinghThe SmPL AST visitor has a function for attributes. Reflect these changes in popltoctl.ml.
--- popl09/popltoctl.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
popl09/popltoctl.ml +1 -1
@@ -48,7 +48,7 @@ let contains_modif = do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing rule_elem do_nothing do_nothing do_nothing - do_nothing in + do_nothing do_nothing in recursor.V.combiner_rule_elem let ctl_exists keep_wit v x =
Signature · 6 lines
2.21.3 _______________________________________________ Cocci mailing list [email protected] https://systeme.lip6.fr/mailman/listinfo/cocci
Julia Lawall
AppliedQuoted 2 lines · Jaskaran Singh
This patch series aims to add a public function for visiting attributes to the SmPL AST visitor. This is needed to support meta attributes.
Applied. Thanks.
Quoted 31 lines
Jaskaran Singh (17):
parsing_cocci:visitor_ast: Add attributefn to SmPL AST visitor
parsing_cocci:parse_cocci: Reflect attributefn in AST visitor
parsing_cocci:cleanup_rules: Reflect attributefn in AST visitor
parsing_cocci: disjdistr: Reflect attributefn in AST visitor
parsing_cocci:free_vars: Reflect attributefn in AST visitor
parsing_cocci:get_constants2: Reflect attributefn in AST visitor
parsing_cocci:re_constraints: Reflect attributefn in AST visitor
parsing_cocci:safe_for_multi_decls: Reflect attributefn in AST visitor
parsing_cocci: stmtlist: Reflect attributefn in AST visitor
parsing_cocci:unify_ast: Reflect attributefn in AST visitor
parsing_c:unparse_hrule: Reflect attributefn in AST visitor
cocci: Reflect attributefn in AST visitor
engine: asttoctl2: Reflect attributefn in AST visitor
engine: asttomember: Reflect attributefn in AST visitor
engine:cocci_vs_c: Reflect attributefn in AST visitor
engine:transformation_c: Reflect attributefn in AST visitor
popl09: popltoctl: Reflect attributefn in AST visitorcocci.ml | 2 +- engine/asttoctl2.ml | 11 ++++++----- engine/asttomember.ml | 8 ++++---- engine/cocci_vs_c.ml | 4 ++-- engine/transformation_c.ml | 2 +- parsing_c/unparse_hrule.ml | 2 +- parsing_cocci/cleanup_rules.ml | 2 +- parsing_cocci/disjdistr.ml | 5 +++-- parsing_cocci/free_vars.ml | 16 +++++++++------- parsing_cocci/get_constants2.ml | 3 ++- parsing_cocci/parse_cocci.ml | 2 +-
Quoted 11 lines
parsing_cocci/re_constraints.ml | 8 +++++--- parsing_cocci/safe_for_multi_decls.ml | 6 +++--- parsing_cocci/stmtlist.ml | 2 +- parsing_cocci/unify_ast.ml | 20 +++++++++++++------- parsing_cocci/visitor_ast.ml | 12 ++++++++---- parsing_cocci/visitor_ast.mli | 4 ++++ popl09/popltoctl.ml | 2 +- 18 files changed, 66 insertions(+), 45 deletions(-)
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci