Skip to main content

macho_cpp/
abi_types.rs

1//! Owned results produced by architecture-aware body inference.
2
3use serde::Serialize;
4
5use crate::CppEvidence;
6
7#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
8#[serde(rename_all = "snake_case")]
9/// The CppReturnChannel type.
10#[non_exhaustive]
11pub enum CppReturnChannel {
12    /// The Unknown variant.
13    Unknown,
14    /// The GeneralPurpose variant.
15    GeneralPurpose,
16    /// The FloatingPoint variant.
17    FloatingPoint,
18    /// The AggregateIndirect variant.
19    AggregateIndirect,
20    /// The Void variant.
21    Void,
22}
23
24#[derive(Debug, Clone, Serialize)]
25#[serde(rename_all = "snake_case")]
26/// The CppBodyKind type.
27#[non_exhaustive]
28pub enum CppBodyKind {
29    /// The Standard variant.
30    Standard,
31    /// The Thunk variant.
32    Thunk,
33    /// The Stub variant.
34    Stub,
35    /// The Unknown variant.
36    Unknown,
37}
38
39#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
40#[serde(tag = "hint", rename_all = "snake_case")]
41/// The ArgumentTypeHint type.
42#[non_exhaustive]
43pub enum ArgumentTypeHint {
44    /// The Unknown variant.
45    Unknown,
46    /// The Scalar variant.
47    Scalar,
48    /// The FloatingPoint variant.
49    FloatingPoint,
50    /// The Pointer variant.
51    Pointer,
52    /// The CString variant.
53    CString,
54    /// The ClassPointer variant.
55    ClassPointer {
56        #[doc = "The class_name field."]
57        class_name: String,
58    },
59    /// The ObjcObject variant.
60    ObjcObject,
61    /// The StructPointer variant.
62    StructPointer,
63}
64
65#[derive(Debug, Clone, Serialize)]
66/// The CppBodyAnalysis type.
67pub struct CppBodyAnalysis {
68    /// The arch field.
69    pub arch: String,
70    /// The kind field.
71    pub kind: CppBodyKind,
72    /// The return_channel field.
73    pub return_channel: CppReturnChannel,
74    /// The this_adjustment field.
75    pub this_adjustment: Option<i64>,
76    /// The likely_wrapper field.
77    pub likely_wrapper: bool,
78    /// The param_count field.
79    pub param_count: Option<u32>,
80    /// The argument_hints field.
81    pub argument_hints: Vec<ArgumentTypeHint>,
82    /// The evidence field.
83    pub evidence: Vec<CppEvidence>,
84}