|
1 | 1 | import ast |
2 | 2 | import logging |
3 | | -import llvmlite.ir as ir |
4 | 3 | from typing import List, Tuple |
| 4 | +from .vmlinux_class_handler import process_vmlinux_class |
5 | 5 |
|
6 | 6 | logger = logging.getLogger(__name__) |
7 | 7 |
|
@@ -70,6 +70,27 @@ def detect_import_statement(tree: ast.AST) -> List[Tuple[str, str]]: |
70 | 70 | logger.info(f"Total vmlinux imports detected: {len(vmlinux_imports)}") |
71 | 71 | return vmlinux_imports |
72 | 72 |
|
73 | | -def vmlinux_proc(tree, module): |
| 73 | +def vmlinux_proc(tree: ast.AST, module): |
74 | 74 | import_statements = detect_import_statement(tree) |
75 | | - logger.info(f"Import statements {import_statements}") |
| 75 | + |
| 76 | + if not import_statements: |
| 77 | + logger.info("No vmlinux imports found") |
| 78 | + return |
| 79 | + |
| 80 | + vmlinux_types = set() |
| 81 | + for module_name, imported_item in import_statements: |
| 82 | + vmlinux_types.add(imported_item) |
| 83 | + logger.info(f"Registered vmlinux type: {imported_item}") |
| 84 | + |
| 85 | + for node in ast.walk(tree): |
| 86 | + if isinstance(node, ast.ClassDef): |
| 87 | + # Check if this class uses vmlinux types |
| 88 | + logger.info(f"Processing ClassDef with vmlinux types: {node.name}") |
| 89 | + process_vmlinux_class(node, module, vmlinux_types) |
| 90 | + |
| 91 | + elif isinstance(node, ast.Assign): |
| 92 | + logger.info(f"Processing Assign with vmlinux types") |
| 93 | + process_vmlinux_assign(node, module, vmlinux_types) |
| 94 | + |
| 95 | +def process_vmlinux_assign(node, module, vmlinux_types): |
| 96 | + raise NotImplementedError("Assignment handling has not been implemented yet") |
0 commit comments