]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Add boolean "use_inplace" ccode-attribute for methods
authorRico Tzschichholz <ricotz@ubuntu.com>
Mon, 20 Nov 2017 16:03:16 +0000 (17:03 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Wed, 22 Nov 2017 20:50:38 +0000 (21:50 +0100)
This can be use to avoid temp-variables for an expanding macro.

https://bugzilla.gnome.org/show_bug.cgi?id=750840

codegen/valaccodemethodcallmodule.vala
vala/valausedattr.vala

index a22a4fee23d32639db0df69e71d1b90d8c40e45c..cf2a3f53589ca85d5abdb70e833aaea89d42423a 100644 (file)
@@ -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);
index c43ab3170fe91d32fb22621dded4489172f2b69e..9b0a859577e83146b45f2336bde051e0b1bc6a04 100644 (file)
@@ -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", "",