mirror of
https://github.com/mappu/miqt.git
synced 2024-12-22 08:58:37 +00:00
genbindings/cabi: reduce temporaries when returning qt heap copies
This commit is contained in:
parent
97f0141e27
commit
303d0f0b97
@ -351,9 +351,9 @@ func emitAssignCppToCabi(assignExpression string, p CppParameter, rvalue string)
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else if p.QtClassType() && !p.Pointer {
|
} else if p.QtClassType() && !p.Pointer {
|
||||||
shouldReturn = p.ParameterType + " " + namePrefix + "_ret = "
|
|
||||||
afterCall = indent + "// Copy-construct value returned type into heap-allocated copy\n"
|
// Elide temporary and emit directly from the rvalue
|
||||||
afterCall += indent + "" + assignExpression + "static_cast<" + p.ParameterType + "*>(new " + p.ParameterType + "(" + namePrefix + "_ret));\n"
|
return indent + assignExpression + "new " + p.ParameterType + "(" + rvalue + ");\n"
|
||||||
|
|
||||||
} else if p.Const {
|
} else if p.Const {
|
||||||
shouldReturn += "(" + p.RenderTypeCabi() + ") "
|
shouldReturn += "(" + p.RenderTypeCabi() + ") "
|
||||||
|
Loading…
Reference in New Issue
Block a user