File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22from llvmlite import ir
33from .type_deducer import ctypes_to_ir
44
5- structs_sym_tab = {}
5+
6+ def is_bpf_struct (cls_node ):
7+ return any (
8+ isinstance (decorator , ast .Name ) and decorator .id == "struct"
9+ for decorator in cls_node .decorator_list
10+ )
611
712
813def structs_proc (tree , module , chunks ):
914 """ Process all class definitions to find BPF structs """
15+ structs_sym_tab = {}
1016 for cls_node in chunks :
11- # Check if this class is a struct
12- is_struct = False
13- for decorator in cls_node .decorator_list :
14- if isinstance (decorator , ast .Name ) and decorator .id == "struct" :
15- is_struct = True
16- break
17- if is_struct :
17+ if is_bpf_struct (cls_node ):
1818 print (f"Found BPF struct: { cls_node .name } " )
19- process_bpf_struct (cls_node , module )
20- continue
19+ struct_info = process_bpf_struct (cls_node , module )
20+ structs_sym_tab [ cls_node . name ] = struct_info
2121 return structs_sym_tab
2222
2323
You can’t perform that action at this time.
0 commit comments