[Linux-kernel-mentees] [PATCH 25/32] parsing_c: visitor_c: Visit Cast attributes

Jaskaran Singh jaskaransingh7654321 at gmail.com
Tue Apr 28 17:02:21 UTC 2020


Cast attributes are added to the C AST. Visit these attributes in
the C AST visitor.

Signed-off-by: Jaskaran Singh <jaskaransingh7654321 at gmail.com>
---
 parsing_c/visitor_c.ml | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/parsing_c/visitor_c.ml b/parsing_c/visitor_c.ml
index 57b5f32b..1a522413 100644
--- a/parsing_c/visitor_c.ml
+++ b/parsing_c/visitor_c.ml
@@ -324,7 +324,9 @@ let rec vk_expr = fun bigf expr ->
 
     | SizeOfExpr  (e) -> exprf e
     | SizeOfType  (t) -> vk_type bigf t
-    | Cast    (t, e) -> vk_type bigf t; exprf e
+    | Cast    (t, e, a) ->
+        vk_type bigf t; exprf e;
+        a +> List.iter (vk_attribute bigf)
 
     (* old: | StatementExpr (((declxs, statxs), is)), is2 ->
      *          List.iter (vk_decl bigf) declxs;
@@ -1188,7 +1190,11 @@ let rec vk_expr_s = fun bigf expr ->
 
       | SizeOfExpr  (e) -> SizeOfExpr (exprf e)
       | SizeOfType  (t) -> SizeOfType (vk_type_s bigf t)
-      | Cast    (t, e)  -> Cast (vk_type_s bigf t, exprf e)
+      | Cast    (t, e, a)  ->
+          Cast
+            (vk_type_s bigf t,
+             exprf e,
+             a +> List.map (vk_attribute_s bigf))
 
       | StatementExpr (statxs, is) ->
           StatementExpr (
-- 
2.21.1



More information about the Linux-kernel-mentees mailing list