[Linux-kernel-mentees] [PATCH 03/23] parsing_cocci: visitor_ast0: Visit Parameter attributes

Jaskaran Singh jaskaransingh7654321 at gmail.com
Mon Apr 27 12:08:14 UTC 2020


Parameter attributes are added to AST0 of SmPL. Visit these attributes
in the AST0 visitor.

Signed-off-by: Jaskaran Singh <jaskaransingh7654321 at gmail.com>
---
 parsing_cocci/visitor_ast0.ml | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/parsing_cocci/visitor_ast0.ml b/parsing_cocci/visitor_ast0.ml
index d9e340ed..d6feccb7 100644
--- a/parsing_cocci/visitor_ast0.ml
+++ b/parsing_cocci/visitor_ast0.ml
@@ -826,14 +826,18 @@ let visitor mode bind option_default
     let k p =
       rewrap p
 	(match Ast0.unwrap p with
-	  Ast0.VoidParam(ty) ->
-	    let (n,ty) = typeC ty in (n,Ast0.VoidParam(ty))
-	| Ast0.Param(ty,Some id) ->
+	  Ast0.VoidParam(ty, attrs) ->
+	    let (ty_n,ty) = typeC ty in
+	    let (attr_n,attr) = map_split_bind string_mcode attrs in
+            (bind ty_n attr_n,Ast0.VoidParam(ty, attrs))
+	| Ast0.Param(ty,Some id,attrs) ->
 	    let ((ty_id_n,ty),id) = named_type ty id in
-	    (ty_id_n, Ast0.Param(ty,Some id))
-	| Ast0.Param(ty,None) ->
+	    let (attr_n,attr) = map_split_bind string_mcode attrs in
+	    (bind ty_id_n attr_n, Ast0.Param(ty,Some id,attr))
+	| Ast0.Param(ty,None,attrs) ->
 	    let (ty_n,ty) = typeC ty in
-	    (ty_n, Ast0.Param(ty,None))
+	    let (attr_n,attr) = map_split_bind string_mcode attrs in
+	    (bind ty_n attr_n, Ast0.Param(ty,None,attr))
 	| Ast0.MetaParam(name,constraints,pure) ->
 	    let (n,name) = meta_mcode name in
 	    (n,Ast0.MetaParam(name,constraints,pure))
-- 
2.21.1



More information about the Linux-kernel-mentees mailing list