(
g: NativeFunctionsGroup | NativeFunction, kernel_index: ETKernelIndex
)
| 370 | |
| 371 | @with_native_function_and_index # type: ignore[arg-type] |
| 372 | def compute_native_function_declaration( |
| 373 | g: NativeFunctionsGroup | NativeFunction, kernel_index: ETKernelIndex |
| 374 | ) -> list[str]: |
| 375 | assert isinstance(g, NativeFunction) |
| 376 | sig = ExecutorchCppSignature.from_native_function(f=g) |
| 377 | metadata_list = kernel_index.get_kernels(g).values() |
| 378 | if metadata_list is None: |
| 379 | return [] |
| 380 | |
| 381 | # for kernels in lean mode, we declare two versions, one with context and one without. |
| 382 | # In the end we will cleanup the unused one. |
| 383 | def gen_decl(metadata: BackendMetadata, include_context: bool) -> str: |
| 384 | return f"{sig.decl(name=metadata.kernel, include_context=include_context)};" |
| 385 | |
| 386 | return [ |
| 387 | gen_decl(metadata, include_context) |
| 388 | for include_context in [False, True] |
| 389 | for metadata in metadata_list |
| 390 | ] |
| 391 | |
| 392 | |
| 393 | def gen_functions_declarations( |
nothing calls this directly
no test coverage detected