Skip to content

Commit a51b984

Browse files
committed
CPP: Modify similar query as well.
1 parent 9f688eb commit a51b984

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

cpp/ql/src/Power of 10/Rule 6/VariableScopeTooLarge.ql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,7 @@ import cpp
1010

1111
from GlobalVariable v, Function f
1212
where v.getAnAccess().getEnclosingFunction() = f and
13-
strictcount(v.getAnAccess().getEnclosingFunction()) = 1
13+
strictcount(v.getAnAccess().getEnclosingFunction()) = 1 and
14+
forall(VariableAccess a | a = v.getAnAccess() | exists(a.getEnclosingFunction())) and
15+
not v.getADeclarationEntry().getFile() instanceof HeaderFile // intended to be accessed elsewhere
1416
select v, "The variable " + v.getName() + " is only accessed in $@ and should be scoped accordingly.", f, f.getName()

0 commit comments

Comments
 (0)