Skip to content

Commit

Permalink
cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
cdisselkoen committed Dec 3, 2022
1 parent 1c53f8a commit 552d11e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 29 deletions.
5 changes: 4 additions & 1 deletion src/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,10 @@ impl Default for DataLayout {
impl DataLayout {
pub(crate) fn from_module_ref(module: LLVMModuleRef) -> Self {
let layout_str = unsafe { get_data_layout_str(module) };
let mut data_layout = DataLayout { layout_str, ..Default::default() };
let mut data_layout = DataLayout {
layout_str,
..Default::default()
};
for spec in data_layout.layout_str.split('-') {
if spec == "E" {
data_layout.endianness = Endianness::BigEndian;
Expand Down
35 changes: 7 additions & 28 deletions tests/basic_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,10 +330,7 @@ fn loopbc() {
module.type_of(&bitcast.operand),
module.types.pointer_to(allocated_type.clone())
);
assert_eq!(
&bitcast.to_string(),
"%4 = bitcast [10 x i32]* %3 to i8*"
);
assert_eq!(&bitcast.to_string(), "%4 = bitcast [10 x i32]* %3 to i8*");
let lifetimestart: &instruction::Call = &bbs[0].instrs[2]
.clone()
.try_into()
Expand Down Expand Up @@ -1094,25 +1091,13 @@ fn loopbc() {
assert_eq!(module.type_of(load), module.types.i32());
assert_eq!(load_inst.is_atomic(), false);
#[cfg(feature = "llvm-10-or-lower")]
assert_eq!(
&load.to_string(),
"%17 = load volatile i32* %16, align 4"
);
assert_eq!(&load.to_string(), "%17 = load volatile i32* %16, align 4");
#[cfg(feature = "llvm-11")]
assert_eq!(
&load.to_string(),
"%20 = load volatile i32* %19, align 4"
);
assert_eq!(&load.to_string(), "%20 = load volatile i32* %19, align 4");
#[cfg(any(feature = "llvm-12", feature = "llvm-13"))]
assert_eq!(
&load.to_string(),
"%26 = load volatile i32* %25, align 4"
);
assert_eq!(&load.to_string(), "%26 = load volatile i32* %25, align 4");
#[cfg(feature = "llvm-14-or-greater")]
assert_eq!(
&load.to_string(),
"%25 = load volatile i32* %24, align 4"
);
assert_eq!(&load.to_string(), "%25 = load volatile i32* %24, align 4");
let ret: &Terminator = if cfg!(feature = "llvm-9-or-lower") {
&bbs[5].term
} else if cfg!(feature = "llvm-10") || cfg!(feature = "llvm-11") {
Expand Down Expand Up @@ -1938,14 +1923,8 @@ fn indirectly_recursive_type() {
alloca_b.allocated_type
);
}
assert_eq!(
&alloca_a.to_string(),
"%3 = alloca %struct.NodeA, align 8"
);
assert_eq!(
&alloca_b.to_string(),
"%4 = alloca %struct.NodeB, align 8"
);
assert_eq!(&alloca_a.to_string(), "%3 = alloca %struct.NodeA, align 8");
assert_eq!(&alloca_b.to_string(), "%4 = alloca %struct.NodeB, align 8");
}

#[test]
Expand Down

0 comments on commit 552d11e

Please sign in to comment.