@@ -85,6 +85,21 @@ Expr getLoopStepOfForStmt(ForStmt forLoop) {
8585  result  =  forLoop .getUpdate ( ) .( AssignSubExpr ) .getRValue ( ) 
8686} 
8787
88+ /** 
89+  * Holds if either of the following holds for the given variable access: 
90+  * 1. Another variable access of the same variable as the given variable access is taken an 
91+  * address and is assigned to a non-const pointer variable, i.e. initialization, assignment, 
92+  * and pass-by-value. 
93+  * 2. Another variable access of the same variable as the given variable access is assigned 
94+  * to a non-const reference variable (thus constituting a `T` -> `&T` conversion.), i.e. 
95+  * initialization and assignment. 
96+  */ 
97+ /* 
98+  * Note that pass-by-reference is dealt with in a different predicate named 
99+  * `loopVariablePassedAsArgumentToNonConstReferenceParameter`, due to implementation 
100+  * limitations. 
101+  */ 
102+ 
88103predicate  loopVariableAssignedToNonConstPointerOrReferenceType ( 
89104  ForStmt  forLoop ,  VariableAccess  loopVariableAccessInCondition 
90105)  { 
@@ -121,6 +136,11 @@ predicate loopVariableAssignedToNonConstPointerOrReferenceType(
121136 * Also, this predicate requires that the call is the body of the given for-loop. 
122137 */ 
123138
139+ /** 
140+  * Holds if the given variable access has another variable access with the same target 
141+  * variable that is passed as reference to a non-const reference parameter of a function, 
142+  * constituting a `T` -> `&T` conversion. 
143+  */ 
124144predicate  loopVariablePassedAsArgumentToNonConstReferenceParameter ( 
125145  ForStmt  forLoop ,  VariableAccess  loopVariableAccessInCondition 
126146)  { 
0 commit comments