Skip to content

Commit 4379aa4

Browse files
committed
Adding Initializer in condition as an occurance of isDef
1 parent 74ff579 commit 4379aa4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

cpp/ql/lib/semmle/code/cpp/controlflow/Nullness.qll

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,10 @@ class AnalysedExpr extends Expr {
169169
*/
170170
predicate isDef(LocalScopeVariable v) {
171171
this.inCondition() and
172-
this.(Assignment).getLValue() = v.getAnAccess()
172+
(
173+
this.(Assignment).getLValue() = v.getAnAccess() or
174+
exists(Initializer i | this.getEnclosingStmt() = i.getEnclosingStmt() and v = i.getDeclaration())
175+
)
173176
}
174177

175178
/**

0 commit comments

Comments
 (0)