@@ -38,6 +38,7 @@ impl Deref for $this {
3838/// A typed value that can be used as an operand in instructions.
3939pub struct Value ( PhantomData < [ u8 ] > ) ;
4040native_ref ! ( & Value = LLVMValueRef ) ;
41+ to_str ! { Value , LLVMPrintValueToString }
4142impl Value {
4243 /// Create a new constant struct from the values given.
4344 pub fn new_struct < ' a > ( context : & ' a Context , vals : & [ & ' a Value ] , packed : bool ) -> & ' a Value {
@@ -92,6 +93,7 @@ pub enum Predicate {
9293pub struct Arg ( PhantomData < [ u8 ] > ) ;
9394native_ref ! ( & Arg = LLVMValueRef ) ;
9495sub ! { Arg , LLVMIsAArgument }
96+ to_str ! { Arg , LLVMPrintValueToString }
9597impl Arg {
9698 /// Add the attribute given to this argument.
9799 pub fn add_attribute ( & self , attr : Attribute ) {
@@ -135,6 +137,7 @@ impl Arg {
135137pub struct GlobalValue ( PhantomData < [ u8 ] > ) ;
136138native_ref ! ( & GlobalValue = LLVMValueRef ) ;
137139sub ! { GlobalValue , LLVMIsAGlobalValue }
140+ to_str ! { GlobalValue , LLVMPrintValueToString }
138141impl GlobalValue {
139142 /// Set the linkage type for this global
140143 pub fn set_linkage ( & self , linkage : Linkage ) {
@@ -161,6 +164,7 @@ impl GlobalValue {
161164pub struct GlobalVariable ( PhantomData < [ u8 ] > ) ;
162165native_ref ! ( & GlobalVariable = LLVMValueRef ) ;
163166sub ! { GlobalVariable , LLVMIsAGlobalVariable , GlobalValue }
167+ to_str ! { GlobalVariable , LLVMPrintValueToString }
164168impl GlobalVariable {
165169 /// Set the initial value of the global
166170 pub fn set_initializer ( & self , val : & Value ) {
@@ -193,13 +197,15 @@ impl GlobalVariable {
193197pub struct Alias ( PhantomData < [ u8 ] > ) ;
194198native_ref ! ( & Alias = LLVMValueRef ) ;
195199sub ! { Alias , LLVMIsAGlobalAlias , GlobalValue }
200+ to_str ! { Alias , LLVMPrintValueToString }
196201/// A function is a kind of value that can be called and contains blocks of code.
197202///
198203/// To get the value of each argument to a function, you can use the index operator.
199204/// For example, `&func[0]` is the value that represents the first argument to the function.
200205pub struct Function ( PhantomData < [ u8 ] > ) ;
201206native_ref ! ( & Function = LLVMValueRef ) ;
202207sub ! { Function , LLVMIsAFunction , GlobalValue }
208+ to_str ! { Function , LLVMPrintValueToString }
203209impl Index < usize > for Function {
204210 type Output = Arg ;
205211 fn index ( & self , index : usize ) -> & Arg {
@@ -394,5 +400,4 @@ impl GetContext for Value {
394400 fn get_context ( & self ) -> & Context {
395401 self . get_type ( ) . get_context ( )
396402 }
397- }
398- to_str ! ( Value , LLVMPrintValueToString ) ;
403+ }
0 commit comments