[Linux-kernel-mentees] [PATCH 08/23] parsing_cocci: function_prototypes: Reflect Parameter attributes
Jaskaran Singh
jaskaransingh7654321 at gmail.com
Mon Apr 27 12:08:19 UTC 2020
Parameter attributes are added to the SmPL AST. Reflect these changes in
function_prototypes.ml.
Signed-off-by: Jaskaran Singh <jaskaransingh7654321 at gmail.com>
---
parsing_cocci/function_prototypes.ml | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/parsing_cocci/function_prototypes.ml b/parsing_cocci/function_prototypes.ml
index 71bf1a2a..e223013b 100644
--- a/parsing_cocci/function_prototypes.ml
+++ b/parsing_cocci/function_prototypes.ml
@@ -185,7 +185,7 @@ and changed_proto = function
(* --------------------------------------------------------------------- *)
(* make rules *)
-let collect_ident_strings id =
+let collect_id_strings id =
let bind x y = x @ y in
let option_default = [] in
let donothing r k e = k e in
@@ -261,10 +261,10 @@ let rec attach_right strings ty =
let rec drop_param_name p =
Ast0.rewrap p
(match Ast0.unwrap p with
- Ast0.Param(p,Some id) ->
- let strings = collect_ident_strings id in
+ Ast0.Param(p,Some id,attr) ->
+ let strings = collect_id_strings id in
let p = attach_right strings p in
- Ast0.Param(p,None)
+ Ast0.Param(p,None,attr)
| Ast0.OptParam(p) -> Ast0.OptParam(drop_param_name p)
| p -> p)
@@ -297,7 +297,7 @@ let new_iname name index =
let rec rename_param old_name all param index =
match Ast0.unwrap param with
- Ast0.Param(ty,Some id) when all ->
+ Ast0.Param(ty,Some id,attr) when all ->
(match Ast0.unwrap id with
Ast0.MetaId
(((_,name),arity,info,mcodekind,pos,adj),constraints,seed,pure) ->
@@ -308,7 +308,7 @@ let rec rename_param old_name all param index =
((nm,arity,info,mcodekind,pos,adj),constraints,seed,
Ast0.Pure)) in
([Ast.MetaIdDecl(Ast.NONE,nm)],
- Ast0.rewrap param (Ast0.Param(ty,Some new_id)))
+ Ast0.rewrap param (Ast0.Param(ty,Some new_id,attr)))
| _ -> ([],param))
| Ast0.Pdots(d) ->
let nm = (old_name,new_iname "__P" index) in
--
2.21.1
More information about the Linux-kernel-mentees
mailing list