[vala/staging] codegen: Add boolean "use_inplace" ccode-attribute for methods



commit 464eab9abac76f2f2b03c39ad17e8329871e1336
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Mon Nov 20 17:03:16 2017 +0100

    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

 codegen/valaccodemethodcallmodule.vala |    3 ++-
 vala/valausedattr.vala                 |    3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/codegen/valaccodemethodcallmodule.vala b/codegen/valaccodemethodcallmodule.vala
index a22a4fe..218950d 100644
--- a/codegen/valaccodemethodcallmodule.vala
+++ b/codegen/valaccodemethodcallmodule.vala
@@ -801,7 +801,8 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
                                }
                        }
 
-                       if (m != null && m.get_format_arg_index () >= 0) {
+                       if (m != null
+                           && (m.get_attribute_bool ("CCode", "use_inplace", false) || 
m.get_format_arg_index () >= 0)) {
                                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);
diff --git a/vala/valausedattr.vala b/vala/valausedattr.vala
index c43ab31..9b0a859 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", "",


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]