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 <jaskaransingh7654...@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
>
>
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to