Skip to content

Commit

Permalink
Merge branch 'llvm-15' into az/update-llvm-15-support
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Z committed Nov 24, 2022
2 parents 47bd6a0 + 4330a51 commit 0bd11e5
Show file tree
Hide file tree
Showing 40 changed files with 901 additions and 614 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ Cargo.lock

# These are backup files generated by rustfmt
**/*.rs.bk

# IDE project data
/.idea/
/.vscode/
14 changes: 0 additions & 14 deletions .idea/inkwell.iml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/modules.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

56 changes: 0 additions & 56 deletions .idea/workspace.xml

This file was deleted.

10 changes: 6 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ target-bpf = []
target-lanai = []
target-webassembly = []
target-riscv = []
target-syncvm = []
target-all = [
"target-x86",
"target-arm",
Expand All @@ -78,7 +79,8 @@ target-all = [
"target-bpf",
"target-lanai",
"target-webassembly",
"target-riscv"
"target-riscv",
"target-syncvm",
]
experimental = ["static-alloc"]
nightly = ["inkwell_internals/nightly"]
Expand All @@ -96,11 +98,11 @@ llvm-sys-80 = { package = "llvm-sys", version = "80.3", optional = true }
llvm-sys-90 = { package = "llvm-sys", version = "90.2.1", optional = true }
llvm-sys-100 = { package = "llvm-sys", version = "100.2.3", optional = true }
llvm-sys-110 = { package = "llvm-sys", version = "110.0.3", optional = true }
llvm-sys-120 = { package = "llvm-sys", version = "120.2.4", optional = true }
llvm-sys-130 = { package = "llvm-sys", version = "130.0.4", optional = true }
llvm-sys-120 = { package = "llvm-sys", version = "120.2.2", optional = true }
llvm-sys-130 = { package = "llvm-sys", version = "130.0.3", optional = true }
llvm-sys-140 = { package = "llvm-sys", version = "140.0.2", optional = true }
llvm-sys-150 = { package = "llvm-sys", version = "150.0.3", optional = true }
once_cell = "1.4.1"
once_cell = "1.16"
parking_lot = "0.12"
static-alloc = { version = "0.2", optional = true }

Expand Down
16 changes: 14 additions & 2 deletions src/basic_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use llvm_sys::core::{
LLVMGetBasicBlockTerminator, LLVMGetFirstInstruction, LLVMGetFirstUse, LLVMGetLastInstruction,
LLVMGetNextBasicBlock, LLVMGetPreviousBasicBlock, LLVMGetTypeContext, LLVMIsABasicBlock, LLVMIsConstant,
LLVMMoveBasicBlockAfter, LLVMMoveBasicBlockBefore, LLVMPrintTypeToString, LLVMPrintValueToString,
LLVMRemoveBasicBlockFromParent, LLVMReplaceAllUsesWith, LLVMSetValueName, LLVMTypeOf,
LLVMRemoveBasicBlockFromParent, LLVMReplaceAllUsesWith, LLVMTypeOf,
};
use llvm_sys::prelude::{LLVMBasicBlockRef, LLVMValueRef};

Expand Down Expand Up @@ -424,7 +424,19 @@ impl<'ctx> BasicBlock<'ctx> {
/// Set name of the `BasicBlock`.
pub fn set_name(&self, name: &str) {
let c_string = to_c_str(name);
unsafe { LLVMSetValueName(LLVMBasicBlockAsValue(self.basic_block), c_string.as_ptr()) };

#[cfg(any(feature = "llvm4-0", feature = "llvm5-0", feature = "llvm6-0"))]
{
use llvm_sys::core::LLVMSetValueName;

unsafe { LLVMSetValueName(LLVMBasicBlockAsValue(self.basic_block), c_string.as_ptr()) };
}
#[cfg(not(any(feature = "llvm4-0", feature = "llvm5-0", feature = "llvm6-0")))]
{
use llvm_sys::core::LLVMSetValueName2;

unsafe { LLVMSetValueName2(LLVMBasicBlockAsValue(self.basic_block), c_string.as_ptr(), name.len()) };
}
}

/// Replaces all uses of this basic block with another.
Expand Down
Loading

0 comments on commit 0bd11e5

Please sign in to comment.