[Linux-kernel-mentees] [PATCH 06/23] parsing_cocci: compute_lines: Reflect Parameter attributes

Julia Lawall julia.lawall at inria.fr
Mon Apr 27 17:03:06 UTC 2020



On Mon, 27 Apr 2020, Jaskaran Singh wrote:

> Parameter attributes are added to the SmPL AST. Reflect these changes in
> compute_lines.ml.
>
> Signed-off-by: Jaskaran Singh <jaskaransingh7654321 at gmail.com>
> ---
>  parsing_cocci/compute_lines.ml | 15 +++++++++------
>  1 file changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/parsing_cocci/compute_lines.ml b/parsing_cocci/compute_lines.ml
> index 1361d842..9bf4ab06 100644
> --- a/parsing_cocci/compute_lines.ml
> +++ b/parsing_cocci/compute_lines.ml
> @@ -914,13 +914,16 @@ and is_param_dots p =
>
>  and parameterTypeDef p =
>    match Ast0.unwrap p with
> -    Ast0.VoidParam(ty) ->
> -      let ty = typeC ty in mkres p (Ast0.VoidParam(ty)) ty ty
> -  | Ast0.Param(ty,Some id) ->
> +    Ast0.VoidParam(ty,attr) ->
> +      let attr = List.map normal_mcode attr in
> +      let ty = typeC ty in mkres p (Ast0.VoidParam(ty,attr)) ty ty

I think you would need to do something with promote_mcode for the attr
cases.  The last argument should reflect the largest line of the whole
term.

julia

> +  | Ast0.Param(ty,Some id,attr) ->
>        let id = ident id in
> -      let ty = typeC ty in mkres p (Ast0.Param(ty,Some id)) ty id
> -  | Ast0.Param(ty,None) ->
> -      let ty = typeC ty in mkres p (Ast0.Param(ty,None)) ty ty
> +      let attr = List.map normal_mcode attr in
> +      let ty = typeC ty in mkres p (Ast0.Param(ty,Some id,attr)) ty id
> +  | Ast0.Param(ty,None,attr) ->
> +      let attr = List.map normal_mcode attr in
> +      let ty = typeC ty in mkres p (Ast0.Param(ty,None,attr)) ty ty
>    | Ast0.MetaParam(name,a,b) ->
>        let name = normal_mcode name in
>        let ln = promote_mcode name in
> --
> 2.21.1
>
>


More information about the Linux-kernel-mentees mailing list