[Linux-kernel-mentees] [PATCH 15/23] parsing_cocci: visitor_ast: Visit Parameter attributes
Julia Lawall
julia.lawall at inria.fr
Mon Apr 27 17:13:28 UTC 2020
On Mon, 27 Apr 2020, Jaskaran Singh wrote:
> Parameter attributes are added to the SmPL AST. Visit these attributes in
> the AST visitor.
>
> Signed-off-by: Jaskaran Singh <jaskaransingh7654321 at gmail.com>
> ---
> parsing_cocci/visitor_ast.ml | 22 +++++++++++++++++-----
> 1 file changed, 17 insertions(+), 5 deletions(-)
>
> diff --git a/parsing_cocci/visitor_ast.ml b/parsing_cocci/visitor_ast.ml
> index 8e530114..f1e78d8c 100644
> --- a/parsing_cocci/visitor_ast.ml
> +++ b/parsing_cocci/visitor_ast.ml
> @@ -621,9 +621,18 @@ let combiner bind option_default
> and parameterTypeDef p =
> let k p =
> match Ast.unwrap p with
> - Ast.VoidParam(ty) -> fullType ty
> - | Ast.Param(ty,Some id) -> named_type ty id
> - | Ast.Param(ty,None) -> fullType ty
> + Ast.VoidParam(ty,attr) ->
> + let lty = fullType ty in
> + let lattr = multibind (List.map string_mcode attr) in
> + bind lty lattr
There are some more inconsistent indentations here.
julia
> + | Ast.Param(ty,Some id,attr) ->
> + let lid = named_type ty id in
> + let lattr = multibind (List.map string_mcode attr) in
> + bind lid lattr
> + | Ast.Param(ty,None,attr) ->
> + let lty = fullType ty in
> + let lattr = multibind (List.map string_mcode attr) in
> + bind lty lattr
> | Ast.MetaParam(name,_,_,_) -> meta_mcode name
> | Ast.MetaParamList(name,_,_,_,_) -> meta_mcode name
> | Ast.AsParam(p,asexp) ->
> @@ -1582,8 +1591,11 @@ let rebuilder
> let k p =
> Ast.rewrap p
> (match Ast.unwrap p with
> - Ast.VoidParam(ty) -> Ast.VoidParam(fullType ty)
> - | Ast.Param(ty,id) -> Ast.Param(fullType ty, get_option ident id)
> + Ast.VoidParam(ty,attr) ->
> + Ast.VoidParam(fullType ty,List.map string_mcode attr)
> + | Ast.Param(ty,id,attr) ->
> + Ast.Param
> + (fullType ty, get_option ident id,List.map string_mcode attr)
> | Ast.MetaParam(name,constraints,keep,inherited) ->
> Ast.MetaParam(meta_mcode name,constraints,keep,inherited)
> | Ast.MetaParamList(name,lenname_inh,constraints,keep,inherited) ->
> --
> 2.21.1
>
>
More information about the Linux-kernel-mentees
mailing list