@@ -524,20 +524,22 @@ def _handle_boolean_op(
524524 logger .error (f"Unsupported boolean operator: { type (expr .op ).__name__ } " )
525525 return None
526526
527+
527528# ============================================================================
528529# VMLinux casting
529530# ============================================================================
530531
532+
531533def _handle_vmlinux_cast (
532- func ,
533- module ,
534- builder ,
535- expr ,
536- local_sym_tab ,
537- map_sym_tab ,
538- structs_sym_tab = None ,
534+ func ,
535+ module ,
536+ builder ,
537+ expr ,
538+ local_sym_tab ,
539+ map_sym_tab ,
540+ structs_sym_tab = None ,
539541):
540- # handle expressions such as struct_request(ctx.di) where struct_request is a vmlinux
542+ # handle expressions such as struct_request(ctx.di) where struct_request is a vmlinux
541543 # struct and ctx.di is a pointer to a struct but is actually represented as a c_uint64
542544 # which needs to be cast to a pointer. This is also a field of another vmlinux struct
543545 """Handle vmlinux struct cast expressions like struct_request(ctx.di)."""
@@ -572,7 +574,7 @@ def _handle_vmlinux_cast(
572574 # Cast the integer/value to a pointer to the struct
573575 # If arg_val is an integer type, we need to inttoptr it
574576 ptr_type = ir .PointerType ()
575- #TODO: add a integer check here later
577+ # TODO: add a integer check here later
576578 if ctypes_to_ir (arg_type .type .__name__ ):
577579 # Cast integer to pointer
578580 casted_ptr = builder .inttoptr (arg_val , ptr_type )
@@ -603,8 +605,10 @@ def eval_expr(
603605 elif isinstance (expr , ast .Constant ):
604606 return _handle_constant_expr (module , builder , expr )
605607 elif isinstance (expr , ast .Call ):
606- if isinstance (expr .func , ast .Name ) and VmlinuxHandlerRegistry .is_vmlinux_struct (expr .func .id ):
607- return _handle_vmlinux_cast (
608+ if isinstance (expr .func , ast .Name ) and VmlinuxHandlerRegistry .is_vmlinux_struct (
609+ expr .func .id
610+ ):
611+ return _handle_vmlinux_cast (
608612 func ,
609613 module ,
610614 builder ,
0 commit comments