Java: Change TCs of Stmt.getParent to Stmt.getEnclosingStmt.

This commit is contained in:
Anders Schack-Mulligen
2019-04-08 16:58:56 +02:00
committed by yh-semmle
parent 6ecf46ce85
commit 0a569f6c1a
23 changed files with 46 additions and 46 deletions

View File

@@ -48,7 +48,7 @@ predicate useAndDef(Assignment a, Variable v) {
predicate declaredInLoop(LocalVariableDecl v, LoopStmt loop) {
exists(LocalVariableDeclExpr e |
e.getVariable() = v and
e.getEnclosingStmt().getParent*() = loop.getBody()
e.getEnclosingStmt().getEnclosingStmt*() = loop.getBody()
)
or
exists(EnhancedForStmt for | for = loop | for.getVariable().getVariable() = v)
@@ -57,5 +57,5 @@ predicate declaredInLoop(LocalVariableDecl v, LoopStmt loop) {
from Assignment a, Variable v
where
useAndDef(a, v) and
exists(LoopStmt loop | a.getEnclosingStmt().getParent*() = loop | not declaredInLoop(v, loop))
exists(LoopStmt loop | a.getEnclosingStmt().getEnclosingStmt*() = loop | not declaredInLoop(v, loop))
select a, "The string " + v.getName() + " is built-up in a loop: use string buffer."