C++: Exclude array initializers.

This commit is contained in:
Geoffrey White
2021-05-12 19:39:30 +01:00
parent 52a88af6c1
commit 0450caa73d
3 changed files with 4 additions and 3 deletions

View File

@@ -48,7 +48,9 @@ class InsecureMacroSpec extends InsecureCryptoSpec, MacroInvocation {
exists(this.getAGeneratedElement().(ControlFlowNode)) and
// exclude expressions controlling ifs/switches (as they may not be used).
not any(IfStmt c).getCondition().getAChild*() = this.getAGeneratedElement() and
not any(SwitchCase c).getExpr().getAChild*() = this.getAGeneratedElement()
not any(SwitchCase c).getExpr().getAChild*() = this.getAGeneratedElement() and
// exclude expressions in array initializers (as they may not be used).
not any(AggregateLiteral i).getAChild*() = this.getAGeneratedElement()
}
override string description() { result = "macro invocation" }