summaryrefslogtreecommitdiff
path: root/rust/src/llil/lifting.rs
diff options
context:
space:
mode:
authorMichael Krasnitski <michael.krasnitski@gmail.com>2023-01-06 02:21:40 -0500
committerKyle Martin <krm504@nyu.edu>2023-01-10 00:11:27 -0500
commit64713cd5b5550c5b8c61a05cc26d89d464d45bb3 (patch)
tree3fc035eab9b9ee91a953ca804aa5298aa5a5c895 /rust/src/llil/lifting.rs
parent5b51a4ff188c426d8f90ac71ee6dde0fa3b5a495 (diff)
Introduce `Expression::new` to avoid writing `PhantomData` everywhere
Diffstat (limited to 'rust/src/llil/lifting.rs')
-rw-r--r--rust/src/llil/lifting.rs84
1 files changed, 14 insertions, 70 deletions
diff --git a/rust/src/llil/lifting.rs b/rust/src/llil/lifting.rs
index a4d3c560..eb7b36fd 100644
--- a/rust/src/llil/lifting.rs
+++ b/rust/src/llil/lifting.rs
@@ -383,11 +383,7 @@ where
)
};
- Expression {
- function: il,
- expr_idx,
- _ty: PhantomData,
- }
+ Expression::new(il, expr_idx)
}
pub fn get_default_flag_cond_llil<'func, A>(
@@ -408,11 +404,7 @@ where
let expr_idx =
BNGetDefaultArchitectureFlagConditionLowLevelIL(handle.0, cond, class_id, il.handle);
- Expression {
- function: il,
- expr_idx,
- _ty: PhantomData,
- }
+ Expression::new(il, expr_idx)
}
}
@@ -635,11 +627,7 @@ where
)
};
- Expression {
- function: self.function,
- expr_idx,
- _ty: PhantomData,
- }
+ Expression::new(self.function, expr_idx)
}
pub fn with_source_operand(
@@ -709,11 +697,7 @@ macro_rules! no_arg_lifter {
let expr_idx = unsafe { BNLowLevelILAddExpr(self.handle, $op, 0, 0, 0, 0, 0, 0) };
- Expression {
- function: self,
- expr_idx,
- _ty: PhantomData,
- }
+ Expression::new(self, expr_idx)
}
};
}
@@ -756,11 +740,7 @@ macro_rules! unsized_unary_op_lifter {
BNLowLevelILAddExpr(self.handle, $op, 0, 0, expr.expr_idx as u64, 0, 0, 0)
};
- Expression {
- function: self,
- expr_idx,
- _ty: PhantomData,
- }
+ Expression::new(self, expr_idx)
}
};
}
@@ -932,11 +912,7 @@ where
let expr_idx =
unsafe { BNLowLevelILAddExpr(self.handle, LLIL_CONST, size, 0, val, 0, 0, 0) };
- Expression {
- function: self,
- expr_idx,
- _ty: PhantomData,
- }
+ Expression::new(self, expr_idx)
}
pub fn const_ptr_sized(
@@ -950,11 +926,7 @@ where
let expr_idx =
unsafe { BNLowLevelILAddExpr(self.handle, LLIL_CONST_PTR, size, 0, val, 0, 0, 0) };
- Expression {
- function: self,
- expr_idx,
- _ty: PhantomData,
- }
+ Expression::new(self, expr_idx)
}
pub fn const_ptr(&self, val: u64) -> Expression<A, Mutable, NonSSA<LiftedNonSSA>, ValueExpr> {
@@ -967,11 +939,7 @@ where
let expr_idx = unsafe { BNLowLevelILAddExpr(self.handle, LLIL_TRAP, 0, 0, val, 0, 0, 0) };
- Expression {
- function: self,
- expr_idx,
- _ty: PhantomData,
- }
+ Expression::new(self, expr_idx)
}
no_arg_lifter!(unimplemented, LLIL_UNIMPL, ValueExpr);
@@ -1009,11 +977,7 @@ where
)
};
- Expression {
- function: self,
- expr_idx,
- _ty: PhantomData,
- }
+ Expression::new(self, expr_idx)
}
pub fn goto<'a: 'b, 'b>(
@@ -1024,11 +988,7 @@ where
let expr_idx = unsafe { BNLowLevelILGoto(self.handle, &l.0 as *const _ as *mut _) };
- Expression {
- function: self,
- expr_idx,
- _ty: PhantomData,
- }
+ Expression::new(self, expr_idx)
}
pub fn reg<R: Into<Register<A::Register>>>(
@@ -1048,11 +1008,7 @@ where
let expr_idx =
unsafe { BNLowLevelILAddExpr(self.handle, LLIL_REG, size, 0, reg as u64, 0, 0, 0) };
- Expression {
- function: self,
- expr_idx,
- _ty: PhantomData,
- }
+ Expression::new(self, expr_idx)
}
pub fn set_reg<'a, R, E>(
@@ -1137,11 +1093,7 @@ where
let expr_idx =
unsafe { BNLowLevelILAddExpr(self.handle, LLIL_FLAG, 0, 0, flag.id() as u64, 0, 0, 0) };
- Expression {
- function: self,
- expr_idx,
- _ty: PhantomData,
- }
+ Expression::new(self, expr_idx)
}
pub fn flag_cond(
@@ -1155,11 +1107,7 @@ where
let expr_idx =
unsafe { BNLowLevelILAddExpr(self.handle, LLIL_FLAG_COND, 0, 0, cond as u64, 0, 0, 0) };
- Expression {
- function: self,
- expr_idx,
- _ty: PhantomData,
- }
+ Expression::new(self, expr_idx)
}
pub fn flag_group(
@@ -1183,11 +1131,7 @@ where
)
};
- Expression {
- function: self,
- expr_idx,
- _ty: PhantomData,
- }
+ Expression::new(self, expr_idx)
}
pub fn set_flag<'a, E>(