(func_decl: c_ast.FuncDecl)
| 233 | fields = [] |
| 234 | for decl in node.decls: |
| 235 | fname = decl.name or "" |
| 236 | ftype = _decl_type_to_str(decl.type) |
| 237 | is_ptr = isinstance(decl.type, c_ast.PtrDecl) |
| 238 | bitfield = None |
| 239 | if decl.bitsize and isinstance(decl.bitsize, c_ast.Constant): |
| 240 | bitfield = int(decl.bitsize.value) |
| 241 | fields.append(StructField(name=fname, c_type=ftype, is_pointer=is_ptr, bitfield=bitfield)) |
| 242 | return StructDef(name=node.name or "", fields=fields) |
| 243 | |
| 244 | |
| 245 | def _extract_func_params(func_decl: c_ast.FuncDecl) -> tuple[list[FuncParam], bool]: |
| 246 | params: list[FuncParam] = [] |
| 247 | is_variadic = False |
| 248 | if func_decl.args is None: |
| 249 | return params, False |
| 250 | for param in func_decl.args.params or []: |
| 251 | if isinstance(param, c_ast.EllipsisParam): |
| 252 | is_variadic = True |
| 253 | continue |
| 254 | if isinstance(param, c_ast.Typename): |
| 255 | ptype = _decl_type_to_str(param.type) |
| 256 | if ptype == "void": |
| 257 | continue |
| 258 | params.append(FuncParam(name="", c_type=ptype)) |
no test coverage detected