[Linux-kernel-mentees] [PATCH 15/32] parsing_cocci: visitor_ast: Visit cast attributes

Julia Lawall julia.lawall at inria.fr
Sun May 3 19:29:51 UTC 2020



On Tue, 28 Apr 2020, Jaskaran Singh wrote:

> Cast attributes are added to AST0 of SmPL. Visit these attributes in the

AST0 -> AST

julia

> SmPL AST visitor.
>
> Signed-off-by: Jaskaran Singh <jaskaransingh7654321 at gmail.com>
> ---
>  parsing_cocci/visitor_ast.ml | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/parsing_cocci/visitor_ast.ml b/parsing_cocci/visitor_ast.ml
> index 8e530114..644bcd5d 100644
> --- a/parsing_cocci/visitor_ast.ml
> +++ b/parsing_cocci/visitor_ast.ml
> @@ -198,12 +198,13 @@ let combiner bind option_default
>  	  let lar = string_mcode ar in
>  	  let lfield = ident field in
>  	  multibind [lexp; lar; lfield]
> -      | Ast.Cast(lp,ty,rp,exp) ->
> +      | Ast.Cast(lp,ty,attr,rp,exp) ->
>  	  let llp = string_mcode lp in
>  	  let lty = fullType ty in
> +	  let lattr = multibind (List.map string_mcode attr) in
>  	  let lrp = string_mcode rp in
>  	  let lexp = expression exp in
> -	  multibind [llp; lty; lrp; lexp]
> +          multibind [llp; lty; lattr; lrp; lexp]
>        | Ast.SizeOfExpr(szf,exp) ->
>  	  let lszf = string_mcode szf in
>  	  let lexp = expression exp in
> @@ -1184,12 +1185,13 @@ let rebuilder
>  	    let lar = string_mcode ar in
>  	    let lfield = ident field in
>  	    Ast.RecordPtAccess(lexp, lar, lfield)
> -	| Ast.Cast(lp,ty,rp,exp) ->
> +	| Ast.Cast(lp,ty,attr,rp,exp) ->
>  	    let llp = string_mcode lp in
>  	    let lty = fullType ty in
> +	    let lattr = List.map string_mcode attr in
>  	    let lrp = string_mcode rp in
>  	    let lexp = expression exp in
> -	    Ast.Cast(llp, lty, lrp, lexp)
> +	    Ast.Cast(llp, lty, lattr, lrp, lexp)
>  	| Ast.SizeOfExpr(szf,exp) ->
>  	    let lszf = string_mcode szf in
>  	    let lexp = expression exp in
> --
> 2.21.1
>
>


More information about the Linux-kernel-mentees mailing list