From: Rico Tzschichholz Date: Mon, 20 Nov 2017 16:03:16 +0000 (+0100) Subject: codegen: Add boolean "use_inplace" ccode-attribute for methods X-Git-Tag: 0.39.1~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e2e0054a0d85500fe6c86a6457d910f77deb5599;p=thirdparty%2Fvala.git codegen: Add boolean "use_inplace" ccode-attribute for methods This can be use to avoid temp-variables for an expanding macro. https://bugzilla.gnome.org/show_bug.cgi?id=750840 --- diff --git a/codegen/valaccodemethodcallmodule.vala b/codegen/valaccodemethodcallmodule.vala index a22a4fee2..cf2a3f535 100644 --- a/codegen/valaccodemethodcallmodule.vala +++ b/codegen/valaccodemethodcallmodule.vala @@ -803,6 +803,8 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule { if (m != null && m.get_format_arg_index () >= 0) { set_cvalue (expr, ccall_expr); + } else if (m != null && m.get_attribute_bool ("CCode", "use_inplace", false)) { + set_cvalue (expr, ccall_expr); } else if (!return_result_via_out_param) { var temp_var = get_temp_variable (result_type, result_type.value_owned, null, false); var temp_ref = get_variable_cexpression (temp_var.name); diff --git a/vala/valausedattr.vala b/vala/valausedattr.vala index c43ab3170..9b0a85957 100644 --- a/vala/valausedattr.vala +++ b/vala/valausedattr.vala @@ -39,7 +39,8 @@ public class Vala.UsedAttr : CodeVisitor { "has_copy_function", "lower_case_csuffix", "ref_sink_function", "dup_function", "finish_function", "generic_type_pos", "array_length_type", "array_length", "array_length_cname", "array_length_cexpr", "array_null_terminated", "vfunc_name", "finish_vfunc_name", "finish_name", "free_function_address_of", "pos", "delegate_target", "delegate_target_cname", - "array_length_pos", "delegate_target_pos", "destroy_notify_pos", "ctype", "has_new_function", "notify", "finish_instance", "", + "array_length_pos", "delegate_target_pos", "destroy_notify_pos", "ctype", "has_new_function", "notify", "finish_instance", + "use_inplace", "", "Immutable", "", "Compact", "",