[Linux-kernel-mentees] [PATCH v2 15/32] parsing_cocci: visitor_ast: Visit cast attributes
Jaskaran Singh
jaskaransingh7654321 at gmail.com
Mon May 11 10:06:58 UTC 2020
Cast attributes are added to the SmPL AST. Visit these attributes in the
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