format chore

This commit is contained in:
2025-11-22 00:37:39 +05:30
parent 377fa4041d
commit a42a75179d
4 changed files with 12 additions and 6 deletions

View File

@ -393,7 +393,9 @@ def _allocate_for_attribute(builder, var_name, rval, local_sym_tab, structs_sym_
# Allocate with the actual IR type
var = _allocate_with_type(builder, var_name, actual_ir_type)
local_sym_tab[var_name] = LocalSymbol(var, actual_ir_type, field) # <-- Store Field metadata
local_sym_tab[var_name] = LocalSymbol(
var, actual_ir_type, field
) # <-- Store Field metadata
logger.info(
f"Pre-allocated {var_name} as {actual_ir_type} from vmlinux struct {vmlinux_struct_name}.{field_name}"

View File

@ -1,6 +1,5 @@
import ast
import logging
from inspect import isclass
from llvmlite import ir
from pythonbpf.expr import eval_expr

View File

@ -12,7 +12,6 @@ from .type_normalization import (
get_base_type_and_depth,
deref_to_depth,
)
from pythonbpf.vmlinux_parser.assignment_info import Field
from .vmlinux_registry import VmlinuxHandlerRegistry
from ..vmlinux_parser.dependency_node import Field

View File

@ -103,7 +103,11 @@ class VmlinuxHandler:
globvar_ir, field_data = self.get_field_type(struct_name, field_name)
builder.function.args[0].type = ir.PointerType(ir.IntType(8))
field_ptr = self.load_ctx_field(
builder, builder.function.args[0], globvar_ir, field_data, struct_name
builder,
builder.function.args[0],
globvar_ir,
field_data,
struct_name,
)
return field_ptr, field_data
else:
@ -125,7 +129,9 @@ class VmlinuxHandler:
raise RuntimeError("Variable accessed not found in symbol table")
@staticmethod
def load_struct_field(builder, struct_ptr_int, offset_global, field_data, struct_name=None):
def load_struct_field(
builder, struct_ptr_int, offset_global, field_data, struct_name=None
):
"""
Generate LLVM IR to load a field from a regular (non-context) struct using standard GEP.
@ -186,7 +192,7 @@ class VmlinuxHandler:
elif field_data.type.__module__ == "vmlinux":
# For pointers to structs or complex vmlinux types
if field_data.ctype_complex_type is not None and issubclass(
field_data.ctype_complex_type, ctypes._Pointer
field_data.ctype_complex_type, ctypes._Pointer
):
int_width = 64 # Pointers are always 64-bit
logger.info("Field is a pointer type, using 64 bits")