format chore

This commit is contained in:
2025-10-13 19:00:59 +05:30
parent 0b4c6264a8
commit 20ec307288
2 changed files with 19 additions and 6 deletions

View File

@ -48,7 +48,9 @@ def process_vmlinux_post_ast(
# XXX:Check it's use. It's probably not being used. # XXX:Check it's use. It's probably not being used.
if current_symbol_name in processing_stack: if current_symbol_name in processing_stack:
logger.debug(f"Dependency already in processing stack for {current_symbol_name}, skipping") logger.debug(
f"Dependency already in processing stack for {current_symbol_name}, skipping"
)
return True return True
processing_stack.add(current_symbol_name) processing_stack.add(current_symbol_name)
@ -93,7 +95,9 @@ def process_vmlinux_post_ast(
if local_module_name == ctypes.__name__: if local_module_name == ctypes.__name__:
new_dep_node.set_field_bitfield_size(elem_name, elem_bitfield_size) new_dep_node.set_field_bitfield_size(elem_name, elem_bitfield_size)
new_dep_node.set_field_ready(elem_name, is_ready=True) new_dep_node.set_field_ready(elem_name, is_ready=True)
logger.debug(f"Field {elem_name} is direct ctypes type: {elem_type}") logger.debug(
f"Field {elem_name} is direct ctypes type: {elem_type}"
)
elif local_module_name == "vmlinux": elif local_module_name == "vmlinux":
new_dep_node.set_field_bitfield_size(elem_name, elem_bitfield_size) new_dep_node.set_field_bitfield_size(elem_name, elem_bitfield_size)
logger.debug( logger.debug(
@ -131,7 +135,9 @@ def process_vmlinux_post_ast(
) )
new_dep_node.set_field_type(elem_name, elem_type) new_dep_node.set_field_type(elem_name, elem_type)
if containing_type.__module__ == "vmlinux": if containing_type.__module__ == "vmlinux":
process_vmlinux_post_ast(containing_type, llvm_handler, handler, processing_stack) process_vmlinux_post_ast(
containing_type, llvm_handler, handler, processing_stack
)
new_dep_node.set_field_ready(elem_name, True) new_dep_node.set_field_ready(elem_name, True)
elif containing_type.__module__ == ctypes.__name__: elif containing_type.__module__ == ctypes.__name__:
logger.debug(f"Processing ctype internal{containing_type}") logger.debug(f"Processing ctype internal{containing_type}")
@ -141,7 +147,9 @@ def process_vmlinux_post_ast(
"Module not supported in recursive resolution" "Module not supported in recursive resolution"
) )
else: else:
process_vmlinux_post_ast(elem_type, llvm_handler, handler, processing_stack) process_vmlinux_post_ast(
elem_type, llvm_handler, handler, processing_stack
)
new_dep_node.set_field_ready(elem_name, True) new_dep_node.set_field_ready(elem_name, True)
else: else:
raise ValueError( raise ValueError(
@ -151,5 +159,7 @@ def process_vmlinux_post_ast(
else: else:
raise ImportError("UNSUPPORTED Module") raise ImportError("UNSUPPORTED Module")
logging.info(f"{current_symbol_name} processed and handler readiness {handler.is_ready}") logging.info(
f"{current_symbol_name} processed and handler readiness {handler.is_ready}"
)
return True return True

View File

@ -3,9 +3,12 @@ from .dependency_handler import DependencyHandler
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
class IRGenerator: class IRGenerator:
def __init__(self, module, handler: DependencyHandler): def __init__(self, module, handler: DependencyHandler):
self.module = module self.module = module
self.handler: DependencyHandler = handler self.handler: DependencyHandler = handler
if not handler.is_ready: if not handler.is_ready:
raise ImportError("Semantic analysis of vmlinux imports failed. Cannot generate IR") raise ImportError(
"Semantic analysis of vmlinux imports failed. Cannot generate IR"
)