[Linux-kernel-mentees] [PATCH 22/30] parsing_c: visitor_c: Reflect Macrodecl attributes

Jaskaran Singh jaskaransingh7654321 at gmail.com
Sun May 24 17:19:27 UTC 2020


Macrodecl 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 | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/parsing_c/visitor_c.ml b/parsing_c/visitor_c.ml
index 57b5f32b..3cc73ea8 100644
--- a/parsing_c/visitor_c.ml
+++ b/parsing_c/visitor_c.ml
@@ -548,8 +548,9 @@ and vk_decl = fun bigf d ->
         iif ii;
         vk_onedecl bigf x
       );
-    | MacroDecl ((_stob, s, args, ptvg),ii) ->
+    | MacroDecl ((_stob, s, args, attrs, ptvg),ii) ->
         iif ii;
+        attrs +> List.iter (vk_attribute bigf);
         vk_argument_list bigf args
     | MacroDeclInit ((_stob, s, args, ini),ii) ->
         iif ii;
@@ -1464,10 +1465,11 @@ and vk_decl_s = fun bigf d ->
     | DeclList (xs, ii) ->
         DeclList (List.map (fun (x,ii) -> (vk_onedecl_s bigf x, iif ii)) xs,
 		  iif ii)
-    | MacroDecl ((stob, s, args, ptvg),ii) ->
+    | MacroDecl ((stob, s, args, attrs, ptvg),ii) ->
         MacroDecl
           ((stob, s,
            args +> List.map (fun (e,ii) -> vk_argument_s bigf e, iif ii),
+           attrs +> List.map (vk_attribute_s bigf),
            ptvg),
           iif ii)
     | MacroDeclInit ((stob, s, args, ini),ii) ->
-- 
2.21.1



More information about the Linux-kernel-mentees mailing list