mirror of
https://github.com/github/codeql.git
synced 2026-04-28 02:05:14 +02:00
CPP: Exclude variables that have non-function accesses.
This commit is contained in:
@@ -11,5 +11,6 @@ import cpp
|
||||
from GlobalVariable v, Function f
|
||||
where v.getAnAccess().getEnclosingFunction() = f and
|
||||
strictcount(v.getAnAccess().getEnclosingFunction()) = 1 and
|
||||
forall(VariableAccess a | a = v.getAnAccess() | exists(a.getEnclosingFunction())) and
|
||||
not v.getADeclarationEntry().getFile() instanceof HeaderFile // intended to be accessed elsewhere
|
||||
select v, "The variable " + v.getName() + " is only accessed in $@ and should be scoped accordingly.", f, f.getName()
|
||||
|
||||
Reference in New Issue
Block a user