LCOV - code coverage report
Current view: top level - src/dwarf/editor/types - function.rs (source / functions) Coverage Total Hit
Test: lief.lcov Lines: 0.0 % 16 0
Test Date: 2026-04-12:00:00:00 Functions: 0.0 % 5 0

            Line data    Source code
       1              : use lief_ffi as ffi;
       2              : 
       3              : use crate::common::FromFFI;
       4              : use crate::dwarf::editor::types::EditorType;
       5              : 
       6              : /// This structure represents a function type (`DW_TAG_subroutine_type`)
       7              : pub struct Function {
       8              :     ptr: cxx::UniquePtr<ffi::DWARF_editor_FunctionType>,
       9              : }
      10              : 
      11              : impl FromFFI<ffi::DWARF_editor_FunctionType> for Function {
      12            0 :     fn from_ffi(cmd: cxx::UniquePtr<ffi::DWARF_editor_FunctionType>) -> Self {
      13            0 :         Self { ptr: cmd }
      14            0 :     }
      15              : }
      16              : 
      17              : impl EditorType for Function {
      18            0 :     fn get_base(&self) -> &ffi::DWARF_editor_Type {
      19            0 :         self.ptr.as_ref().unwrap().as_ref()
      20            0 :     }
      21              : }
      22              : 
      23              : impl Function {
      24              :     /// Set the return type of this function
      25            0 :     pub fn set_return_type(&mut self, ty: &dyn EditorType) -> &mut Self {
      26            0 :         self.ptr.pin_mut().set_return_type(ty.get_base());
      27            0 :         self
      28            0 :     }
      29              : 
      30              :     /// Add a parameter
      31            0 :     pub fn add_parameter(&mut self, ty: &dyn EditorType) -> Parameter {
      32            0 :         Parameter::from_ffi(self.ptr.pin_mut().add_parameter(ty.get_base()))
      33            0 :     }
      34              : }
      35              : 
      36              : /// This structure represents a function's parameter
      37              : #[allow(dead_code)]
      38              : pub struct Parameter {
      39              :     ptr: cxx::UniquePtr<ffi::DWARF_editor_FunctionType_Parameter>,
      40              : }
      41              : 
      42              : impl FromFFI<ffi::DWARF_editor_FunctionType_Parameter> for Parameter {
      43            0 :     fn from_ffi(cmd: cxx::UniquePtr<ffi::DWARF_editor_FunctionType_Parameter>) -> Self {
      44            0 :         Self { ptr: cmd }
      45            0 :     }
      46              : }
        

Generated by: LCOV version 2.1-1