Add the optimal attribute to the out typemap for more optimal code generation when returning objects by value

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10450 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2008-05-14 22:12:31 +00:00
commit 336b50b43d
39 changed files with 726 additions and 833 deletions

View file

@ -1304,7 +1304,7 @@ MODULA3():
Printv(f->def, " SWIGEXPORT ", c_return_type, " ", wname, "(", NIL);
// Emit all of the local variables for holding arguments.
emit_args(t, l, f);
emit_parameter_variables(l, f);
/* Attach the standard typemaps */
emit_attach_parmmaps(l, f);
@ -1420,17 +1420,15 @@ MODULA3():
// Now write code to make the function call
if (!native_function_flag) {
emit_action(n, f);
}
String *actioncode = emit_action(n);
if (Cmp(nodeType(n), "constant") == 0) {
Swig_restore(n);
}
if (Cmp(nodeType(n), "constant") == 0) {
Swig_restore(n);
}
/* Return value if necessary */
if (!native_function_flag) {
String *tm = getMappedTypeNew(n, "out", "result");
if (tm != NIL) {
/* Return value if necessary */
String *tm;
if ((tm = Swig_typemap_lookup_out("out", n, "result", f, actioncode))) {
addThrows(throws_hash, "out", n);
Replaceall(tm, "$source", "result"); /* deprecated */
Replaceall(tm, "$target", "cresult"); /* deprecated */
@ -1441,6 +1439,7 @@ MODULA3():
} else {
Swig_warning(WARN_TYPEMAP_OUT_UNDEF, input_file, line_number, "Unable to use return type %s in function %s.\n", SwigType_str(t, 0), rawname);
}
emit_return_variable(n, t, f);
}
/* Output argument output code */