@@ -208,6 +208,7 @@ add_prototype(LL_Instruction *instruction)
208208 LL_Function *scan_function = called;
209209 LL_Function *new_function;
210210 LL_Value *function = instruction->operands [1 ];
211+ LL_Value *attributes = function->storage ;
211212 int i;
212213
213214 if (function->data == NULL ) {
@@ -227,6 +228,7 @@ add_prototype(LL_Instruction *instruction)
227228 new_function->next = called;
228229 new_function->name = function->data ;
229230 new_function->num_args = instruction->num_operands - 2 ;
231+ new_function->attributes = (attributes ? attributes->data : NULL );
230232
231233 new_function->return_type = function->type_struct ;
232234 called = new_function;
@@ -267,6 +269,9 @@ write_prototypes(FILE *out, LLVMModuleRef module)
267269 }
268270 }
269271 fprintf (out, " ) nounwind" );
272+ if (cur_function->attributes ) {
273+ fprintf (out, " %s" , cur_function->attributes );
274+ }
270275 }
271276 cur_function = cur_function->next ;
272277 }
@@ -812,11 +817,11 @@ ll_write_local_objects(FILE *out, LL_Function *function)
812817#endif
813818 }
814819}
820+
815821void
816822ll_write_function (FILE *out, LL_Function *function, LL_Module *module , bool no_return, const char *prefix)
817823{
818824 int i;
819- char attribute[256 ];
820825 LL_BasicBlock *block = function->first ;
821826
822827 fprintf (out, " define %s %s %s " , ll_get_linkage_string (function->linkage ),
0 commit comments