Skip to content

Commit 99f3e0a

Browse files
committed
Quick first pass at simplifying API restrictions on cheap copy types requiring references
1 parent ebf8be2 commit 99f3e0a

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

Cargo.toml

-3
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,3 @@ llvm-sys = "38"
2525
[badges]
2626
travis-ci = { repository = "TheDan64/inkwell" }
2727
codecov = { repository = "TheDan64/inkwell" }
28-
29-
[profile.dev]
30-
codegen-units=32 # TODO: Remove when default in rust, cuts compile time ~50%

src/builder.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,10 @@ impl Builder {
3232
Builder::new(builder)
3333
}
3434

35-
// REVIEW: Would probably make this API a bit simpler by taking Into<Option<&BasicValue>>
36-
// So that you could just do build_return(&value) or build_return(None)
35+
// REVIEW: Would probably make this API a bit simpler by taking Into<Option<impl BasicValue>>
36+
// So that you could just do build_return(value) or build_return(None)
3737
// Is that frowned upon?
38+
// TODO: Option<impl BasicValue>
3839
pub fn build_return(&self, value: Option<&BasicValue>) -> InstructionValue {
3940
// let value = unsafe {
4041
// value.map_or(LLVMBuildRetVoid(self.builder), |value| LLVMBuildRet(self.builder, value.value))
@@ -93,7 +94,7 @@ impl Builder {
9394
}
9495

9596
// REVIEW: Doesn't GEP work on array too?
96-
pub fn build_gep(&self, ptr: &PointerValue, ordered_indexes: &[&IntValue], name: &str) -> PointerValue {
97+
pub fn build_gep(&self, ptr: &PointerValue, ordered_indexes: &[IntValue], name: &str) -> PointerValue {
9798
let c_string = CString::new(name).expect("Conversion to CString failed unexpectedly");
9899

99100
let mut index_values: Vec<LLVMValueRef> = ordered_indexes.iter()
@@ -107,7 +108,7 @@ impl Builder {
107108
}
108109

109110
// REVIEW: Doesn't GEP work on array too?
110-
pub fn build_in_bounds_gep(&self, ptr: &PointerValue, ordered_indexes: &[&IntValue], name: &str) -> PointerValue {
111+
pub fn build_in_bounds_gep(&self, ptr: &PointerValue, ordered_indexes: &[IntValue], name: &str) -> PointerValue {
111112
let c_string = CString::new(name).expect("Conversion to CString failed unexpectedly");
112113

113114
let mut index_values: Vec<LLVMValueRef> = ordered_indexes.iter()

0 commit comments

Comments
 (0)