Skip to content

Commit

Permalink
- Disable inline of functions with protected variables (until we supp…
Browse files Browse the repository at this point in the history
…ort it properly)

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@14313 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Dec 10, 2012
1 parent a2e8cf1 commit 0c145d7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
15 changes: 13 additions & 2 deletions Compiler/FrontEnd/DAEUtil.mo
Original file line number Diff line number Diff line change
Expand Up @@ -1448,7 +1448,7 @@ public function getProtectedVars "
input list<DAE.Element> vl;
output list<DAE.Element> vl_1;
algorithm
vl_1 := getMatchingElements(vl, isProtectedVar);
vl_1 := getMatchingElements(vl, assertProtectedVar);
end getProtectedVars;

public function getBidirVars "function get_output_vars
Expand Down Expand Up @@ -1514,13 +1514,24 @@ algorithm
end match;
end isOutputVar;

public function isProtectedVar
public function assertProtectedVar
"Succeeds if Element is a protected variable."
input DAE.Element inElement;
algorithm
_ := match (inElement)
case DAE.VAR(protection=DAE.PROTECTED()) then ();
end match;
end assertProtectedVar;

public function isProtectedVar
"Succeeds if Element is a protected variable."
input DAE.Element inElement;
output Boolean b;
algorithm
b := match (inElement)
case DAE.VAR(protection=DAE.PROTECTED()) then true;
else false;
end match;
end isProtectedVar;

public function isPublicVar "
Expand Down
3 changes: 2 additions & 1 deletion Compiler/FrontEnd/Inline.mo
Original file line number Diff line number Diff line change
Expand Up @@ -1425,12 +1425,13 @@ algorithm
crefs = List.map(fn,getInputCrefs);
crefs = List.select(crefs,removeWilds);
argmap = List.threadTuple(crefs,args);
false = List.exist(fn,DAEUtil.isProtectedVar);
(argmap,checkcr) = extendCrefRecords(argmap,HashTableCG.emptyHashTable());
newExp = getRhsExp(fn);
// compare types
true = checkExpsTypeEquiv(e1, newExp);
// add noEvent to avoid events as usually for functions
// MSL3.3 GenerateEvents
// MSL 3.2.1 need GenerateEvents to disable this
newExp = Expression.addNoEventToRelationsAndConds(newExp);
((newExp,(_,_,true))) = Expression.traverseExp(newExp,replaceArgs,(argmap,checkcr,true));
// for inlinecalls in functions
Expand Down

0 comments on commit 0c145d7

Please sign in to comment.