Skip to content

Commit e4fc903

Browse files
committed
Added docs to array_values
1 parent 136dd5e commit e4fc903

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/values/array_value.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use crate::types::ArrayType;
99
use crate::values::traits::AsValueRef;
1010
use crate::values::{Value, InstructionValue, MetadataValue};
1111

12+
/// An `ArrayValue` is a block of contiguous constants or variables.
1213
#[derive(PartialEq, Eq, Clone, Copy, Hash)]
1314
pub struct ArrayValue {
1415
array_value: Value
@@ -23,50 +24,65 @@ impl ArrayValue {
2324
}
2425
}
2526

27+
/// Gets the string name of an `ArrayValue`. If the value is a constant, this will
28+
/// return an empty string.
2629
pub fn get_name(&self) -> &CStr {
2730
self.array_value.get_name()
2831
}
2932

33+
/// Sets the name of an `ArrayValue`. If the value is a constant, this is a noop.
3034
pub fn set_name(&self, name: &str) {
3135
self.array_value.set_name(name);
3236
}
3337

38+
/// Gets the type of this `ArrayValue`.
3439
pub fn get_type(&self) -> ArrayType {
3540
ArrayType::new(self.array_value.get_type())
3641
}
3742

43+
/// Determines whether or not this value is null.
3844
pub fn is_null(&self) -> bool {
3945
self.array_value.is_null()
4046
}
4147

48+
/// Determines whether or not this value is undefined.
4249
pub fn is_undef(&self) -> bool {
4350
self.array_value.is_undef()
4451
}
4552

53+
/// Prints this `ArrayValue` to a string.
4654
pub fn print_to_string(&self) -> LLVMString {
4755
self.array_value.print_to_string()
4856
}
4957

58+
/// Prints this `ArrayValue` to standard error.
5059
pub fn print_to_stderr(&self) {
5160
self.array_value.print_to_stderr()
5261
}
5362

63+
/// Attempt to convert this `ArrayValue` to an `InstructionValue`, if possible.
5464
pub fn as_instruction(&self) -> Option<InstructionValue> {
5565
self.array_value.as_instruction()
5666
}
5767

68+
/// Determines whether or not this `ArrayValue` has any associated metadata.
5869
pub fn has_metadata(&self) -> bool {
5970
self.array_value.has_metadata()
6071
}
6172

73+
/// Gets the `MetadataValue` associated with this `ArrayValue` at a specific
74+
/// `kind_id`.
6275
pub fn get_metadata(&self, kind_id: u32) -> Option<MetadataValue> {
6376
self.array_value.get_metadata(kind_id)
6477
}
6578

79+
/// Assigns a `MetadataValue` to this `ArrayValue` at a specific `kind_id`.
6680
pub fn set_metadata(&self, metadata: MetadataValue, kind_id: u32) {
6781
self.array_value.set_metadata(metadata, kind_id)
6882
}
6983

84+
/// Replaces all uses of this value with another value of the same type.
85+
/// If used incorrectly this may result in invalid IR.
7086
pub fn replace_all_uses_with(&self, other: ArrayValue) {
7187
self.array_value.replace_all_uses_with(other.as_value_ref())
7288
}

src/values/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//! A value is an instance of a type.
22
3+
#[deny(missing_docs)]
34
mod array_value;
45
#[deny(missing_docs)]
56
mod basic_value_use;

0 commit comments

Comments
 (0)