separate vmlinux class handler

This commit is contained in:
2025-10-11 04:19:26 +05:30
parent 68e9693f9a
commit 2483ef2840
4 changed files with 34 additions and 3 deletions

1
.gitignore vendored
View File

@ -8,3 +8,4 @@ __pycache__/
*.o
.ipynb_checkpoints/
vmlinux.py
~*

View File

@ -0,0 +1 @@
# This will contain a node class that has special properties to be a dependency tree node

View File

@ -1,7 +1,7 @@
import ast
import logging
import llvmlite.ir as ir
from typing import List, Tuple
from .vmlinux_class_handler import process_vmlinux_class
logger = logging.getLogger(__name__)
@ -70,6 +70,27 @@ def detect_import_statement(tree: ast.AST) -> List[Tuple[str, str]]:
logger.info(f"Total vmlinux imports detected: {len(vmlinux_imports)}")
return vmlinux_imports
def vmlinux_proc(tree, module):
def vmlinux_proc(tree: ast.AST, module):
import_statements = detect_import_statement(tree)
logger.info(f"Import statements {import_statements}")
if not import_statements:
logger.info("No vmlinux imports found")
return
vmlinux_types = set()
for module_name, imported_item in import_statements:
vmlinux_types.add(imported_item)
logger.info(f"Registered vmlinux type: {imported_item}")
for node in ast.walk(tree):
if isinstance(node, ast.ClassDef):
# Check if this class uses vmlinux types
logger.info(f"Processing ClassDef with vmlinux types: {node.name}")
process_vmlinux_class(node, module, vmlinux_types)
elif isinstance(node, ast.Assign):
logger.info(f"Processing Assign with vmlinux types")
process_vmlinux_assign(node, module, vmlinux_types)
def process_vmlinux_assign(node, module, vmlinux_types):
raise NotImplementedError("Assignment handling has not been implemented yet")

View File

@ -0,0 +1,8 @@
import ast
import logging
logger = logging.getLogger(__name__)
def process_vmlinux_class(node, module, vmlinux_types):
# Process ClassDef nodes that use vmlinux imports
pass