@@ -38,6 +38,7 @@ impl Deref for $this {
38
38
/// A typed value that can be used as an operand in instructions.
39
39
pub struct Value ( PhantomData < [ u8 ] > ) ;
40
40
native_ref ! ( & Value = LLVMValueRef ) ;
41
+ to_str ! { Value , LLVMPrintValueToString }
41
42
impl Value {
42
43
/// Create a new constant struct from the values given.
43
44
pub fn new_struct < ' a > ( context : & ' a Context , vals : & [ & ' a Value ] , packed : bool ) -> & ' a Value {
@@ -92,6 +93,7 @@ pub enum Predicate {
92
93
pub struct Arg ( PhantomData < [ u8 ] > ) ;
93
94
native_ref ! ( & Arg = LLVMValueRef ) ;
94
95
sub ! { Arg , LLVMIsAArgument }
96
+ to_str ! { Arg , LLVMPrintValueToString }
95
97
impl Arg {
96
98
/// Add the attribute given to this argument.
97
99
pub fn add_attribute ( & self , attr : Attribute ) {
@@ -135,6 +137,7 @@ impl Arg {
135
137
pub struct GlobalValue ( PhantomData < [ u8 ] > ) ;
136
138
native_ref ! ( & GlobalValue = LLVMValueRef ) ;
137
139
sub ! { GlobalValue , LLVMIsAGlobalValue }
140
+ to_str ! { GlobalValue , LLVMPrintValueToString }
138
141
impl GlobalValue {
139
142
/// Set the linkage type for this global
140
143
pub fn set_linkage ( & self , linkage : Linkage ) {
@@ -161,6 +164,7 @@ impl GlobalValue {
161
164
pub struct GlobalVariable ( PhantomData < [ u8 ] > ) ;
162
165
native_ref ! ( & GlobalVariable = LLVMValueRef ) ;
163
166
sub ! { GlobalVariable , LLVMIsAGlobalVariable , GlobalValue }
167
+ to_str ! { GlobalVariable , LLVMPrintValueToString }
164
168
impl GlobalVariable {
165
169
/// Set the initial value of the global
166
170
pub fn set_initializer ( & self , val : & Value ) {
@@ -193,13 +197,15 @@ impl GlobalVariable {
193
197
pub struct Alias ( PhantomData < [ u8 ] > ) ;
194
198
native_ref ! ( & Alias = LLVMValueRef ) ;
195
199
sub ! { Alias , LLVMIsAGlobalAlias , GlobalValue }
200
+ to_str ! { Alias , LLVMPrintValueToString }
196
201
/// A function is a kind of value that can be called and contains blocks of code.
197
202
///
198
203
/// To get the value of each argument to a function, you can use the index operator.
199
204
/// For example, `&func[0]` is the value that represents the first argument to the function.
200
205
pub struct Function ( PhantomData < [ u8 ] > ) ;
201
206
native_ref ! ( & Function = LLVMValueRef ) ;
202
207
sub ! { Function , LLVMIsAFunction , GlobalValue }
208
+ to_str ! { Function , LLVMPrintValueToString }
203
209
impl Index < usize > for Function {
204
210
type Output = Arg ;
205
211
fn index ( & self , index : usize ) -> & Arg {
@@ -394,5 +400,4 @@ impl GetContext for Value {
394
400
fn get_context ( & self ) -> & Context {
395
401
self . get_type ( ) . get_context ( )
396
402
}
397
- }
398
- to_str ! ( Value , LLVMPrintValueToString ) ;
403
+ }
0 commit comments