LCOV - code coverage report
Current view: top level - src/dwarf - types.rs (source / functions) Coverage Total Hit
Test: lief.lcov Lines: 0.0 % 297 0
Test Date: 2026-02-28:00:00:00 Functions: 0.0 % 268 0

            Line data    Source code
       1              : use lief_ffi as ffi;
       2              : 
       3              : use crate::{common::FromFFI, Error};
       4              : 
       5              : use crate::to_conv_result;
       6              : use std::marker::PhantomData;
       7              : use crate::debug_location::DebugLocation;
       8              : use crate::dwarf::Scope;
       9              : use crate::common::into_optional;
      10              : use crate::declare_fwd_iterator;
      11              : use crate::DeclOpt;
      12              : 
      13              : pub mod classlike;
      14              : pub mod pointer;
      15              : pub mod const_ty;
      16              : pub mod base;
      17              : pub mod array;
      18              : pub mod typedef;
      19              : pub mod atomic;
      20              : pub mod coarray;
      21              : pub mod dynamic;
      22              : pub mod enum_type;
      23              : pub mod file;
      24              : pub mod immutable;
      25              : pub mod interface;
      26              : pub mod pointer_to_member;
      27              : pub mod rvalue_ref;
      28              : pub mod reference;
      29              : pub mod restrict;
      30              : pub mod set_type;
      31              : pub mod shared;
      32              : pub mod string;
      33              : pub mod subroutine;
      34              : pub mod template_alias;
      35              : pub mod thrown;
      36              : pub mod volatile;
      37              : 
      38              : #[doc(inline)]
      39              : pub use classlike::Structure;
      40              : 
      41              : #[doc(inline)]
      42              : pub use classlike::Class;
      43              : 
      44              : #[doc(inline)]
      45              : pub use classlike::Union;
      46              : 
      47              : #[doc(inline)]
      48              : pub use classlike::Packed;
      49              : 
      50              : #[doc(inline)]
      51              : pub use classlike::ClassLike;
      52              : 
      53              : #[doc(inline)]
      54              : pub use pointer::Pointer;
      55              : 
      56              : #[doc(inline)]
      57              : pub use const_ty::Const;
      58              : 
      59              : #[doc(inline)]
      60              : pub use base::Base;
      61              : 
      62              : #[doc(inline)]
      63              : pub use array::Array;
      64              : 
      65              : #[doc(inline)]
      66              : pub use typedef::Typedef;
      67              : 
      68              : #[doc(inline)]
      69              : pub use atomic::Atomic;
      70              : 
      71              : #[doc(inline)]
      72              : pub use coarray::Coarray;
      73              : 
      74              : #[doc(inline)]
      75              : pub use dynamic::Dynamic;
      76              : 
      77              : #[doc(inline)]
      78              : pub use file::File;
      79              : 
      80              : #[doc(inline)]
      81              : pub use immutable::Immutable;
      82              : 
      83              : #[doc(inline)]
      84              : pub use enum_type::Enum;
      85              : 
      86              : #[doc(inline)]
      87              : pub use interface::Interface;
      88              : 
      89              : #[doc(inline)]
      90              : pub use pointer_to_member::PointerToMember;
      91              : 
      92              : #[doc(inline)]
      93              : pub use rvalue_ref::RValueReference;
      94              : 
      95              : #[doc(inline)]
      96              : pub use reference::Reference;
      97              : 
      98              : #[doc(inline)]
      99              : pub use restrict::Restrict;
     100              : 
     101              : #[doc(inline)]
     102              : pub use set_type::SetTy;
     103              : 
     104              : #[doc(inline)]
     105              : pub use shared::Shared;
     106              : 
     107              : #[doc(inline)]
     108              : pub use string::StringTy;
     109              : 
     110              : #[doc(inline)]
     111              : pub use subroutine::Subroutine;
     112              : 
     113              : #[doc(inline)]
     114              : pub use template_alias::TemplateAlias;
     115              : 
     116              : #[doc(inline)]
     117              : pub use thrown::Thrown;
     118              : 
     119              : #[doc(inline)]
     120              : pub use volatile::Volatile;
     121              : 
     122              : /// This enum represents a DWARF Type which includes:
     123              : ///
     124              : /// - `DW_TAG_array_type`
     125              : /// - `DW_TAG_atomic_type`
     126              : /// - `DW_TAG_base_type`
     127              : /// - `DW_TAG_class_type`
     128              : /// - `DW_TAG_coarray_type`
     129              : /// - `DW_TAG_const_type`
     130              : /// - `DW_TAG_dynamic_type`
     131              : /// - `DW_TAG_enumeration_type`
     132              : /// - `DW_TAG_file_type`
     133              : /// - `DW_TAG_immutable_type`
     134              : /// - `DW_TAG_interface_type`
     135              : /// - `DW_TAG_packed_type`
     136              : /// - `DW_TAG_pointer_type`
     137              : /// - `DW_TAG_ptr_to_member_type`
     138              : /// - `DW_TAG_reference_type`
     139              : /// - `DW_TAG_restrict_type`
     140              : /// - `DW_TAG_rvalue_reference_type`
     141              : /// - `DW_TAG_set_type`
     142              : /// - `DW_TAG_shared_type`
     143              : /// - `DW_TAG_string_type`
     144              : /// - `DW_TAG_structure_type`
     145              : /// - `DW_TAG_subroutine_type`
     146              : /// - `DW_TAG_template_alias`
     147              : /// - `DW_TAG_thrown_type`
     148              : /// - `DW_TAG_typedef`
     149              : /// - `DW_TAG_union_type`
     150              : /// - `DW_TAG_unspecified_type`
     151              : /// - `DW_TAG_volatile_type`d_type`
     152              : pub enum Type<'a> {
     153              :     /// Interface over `DW_TAG_structure_type`
     154              :     Structure(Structure<'a>),
     155              : 
     156              :     /// Interface over `DW_TAG_class_type`
     157              :     Class(Class<'a>),
     158              : 
     159              :     /// Interface over `DW_TAG_union_type`
     160              :     Union(Union<'a>),
     161              : 
     162              :     /// Interface over `DW_TAG_packed_type`
     163              :     Packed(Packed<'a>),
     164              : 
     165              :     /// Interface over `DW_TAG_pointer_type`
     166              :     Pointer(Pointer<'a>),
     167              : 
     168              :     /// Interface over `DW_TAG_const_type`
     169              :     Const(Const<'a>),
     170              : 
     171              :     /// Interface over `DW_TAG_base_type`
     172              :     Base(Base<'a>),
     173              : 
     174              :     /// Interface over `DW_TAG_array_type`
     175              :     Array(Array<'a>),
     176              : 
     177              :     /// Interface over `DW_TAG_typedef`
     178              :     Typedef(Typedef<'a>),
     179              : 
     180              :     /// Interface over `DW_TAG_atomic_type`
     181              :     Atomic(Atomic<'a>),
     182              : 
     183              :     /// Interface over `DW_TAG_coarray_type`
     184              :     Coarray(Coarray<'a>),
     185              : 
     186              :     /// Interface over `DW_TAG_dynamic_type`
     187              :     Dynamic(Dynamic<'a>),
     188              : 
     189              :     /// Interface over `DW_TAG_enumeration_type`
     190              :     Enum(Enum<'a>),
     191              : 
     192              :     /// Interface over `DW_TAG_file_type`
     193              :     File(File<'a>),
     194              : 
     195              :     /// Interface over `DW_TAG_immutable_type`
     196              :     Immutable(Immutable<'a>),
     197              : 
     198              :     /// Interface over `DW_TAG_interface_type`
     199              :     Interface(Interface<'a>),
     200              : 
     201              :     /// Interface over `DW_TAG_ptr_to_member_type`
     202              :     PointerToMember(PointerToMember<'a>),
     203              : 
     204              :     /// Interface over `DW_TAG_rvalue_reference_type`
     205              :     RValueReference(RValueReference<'a>),
     206              : 
     207              :     /// Interface over `DW_TAG_reference_type`
     208              :     Reference(Reference<'a>),
     209              : 
     210              :     /// Interface over `DW_TADW_TAG_restrict_type`
     211              :     Restrict(Restrict<'a>),
     212              : 
     213              :     /// Interface over `DW_TAG_set_type`
     214              :     SetTy(SetTy<'a>),
     215              : 
     216              :     /// Interface over `DW_TAG_shared_type`
     217              :     Shared(Shared<'a>),
     218              : 
     219              :     /// Interface over `DW_TAG_string_type`
     220              :     StringTy(StringTy<'a>),
     221              : 
     222              :     /// Interface over `DW_TAG_subroutine_type`
     223              :     Subroutine(Subroutine<'a>),
     224              : 
     225              :     /// Interface over `DW_TAG_template_alias`
     226              :     TemplateAlias(TemplateAlias<'a>),
     227              : 
     228              :     /// Interface over `DW_TAG_thrown_type`
     229              :     Thrown(Thrown<'a>),
     230              : 
     231              :     /// Interface over `DW_TAG_volatile_type`
     232              :     Volatile(Volatile<'a>),
     233              : 
     234              :     /// Generic type (fallback value)
     235              :     Generic(Generic<'a>),
     236              : }
     237              : 
     238              : impl FromFFI<ffi::DWARF_Type> for Type<'_> {
     239            0 :     fn from_ffi(ffi_entry: cxx::UniquePtr<ffi::DWARF_Type>) -> Self {
     240            0 :         unsafe {
     241            0 :             let type_ref = ffi_entry.as_ref().unwrap();
     242            0 : 
     243            0 :             if ffi::DWARF_types_Structure::classof(type_ref) {
     244            0 :                 let raw = {
     245            0 :                     type From = cxx::UniquePtr<ffi::DWARF_Type>;
     246            0 :                     type To = cxx::UniquePtr<ffi::DWARF_types_Structure>;
     247            0 :                     std::mem::transmute::<From, To>(ffi_entry)
     248            0 :                 };
     249            0 :                 Type::Structure(Structure::from_ffi(raw))
     250            0 :             } else if ffi::DWARF_types_Class::classof(type_ref) {
     251            0 :                 let raw = {
     252            0 :                     type From = cxx::UniquePtr<ffi::DWARF_Type>;
     253            0 :                     type To = cxx::UniquePtr<ffi::DWARF_types_Class>;
     254            0 :                     std::mem::transmute::<From, To>(ffi_entry)
     255            0 :                 };
     256            0 :                 Type::Class(Class::from_ffi(raw))
     257            0 :             } else if ffi::DWARF_types_Union::classof(type_ref) {
     258            0 :                 let raw = {
     259            0 :                     type From = cxx::UniquePtr<ffi::DWARF_Type>;
     260            0 :                     type To = cxx::UniquePtr<ffi::DWARF_types_Union>;
     261            0 :                     std::mem::transmute::<From, To>(ffi_entry)
     262            0 :                 };
     263            0 :                 Type::Union(Union::from_ffi(raw))
     264            0 :             } else if ffi::DWARF_types_Packed::classof(type_ref) {
     265            0 :                 let raw = {
     266            0 :                     type From = cxx::UniquePtr<ffi::DWARF_Type>;
     267            0 :                     type To = cxx::UniquePtr<ffi::DWARF_types_Packed>;
     268            0 :                     std::mem::transmute::<From, To>(ffi_entry)
     269            0 :                 };
     270            0 :                 Type::Packed(Packed::from_ffi(raw))
     271            0 :             } else if ffi::DWARF_types_Pointer::classof(type_ref) {
     272            0 :                 let raw = {
     273            0 :                     type From = cxx::UniquePtr<ffi::DWARF_Type>;
     274            0 :                     type To = cxx::UniquePtr<ffi::DWARF_types_Pointer>;
     275            0 :                     std::mem::transmute::<From, To>(ffi_entry)
     276            0 :                 };
     277            0 :                 Type::Pointer(Pointer::from_ffi(raw))
     278            0 :             } else if ffi::DWARF_types_Const::classof(type_ref) {
     279            0 :                 let raw = {
     280            0 :                     type From = cxx::UniquePtr<ffi::DWARF_Type>;
     281            0 :                     type To = cxx::UniquePtr<ffi::DWARF_types_Const>;
     282            0 :                     std::mem::transmute::<From, To>(ffi_entry)
     283            0 :                 };
     284            0 :                 Type::Const(Const::from_ffi(raw))
     285            0 :             } else if ffi::DWARF_types_Base::classof(type_ref) {
     286            0 :                 let raw = {
     287            0 :                     type From = cxx::UniquePtr<ffi::DWARF_Type>;
     288            0 :                     type To = cxx::UniquePtr<ffi::DWARF_types_Base>;
     289            0 :                     std::mem::transmute::<From, To>(ffi_entry)
     290            0 :                 };
     291            0 :                 Type::Base(Base::from_ffi(raw))
     292            0 :             } else if ffi::DWARF_types_Array::classof(type_ref) {
     293            0 :                 let raw = {
     294            0 :                     type From = cxx::UniquePtr<ffi::DWARF_Type>;
     295            0 :                     type To = cxx::UniquePtr<ffi::DWARF_types_Array>;
     296            0 :                     std::mem::transmute::<From, To>(ffi_entry)
     297            0 :                 };
     298            0 :                 Type::Array(Array::from_ffi(raw))
     299            0 :             } else if ffi::DWARF_types_Typedef::classof(type_ref) {
     300            0 :                 let raw = {
     301            0 :                     type From = cxx::UniquePtr<ffi::DWARF_Type>;
     302            0 :                     type To = cxx::UniquePtr<ffi::DWARF_types_Typedef>;
     303            0 :                     std::mem::transmute::<From, To>(ffi_entry)
     304            0 :                 };
     305            0 :                 Type::Typedef(Typedef::from_ffi(raw))
     306            0 :             } else if ffi::DWARF_types_Atomic::classof(type_ref) {
     307            0 :                 let raw = {
     308            0 :                     type From = cxx::UniquePtr<ffi::DWARF_Type>;
     309            0 :                     type To = cxx::UniquePtr<ffi::DWARF_types_Atomic>;
     310            0 :                     std::mem::transmute::<From, To>(ffi_entry)
     311            0 :                 };
     312            0 :                 Type::Atomic(Atomic::from_ffi(raw))
     313            0 :             } else if ffi::DWARF_types_Coarray::classof(type_ref) {
     314            0 :                 let raw = {
     315            0 :                     type From = cxx::UniquePtr<ffi::DWARF_Type>;
     316            0 :                     type To = cxx::UniquePtr<ffi::DWARF_types_Coarray>;
     317            0 :                     std::mem::transmute::<From, To>(ffi_entry)
     318            0 :                 };
     319            0 :                 Type::Coarray(Coarray::from_ffi(raw))
     320            0 :             } else if ffi::DWARF_types_Dynamic::classof(type_ref) {
     321            0 :                 let raw = {
     322            0 :                     type From = cxx::UniquePtr<ffi::DWARF_Type>;
     323            0 :                     type To = cxx::UniquePtr<ffi::DWARF_types_Dynamic>;
     324            0 :                     std::mem::transmute::<From, To>(ffi_entry)
     325            0 :                 };
     326            0 :                 Type::Dynamic(Dynamic::from_ffi(raw))
     327            0 :             } else if ffi::DWARF_types_Enum::classof(type_ref) {
     328            0 :                 let raw = {
     329            0 :                     type From = cxx::UniquePtr<ffi::DWARF_Type>;
     330            0 :                     type To = cxx::UniquePtr<ffi::DWARF_types_Enum>;
     331            0 :                     std::mem::transmute::<From, To>(ffi_entry)
     332            0 :                 };
     333            0 :                 Type::Enum(Enum::from_ffi(raw))
     334            0 :             } else if ffi::DWARF_types_File::classof(type_ref) {
     335            0 :                 let raw = {
     336            0 :                     type From = cxx::UniquePtr<ffi::DWARF_Type>;
     337            0 :                     type To = cxx::UniquePtr<ffi::DWARF_types_File>;
     338            0 :                     std::mem::transmute::<From, To>(ffi_entry)
     339            0 :                 };
     340            0 :                 Type::File(File::from_ffi(raw))
     341            0 :             } else if ffi::DWARF_types_Immutable::classof(type_ref) {
     342            0 :                 let raw = {
     343            0 :                     type From = cxx::UniquePtr<ffi::DWARF_Type>;
     344            0 :                     type To = cxx::UniquePtr<ffi::DWARF_types_Immutable>;
     345            0 :                     std::mem::transmute::<From, To>(ffi_entry)
     346            0 :                 };
     347            0 :                 Type::Immutable(Immutable::from_ffi(raw))
     348            0 :             } else if ffi::DWARF_types_Interface::classof(type_ref) {
     349            0 :                 let raw = {
     350            0 :                     type From = cxx::UniquePtr<ffi::DWARF_Type>;
     351            0 :                     type To = cxx::UniquePtr<ffi::DWARF_types_Interface>;
     352            0 :                     std::mem::transmute::<From, To>(ffi_entry)
     353            0 :                 };
     354            0 :                 Type::Interface(Interface::from_ffi(raw))
     355            0 :             } else if ffi::DWARF_types_PointerToMember::classof(type_ref) {
     356            0 :                 let raw = {
     357            0 :                     type From = cxx::UniquePtr<ffi::DWARF_Type>;
     358            0 :                     type To = cxx::UniquePtr<ffi::DWARF_types_PointerToMember>;
     359            0 :                     std::mem::transmute::<From, To>(ffi_entry)
     360            0 :                 };
     361            0 :                 Type::PointerToMember(PointerToMember::from_ffi(raw))
     362            0 :             } else if ffi::DWARF_types_RValueReference::classof(type_ref) {
     363            0 :                 let raw = {
     364            0 :                     type From = cxx::UniquePtr<ffi::DWARF_Type>;
     365            0 :                     type To = cxx::UniquePtr<ffi::DWARF_types_RValueReference>;
     366            0 :                     std::mem::transmute::<From, To>(ffi_entry)
     367            0 :                 };
     368            0 :                 Type::RValueReference(RValueReference::from_ffi(raw))
     369            0 :             } else if ffi::DWARF_types_Reference::classof(type_ref) {
     370            0 :                 let raw = {
     371            0 :                     type From = cxx::UniquePtr<ffi::DWARF_Type>;
     372            0 :                     type To = cxx::UniquePtr<ffi::DWARF_types_Reference>;
     373            0 :                     std::mem::transmute::<From, To>(ffi_entry)
     374            0 :                 };
     375            0 :                 Type::Reference(Reference::from_ffi(raw))
     376            0 :             } else if ffi::DWARF_types_Restrict::classof(type_ref) {
     377            0 :                 let raw = {
     378            0 :                     type From = cxx::UniquePtr<ffi::DWARF_Type>;
     379            0 :                     type To = cxx::UniquePtr<ffi::DWARF_types_Restrict>;
     380            0 :                     std::mem::transmute::<From, To>(ffi_entry)
     381            0 :                 };
     382            0 :                 Type::Restrict(Restrict::from_ffi(raw))
     383            0 :             } else if ffi::DWARF_types_SetTy::classof(type_ref) {
     384            0 :                 let raw = {
     385            0 :                     type From = cxx::UniquePtr<ffi::DWARF_Type>;
     386            0 :                     type To = cxx::UniquePtr<ffi::DWARF_types_SetTy>;
     387            0 :                     std::mem::transmute::<From, To>(ffi_entry)
     388            0 :                 };
     389            0 :                 Type::SetTy(SetTy::from_ffi(raw))
     390            0 :             } else if ffi::DWARF_types_Shared::classof(type_ref) {
     391            0 :                 let raw = {
     392            0 :                     type From = cxx::UniquePtr<ffi::DWARF_Type>;
     393            0 :                     type To = cxx::UniquePtr<ffi::DWARF_types_Shared>;
     394            0 :                     std::mem::transmute::<From, To>(ffi_entry)
     395            0 :                 };
     396            0 :                 Type::Shared(Shared::from_ffi(raw))
     397            0 :             } else if ffi::DWARF_types_StringTy::classof(type_ref) {
     398            0 :                 let raw = {
     399            0 :                     type From = cxx::UniquePtr<ffi::DWARF_Type>;
     400            0 :                     type To = cxx::UniquePtr<ffi::DWARF_types_StringTy>;
     401            0 :                     std::mem::transmute::<From, To>(ffi_entry)
     402            0 :                 };
     403            0 :                 Type::StringTy(StringTy::from_ffi(raw))
     404            0 :             } else if ffi::DWARF_types_Subroutine::classof(type_ref) {
     405            0 :                 let raw = {
     406            0 :                     type From = cxx::UniquePtr<ffi::DWARF_Type>;
     407            0 :                     type To = cxx::UniquePtr<ffi::DWARF_types_Subroutine>;
     408            0 :                     std::mem::transmute::<From, To>(ffi_entry)
     409            0 :                 };
     410            0 :                 Type::Subroutine(Subroutine::from_ffi(raw))
     411            0 :             } else if ffi::DWARF_types_TemplateAlias::classof(type_ref) {
     412            0 :                 let raw = {
     413            0 :                     type From = cxx::UniquePtr<ffi::DWARF_Type>;
     414            0 :                     type To = cxx::UniquePtr<ffi::DWARF_types_TemplateAlias>;
     415            0 :                     std::mem::transmute::<From, To>(ffi_entry)
     416            0 :                 };
     417            0 :                 Type::TemplateAlias(TemplateAlias::from_ffi(raw))
     418            0 :             } else if ffi::DWARF_types_Thrown::classof(type_ref) {
     419            0 :                 let raw = {
     420            0 :                     type From = cxx::UniquePtr<ffi::DWARF_Type>;
     421            0 :                     type To = cxx::UniquePtr<ffi::DWARF_types_Thrown>;
     422            0 :                     std::mem::transmute::<From, To>(ffi_entry)
     423            0 :                 };
     424            0 :                 Type::Thrown(Thrown::from_ffi(raw))
     425            0 :             } else if ffi::DWARF_types_Volatile::classof(type_ref) {
     426            0 :                 let raw = {
     427            0 :                     type From = cxx::UniquePtr<ffi::DWARF_Type>;
     428            0 :                     type To = cxx::UniquePtr<ffi::DWARF_types_Volatile>;
     429            0 :                     std::mem::transmute::<From, To>(ffi_entry)
     430            0 :                 };
     431            0 :                 Type::Volatile(Volatile::from_ffi(raw))
     432              :             } else {
     433            0 :                 Type::Generic(Generic::from_ffi(ffi_entry))
     434              :             }
     435              :         }
     436            0 :     }
     437              : }
     438              : 
     439              : /// Generic structure for types that do not required a dedicated interface
     440              : pub struct Generic<'a> {
     441              :     ptr: cxx::UniquePtr<ffi::DWARF_Type>,
     442              :     _owner: PhantomData<&'a ()>,
     443              : }
     444              : 
     445              : impl FromFFI<ffi::DWARF_Type> for Generic<'_> {
     446            0 :     fn from_ffi(cmd: cxx::UniquePtr<ffi::DWARF_Type>) -> Self {
     447            0 :         Self {
     448            0 :             ptr: cmd,
     449            0 :             _owner: PhantomData,
     450            0 :         }
     451            0 :     }
     452              : }
     453              : 
     454              : /// Generic trait shared by all DWARF types
     455              : pub trait DwarfType {
     456              :     #[doc(hidden)]
     457              :     fn get_base(&self) -> &ffi::DWARF_Type;
     458              : 
     459              :     /// Return the type's name using either `DW_AT_name` or `DW_AT_picture_string` (if any)
     460            0 :     fn name(&self) -> Result<String, Error> {
     461            0 :         to_conv_result!(
     462            0 :             ffi::DWARF_Type::name,
     463            0 :             self.get_base(),
     464            0 :             |e: cxx::UniquePtr<cxx::String>| { e.to_string() }
     465              :         );
     466            0 :     }
     467              : 
     468              :     /// Return the size of the type or an error if it can't be computed.
     469              :     ///
     470              :     /// This size should match the equivalent of `sizeof(Type)`.
     471            0 :     fn size(&self) -> Result<u64, Error> {
     472            0 :         to_conv_result!(
     473            0 :             ffi::DWARF_Type::size,
     474            0 :             self.get_base(),
     475            0 :             |e| e
     476              :         );
     477            0 :     }
     478              : 
     479              :     /// Return the debug location where this type is defined.
     480            0 :     fn location(&self) -> DebugLocation {
     481            0 :         DebugLocation::from_ffi(self.get_base().location())
     482            0 :     }
     483              : 
     484              :     /// Whether this type is a `DW_TAG_unspecified_type`.
     485            0 :     fn is_unspecified(&self) -> bool {
     486            0 :         self.get_base().is_unspecified()
     487            0 :     }
     488              : 
     489              :     /// The scope in which this function is defined
     490            0 :     fn scope(&self) -> Option<Scope<'_>> {
     491            0 :         into_optional(self.get_base().scope())
     492            0 :     }
     493              : 
     494              :     /// Generates a C/C++ definition for this type
     495            0 :     fn to_decl(&self) -> String {
     496            0 :         self.get_base().to_decl().to_string()
     497            0 :     }
     498              : 
     499              :     /// Generates a C/C++ definition for this type with the given configuration
     500            0 :     fn to_decl_with_opt(&self, opt: &DeclOpt) -> String {
     501            0 :         self.get_base().to_decl_with_opt(&opt.to_ffi()).to_string()
     502            0 :     }
     503              : }
     504              : 
     505              : impl DwarfType for Generic<'_> {
     506            0 :     fn get_base(&self) -> &ffi::DWARF_Type {
     507            0 :         self.ptr.as_ref().unwrap()
     508            0 :     }
     509              : }
     510              : 
     511              : impl DwarfType for Type<'_> {
     512            0 :     fn get_base(&self) -> &ffi::DWARF_Type {
     513            0 :         match &self {
     514            0 :             Type::Structure(s) => {
     515            0 :                 s.get_base()
     516              :             }
     517            0 :             Type::Class(s) => {
     518            0 :                 s.get_base()
     519              :             }
     520            0 :             Type::Union(s) => {
     521            0 :                 s.get_base()
     522              :             }
     523            0 :             Type::Packed(s) => {
     524            0 :                 s.get_base()
     525              :             }
     526            0 :             Type::Pointer(s) => {
     527            0 :                 s.get_base()
     528              :             }
     529            0 :             Type::Const(s) => {
     530            0 :                 s.get_base()
     531              :             }
     532            0 :             Type::Base(s) => {
     533            0 :                 s.get_base()
     534              :             }
     535            0 :             Type::Array(s) => {
     536            0 :                 s.get_base()
     537              :             }
     538            0 :             Type::Typedef(s) => {
     539            0 :                 s.get_base()
     540              :             }
     541            0 :             Type::Atomic(s) => {
     542            0 :                 s.get_base()
     543              :             }
     544            0 :             Type::Coarray(s) => {
     545            0 :                 s.get_base()
     546              :             }
     547            0 :             Type::Dynamic(s) => {
     548            0 :                 s.get_base()
     549              :             }
     550            0 :             Type::Enum(s) => {
     551            0 :                 s.get_base()
     552              :             }
     553            0 :             Type::File(s) => {
     554            0 :                 s.get_base()
     555              :             }
     556            0 :             Type::Immutable(s) => {
     557            0 :                 s.get_base()
     558              :             }
     559            0 :             Type::Interface(s) => {
     560            0 :                 s.get_base()
     561              :             }
     562            0 :             Type::PointerToMember(s) => {
     563            0 :                 s.get_base()
     564              :             }
     565            0 :             Type::RValueReference(s) => {
     566            0 :                 s.get_base()
     567              :             }
     568            0 :             Type::Reference(s) => {
     569            0 :                 s.get_base()
     570              :             }
     571            0 :             Type::Restrict(s) => {
     572            0 :                 s.get_base()
     573              :             }
     574            0 :             Type::SetTy(s) => {
     575            0 :                 s.get_base()
     576              :             }
     577            0 :             Type::Shared(s) => {
     578            0 :                 s.get_base()
     579              :             }
     580            0 :             Type::StringTy(s) => {
     581            0 :                 s.get_base()
     582              :             }
     583            0 :             Type::Subroutine(s) => {
     584            0 :                 s.get_base()
     585              :             }
     586            0 :             Type::TemplateAlias(s) => {
     587            0 :                 s.get_base()
     588              :             }
     589            0 :             Type::Thrown(s) => {
     590            0 :                 s.get_base()
     591              :             }
     592            0 :             Type::Volatile(s) => {
     593            0 :                 s.get_base()
     594              :             }
     595            0 :             Type::Generic(s) => {
     596            0 :                 s.get_base()
     597              :             }
     598              :         }
     599            0 :     }
     600              : }
     601              : 
     602            0 : declare_fwd_iterator!(
     603            0 :     Types,
     604            0 :     Type<'a>,
     605            0 :     ffi::DWARF_Type,
     606            0 :     ffi::DWARF_CompilationUnit,
     607            0 :     ffi::DWARF_CompilationUnit_it_types
     608            0 : );
     609              : 
        

Generated by: LCOV version 2.1-1