Skip to content

Commit

Permalink
expose LLVMValueRef constructors
Browse files Browse the repository at this point in the history
  • Loading branch information
corbanvilla committed Dec 28, 2023
1 parent 0b2cde9 commit d8a62fb
Show file tree
Hide file tree
Showing 16 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/values/array_value.rs
Expand Up @@ -15,7 +15,7 @@ pub struct ArrayValue<'ctx> {
}

impl<'ctx> ArrayValue<'ctx> {
pub(crate) unsafe fn new(value: LLVMValueRef) -> Self {
pub unsafe fn new(value: LLVMValueRef) -> Self {
assert!(!value.is_null());

ArrayValue {
Expand Down
2 changes: 1 addition & 1 deletion src/values/basic_value_use.rs
Expand Up @@ -15,7 +15,7 @@ use crate::values::{AnyValueEnum, BasicValueEnum};
pub struct BasicValueUse<'ctx>(LLVMUseRef, PhantomData<&'ctx ()>);

impl<'ctx> BasicValueUse<'ctx> {
pub(crate) unsafe fn new(use_: LLVMUseRef) -> Self {
pub unsafe fn new(use_: LLVMUseRef) -> Self {
debug_assert!(!use_.is_null());

BasicValueUse(use_, PhantomData)
Expand Down
2 changes: 1 addition & 1 deletion src/values/call_site_value.rs
Expand Up @@ -20,7 +20,7 @@ use super::AnyValue;
pub struct CallSiteValue<'ctx>(Value<'ctx>);

impl<'ctx> CallSiteValue<'ctx> {
pub(crate) unsafe fn new(value: LLVMValueRef) -> Self {
pub unsafe fn new(value: LLVMValueRef) -> Self {
CallSiteValue(Value::new(value))
}

Expand Down
8 changes: 4 additions & 4 deletions src/values/enums.rs
Expand Up @@ -72,7 +72,7 @@ enum_value_set! {BasicValueEnum: ArrayValue, IntValue, FloatValue, PointerValue,
enum_value_set! {BasicMetadataValueEnum: ArrayValue, IntValue, FloatValue, PointerValue, StructValue, VectorValue, MetadataValue}

impl<'ctx> AnyValueEnum<'ctx> {
pub(crate) unsafe fn new(value: LLVMValueRef) -> Self {
pub unsafe fn new(value: LLVMValueRef) -> Self {
match LLVMGetTypeKind(LLVMTypeOf(value)) {
LLVMTypeKind::LLVMFloatTypeKind
| LLVMTypeKind::LLVMFP128TypeKind
Expand Down Expand Up @@ -214,7 +214,7 @@ impl<'ctx> AnyValueEnum<'ctx> {
}

impl<'ctx> BasicValueEnum<'ctx> {
pub(crate) unsafe fn new(value: LLVMValueRef) -> Self {
pub unsafe fn new(value: LLVMValueRef) -> Self {
match LLVMGetTypeKind(LLVMTypeOf(value)) {
LLVMTypeKind::LLVMFloatTypeKind
| LLVMTypeKind::LLVMFP128TypeKind
Expand Down Expand Up @@ -321,7 +321,7 @@ impl<'ctx> BasicValueEnum<'ctx> {
}

impl<'ctx> AggregateValueEnum<'ctx> {
pub(crate) unsafe fn new(value: LLVMValueRef) -> Self {
pub unsafe fn new(value: LLVMValueRef) -> Self {
match LLVMGetTypeKind(LLVMTypeOf(value)) {
LLVMTypeKind::LLVMArrayTypeKind => AggregateValueEnum::ArrayValue(ArrayValue::new(value)),
LLVMTypeKind::LLVMStructTypeKind => AggregateValueEnum::StructValue(StructValue::new(value)),
Expand Down Expand Up @@ -355,7 +355,7 @@ impl<'ctx> AggregateValueEnum<'ctx> {
}

impl<'ctx> BasicMetadataValueEnum<'ctx> {
pub(crate) unsafe fn new(value: LLVMValueRef) -> Self {
pub unsafe fn new(value: LLVMValueRef) -> Self {
match LLVMGetTypeKind(LLVMTypeOf(value)) {
LLVMTypeKind::LLVMFloatTypeKind
| LLVMTypeKind::LLVMFP128TypeKind
Expand Down
2 changes: 1 addition & 1 deletion src/values/float_value.rs
Expand Up @@ -23,7 +23,7 @@ pub struct FloatValue<'ctx> {
}

impl<'ctx> FloatValue<'ctx> {
pub(crate) unsafe fn new(value: LLVMValueRef) -> Self {
pub unsafe fn new(value: LLVMValueRef) -> Self {
assert!(!value.is_null());

FloatValue {
Expand Down
2 changes: 1 addition & 1 deletion src/values/fn_value.rs
Expand Up @@ -35,7 +35,7 @@ pub struct FunctionValue<'ctx> {
}

impl<'ctx> FunctionValue<'ctx> {
pub(crate) unsafe fn new(value: LLVMValueRef) -> Option<Self> {
pub unsafe fn new(value: LLVMValueRef) -> Option<Self> {
if value.is_null() {
return None;
}
Expand Down
2 changes: 1 addition & 1 deletion src/values/generic_value.rs
Expand Up @@ -16,7 +16,7 @@ pub struct GenericValue<'ctx> {
}

impl<'ctx> GenericValue<'ctx> {
pub(crate) unsafe fn new(generic_value: LLVMGenericValueRef) -> Self {
pub unsafe fn new(generic_value: LLVMGenericValueRef) -> Self {
assert!(!generic_value.is_null());

GenericValue {
Expand Down
2 changes: 1 addition & 1 deletion src/values/global_value.rs
Expand Up @@ -47,7 +47,7 @@ pub struct GlobalValue<'ctx> {
}

impl<'ctx> GlobalValue<'ctx> {
pub(crate) unsafe fn new(value: LLVMValueRef) -> Self {
pub unsafe fn new(value: LLVMValueRef) -> Self {
assert!(!value.is_null());

GlobalValue {
Expand Down
2 changes: 1 addition & 1 deletion src/values/instruction_value.rs
Expand Up @@ -130,7 +130,7 @@ impl<'ctx> InstructionValue<'ctx> {
!unsafe { LLVMIsAAtomicCmpXchgInst(self.as_value_ref()) }.is_null()
}

pub(crate) unsafe fn new(instruction_value: LLVMValueRef) -> Self {
pub unsafe fn new(instruction_value: LLVMValueRef) -> Self {
debug_assert!(!instruction_value.is_null());

let value = Value::new(instruction_value);
Expand Down
2 changes: 1 addition & 1 deletion src/values/int_value.rs
Expand Up @@ -25,7 +25,7 @@ pub struct IntValue<'ctx> {
}

impl<'ctx> IntValue<'ctx> {
pub(crate) unsafe fn new(value: LLVMValueRef) -> Self {
pub unsafe fn new(value: LLVMValueRef) -> Self {
assert!(!value.is_null());

IntValue {
Expand Down
2 changes: 1 addition & 1 deletion src/values/metadata_value.rs
Expand Up @@ -45,7 +45,7 @@ pub struct MetadataValue<'ctx> {
}

impl<'ctx> MetadataValue<'ctx> {
pub(crate) unsafe fn new(value: LLVMValueRef) -> Self {
pub unsafe fn new(value: LLVMValueRef) -> Self {
assert!(!value.is_null());
assert!(!LLVMIsAMDNode(value).is_null() || !LLVMIsAMDString(value).is_null());

Expand Down
2 changes: 1 addition & 1 deletion src/values/mod.rs
Expand Up @@ -67,7 +67,7 @@ struct Value<'ctx> {
}

impl<'ctx> Value<'ctx> {
pub(crate) unsafe fn new(value: LLVMValueRef) -> Self {
pub unsafe fn new(value: LLVMValueRef) -> Self {
debug_assert!(
!value.is_null(),
"This should never happen since containing struct should check null ptrs"
Expand Down
2 changes: 1 addition & 1 deletion src/values/phi_value.rs
Expand Up @@ -20,7 +20,7 @@ pub struct PhiValue<'ctx> {
}

impl<'ctx> PhiValue<'ctx> {
pub(crate) unsafe fn new(value: LLVMValueRef) -> Self {
pub unsafe fn new(value: LLVMValueRef) -> Self {
assert!(!value.is_null());

PhiValue {
Expand Down
2 changes: 1 addition & 1 deletion src/values/ptr_value.rs
Expand Up @@ -21,7 +21,7 @@ pub struct PointerValue<'ctx> {
}

impl<'ctx> PointerValue<'ctx> {
pub(crate) unsafe fn new(value: LLVMValueRef) -> Self {
pub unsafe fn new(value: LLVMValueRef) -> Self {
assert!(!value.is_null());

PointerValue {
Expand Down
2 changes: 1 addition & 1 deletion src/values/struct_value.rs
Expand Up @@ -17,7 +17,7 @@ pub struct StructValue<'ctx> {
}

impl<'ctx> StructValue<'ctx> {
pub(crate) unsafe fn new(value: LLVMValueRef) -> Self {
pub unsafe fn new(value: LLVMValueRef) -> Self {
assert!(!value.is_null());

StructValue {
Expand Down
2 changes: 1 addition & 1 deletion src/values/vec_value.rs
Expand Up @@ -19,7 +19,7 @@ pub struct VectorValue<'ctx> {
}

impl<'ctx> VectorValue<'ctx> {
pub(crate) unsafe fn new(vector_value: LLVMValueRef) -> Self {
pub unsafe fn new(vector_value: LLVMValueRef) -> Self {
assert!(!vector_value.is_null());

VectorValue {
Expand Down

0 comments on commit d8a62fb

Please sign in to comment.