mirror of
https://github.com/github/codeql.git
synced 2026-04-22 23:35:14 +02:00
Write-only container query: account for implicitly-initialised variables
This commit is contained in:
@@ -39,6 +39,6 @@ where
|
||||
) and
|
||||
// Also, any value that `v` is initialized to is a new container,
|
||||
forall(Expr e | e = v.getAnAssignedValue() | e instanceof ClassInstanceExpr) and
|
||||
// and `v` is not implicitly initialized by a for-each loop.
|
||||
not exists(EnhancedForStmt efs | efs.getVariable().getVariable() = v)
|
||||
// and `v` is not implicitly initialized
|
||||
not v.(LocalVariableDecl).getDeclExpr().hasImplicitInit()
|
||||
select v, "The contents of this container are never accessed."
|
||||
|
||||
Reference in New Issue
Block a user