Skip to content
This repository was archived by the owner on May 18, 2019. It is now read-only.

Commit f80c21e

Browse files
rfrankeOpenModelica-Hudson
authored andcommitted
[Cpp] Use array assign in for loops
Belonging to [master]: - #2793 - OpenModelica/OpenModelica-testsuite#1079
1 parent cb53a44 commit f80c21e

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

Compiler/Template/CodegenCpp.tpl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11570,7 +11570,10 @@ template equationForLoop(SimEqSystem eq, Context context, Text &varDecls, SimCod
1157011570
<<
1157111571
for (int <%iterExp%> = <%startExp%>; <%iterExp%> <= <%endExp%>; <%iterExp%>++) {
1157211572
<%preExp%>
11573-
<%crefPart%> = <%expPart%>;
11573+
<%if isArrayType(crefTypeFull(cref)) then
11574+
'<%crefPart%>.assign(<%expPart%>);'
11575+
else
11576+
'<%crefPart%> = <%expPart%>;'%>
1157411577
}
1157511578
>>
1157611579
end equationForLoop;

Compiler/Template/SimCodeTV.mo

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3233,6 +3233,11 @@ package ComponentReference
32333233
output list<DAE.Subscript> subs;
32343234
end crefSubs;
32353235

3236+
function crefTypeFull
3237+
input DAE.ComponentRef inRef;
3238+
output DAE.Type res;
3239+
end crefTypeFull;
3240+
32363241
function crefLastType
32373242
input DAE.ComponentRef inRef;
32383243
output DAE.Type res;

0 commit comments

Comments
 (0)