Skip to content

Commit ee8db1d

Browse files
committed
Change the definition of a full expr to match the standard
1 parent f2ce331 commit ee8db1d

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

c/common/src/codingstandards/c/Expr.qll

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,19 @@ import cpp
33
/* A full expression as defined in ISO/IEC 9899:2011 6.8 point 4 and Annex C point 1 item 5. */
44
class FullExpr extends Expr {
55
FullExpr() {
6-
not this.getParent() instanceof Expr and
7-
not exists(Variable v | v.getInitializer().getExpr() = this)
6+
exists(ExprStmt s | this = s.getExpr())
7+
or
8+
exists(Loop l | this = l.getControllingExpr())
9+
or
10+
exists(ConditionalStmt s | this = s.getControllingExpr())
11+
or
12+
exists(ForStmt s | this = s.getUpdate())
13+
or
14+
exists(ReturnStmt s | this = s.getExpr())
15+
or
16+
this instanceof AggregateLiteral
17+
or
18+
this = any(Variable v).getInitializer().getExpr()
819
}
920
}
1021

0 commit comments

Comments
 (0)