Skip to content

Commit 1cba1d0

Browse files
committed
CPP: Modify similar query as well.
1 parent e253ab5 commit 1cba1d0

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@ from GlobalVariable v
1212
where forex(VariableAccess va | va.getTarget() = v | va.getFile() = v.getDefinitionLocation().getFile())
1313
and not v.hasSpecifier("static")
1414
and strictcount(v.getAnAccess().getEnclosingFunction()) > 1 // If = 1, variable should be function-scope.
15+
and not v.getADeclarationEntry().getFile() instanceof HeaderFile // intended to be accessed elsewhere
1516
select v, "The global variable " + v.getName() + " is not accessed outside of " + v.getFile().getBaseName() +
1617
" and could be made static."

0 commit comments

Comments
 (0)