Skip to content

Commit

Permalink
-changed passing of structs from call by value to call by reference
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@21970 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
RuedKamp committed Aug 25, 2014
1 parent 14a2065 commit 4234f3a
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion Compiler/Template/CodegenCpp.tpl
Expand Up @@ -6691,8 +6691,20 @@ template expTypeFlag(DAE.Type ty, Integer flag)
case 8 then
match ty
case T_ARRAY(dims=dims) then'BaseArray<<%expTypeShort(ty)%>>&'
else expTypeFlag(ty, 2)
else expTypeFlag(ty, 9)
end match

case 9 then
// we want the "modelica type"
match ty case T_COMPLEX(complexClassType=EXTERNAL_OBJ(__)) then
'<%expTypeShort(ty)%>'
else match ty case T_COMPLEX(complexClassType=RECORD(path=rname)) then
'<%underscorePath(rname)%>Type &'
else match ty case T_COMPLEX(__) then
'<%underscorePath(ClassInf.getStateName(complexClassType))%> &'
else
'<%expTypeShort(ty)%>'


end expTypeFlag;

Expand Down Expand Up @@ -8530,6 +8542,7 @@ template daeExpAsub(Exp inExp, Context context, Text &preExp /*BUFP*/,
case ASUB(exp=ASUB(__)) then
error(sourceInfo(),'Nested array subscripting *should* have been handled by the routine creating the asub, but for some reason it was not: <%printExpStr(exp)%>')


// Faster asub: Do not construct a whole new array just to access one subscript
case ASUB(exp=exp as ARRAY(scalar=true), sub={idx}) then
let res = tempDecl(expTypeFromExpModelica(exp),&varDecls)
Expand Down

0 comments on commit 4234f3a

Please sign in to comment.