cocci.inria.fr archive mirror
 help / color / mirror / Atom feed
From: Julia Lawall <julia.lawall@inria.fr>
To: Jaskaran Singh <jaskaransingh7654321@gmail.com>
Cc: linux-kernel-mentees@lists.linuxfoundation.org, cocci@systeme.lip6.fr
Subject: Re: [Cocci] [PATCH 15/23] parsing_cocci: visitor_ast: Visit Parameter attributes
Date: Mon, 27 Apr 2020 19:13:28 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.21.2004271913060.12657@hadrien> (raw)
In-Reply-To: <20200427120834.380-16-jaskaransingh7654321@gmail.com>



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

  reply	other threads:[~2020-04-27 17:13 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-27 12:08 [Cocci] [PATCH 00/23] cocci: Add parameter attributes to SmPL Jaskaran Singh
2020-04-27 12:08 ` [Cocci] [PATCH 01/23] parsing_cocci: ast0_cocci: Add parameter attributes Jaskaran Singh
2020-04-27 12:08 ` [Cocci] [PATCH 02/23] parsing_cocci: parser: Parse Parameter attributes Jaskaran Singh
2020-04-27 12:08 ` [Cocci] [PATCH 03/23] parsing_cocci: visitor_ast0: Visit " Jaskaran Singh
2020-04-27 12:08 ` [Cocci] [PATCH 04/23] parsing_cocci: arity: Reflect " Jaskaran Singh
2020-04-27 12:08 ` [Cocci] [PATCH 05/23] parsing_cocci: check_meta: " Jaskaran Singh
2020-04-27 17:00   ` Julia Lawall
2020-04-27 12:08 ` [Cocci] [PATCH 06/23] parsing_cocci: compute_lines: " Jaskaran Singh
2020-04-27 17:03   ` Julia Lawall
2020-04-27 12:08 ` [Cocci] [PATCH 07/23] parsing_cocci: context_neg: " Jaskaran Singh
2020-04-27 12:08 ` [Cocci] [PATCH 08/23] parsing_cocci: function_prototypes: " Jaskaran Singh
2020-04-27 12:08 ` [Cocci] [PATCH 09/23] parsing_cocci: index: " Jaskaran Singh
2020-04-27 12:08 ` [Cocci] [PATCH 10/23] parsing_cocci: iso_pattern: " Jaskaran Singh
2020-04-27 17:06   ` Julia Lawall
2020-04-27 12:08 ` [Cocci] [PATCH 11/23] parsing_cocci: type_infer: " Jaskaran Singh
2020-04-27 12:08 ` [Cocci] [PATCH 12/23] parsing_cocci: unparse_ast0: " Jaskaran Singh
2020-04-27 17:09   ` Julia Lawall
2020-04-27 12:08 ` [Cocci] [PATCH 13/23] parsing_c: unparse_cocci: " Jaskaran Singh
2020-04-27 12:08 ` [Cocci] [PATCH 14/23] parsing_cocci: ast_cocci: Add " Jaskaran Singh
2020-04-27 12:08 ` [Cocci] [PATCH 15/23] parsing_cocci: visitor_ast: Visit " Jaskaran Singh
2020-04-27 17:13   ` Julia Lawall [this message]
2020-04-27 12:08 ` [Cocci] [PATCH 16/23] parsing_cocci: ast0toast: Reflect " Jaskaran Singh
2020-04-27 12:08 ` [Cocci] [PATCH 17/23] parsing_cocci: disjdistr: " Jaskaran Singh
2020-04-27 12:08 ` [Cocci] [PATCH 18/23] parsing_cocci: pretty_print_cocci: " Jaskaran Singh
2020-04-27 12:08 ` [Cocci] [PATCH 19/23] parsing_cocci: unify_ast: " Jaskaran Singh
2020-04-27 12:08 ` [Cocci] [PATCH 20/23] engine: cocci_vs_c: Match " Jaskaran Singh
2020-04-27 12:08 ` [Cocci] [PATCH 21/23] ocaml: coccilib: Reflect " Jaskaran Singh
2020-04-27 12:08 ` [Cocci] [PATCH 22/23] tests: Add test case for removing parameter attributes Jaskaran Singh
2020-04-27 17:31   ` Julia Lawall
2020-04-28 12:43     ` Jaskaran Singh
2020-04-27 12:08 ` [Cocci] [PATCH 23/23] tests: Add test case to detect " Jaskaran Singh
2020-04-27 12:21 ` [Cocci] [PATCH v2 08/23] parsing_cocci: function_prototypes: Reflect Parameter attributes Jaskaran Singh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.21.2004271913060.12657@hadrien \
    --to=julia.lawall@inria.fr \
    --cc=cocci@systeme.lip6.fr \
    --cc=jaskaransingh7654321@gmail.com \
    --cc=linux-kernel-mentees@lists.linuxfoundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).