Skip to content

Commit 3e88808

Browse files
committed
Consider children expression when determining ordering
1 parent 25cee4f commit 3e88808

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

c/common/src/codingstandards/c/Ordering.qll

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ module Ordering {
2727
// before the actual call.
2828
exists(Call call |
2929
(
30-
call.getAnArgument() = e1
30+
call.getAnArgument().getAChild*() = e1
3131
or
3232
// Postfix expression designating the called function
3333
// We current only handle call through function pointers because the postfix expression
3434
// of regular function calls is not available. That is, identifying `f` in `f(...)`
35-
call.(ExprCall).getExpr() = e1
35+
call.(ExprCall).getExpr().getAChild*() = e1
3636
) and
3737
call.getTarget() = e2.getEnclosingFunction()
3838
)
@@ -42,21 +42,21 @@ module Ordering {
4242
exists(BinaryLogicalOperation blop |
4343
blop instanceof LogicalAndExpr or blop instanceof LogicalOrExpr
4444
|
45-
blop.getLeftOperand() = e1 and blop.getRightOperand() = e2
45+
blop.getLeftOperand().getAChild*() = e1 and blop.getRightOperand().getAChild*() = e2
4646
)
4747
or
4848
// 6.5.17 point 2 - There is a sequence pointt between the left operand and the right operand.
4949
exists(CommaExpr ce, Expr lhs, Expr rhs |
5050
lhs = ce.getLeftOperand() and
5151
rhs = ce.getRightOperand()
5252
|
53-
lhs = e1.getParent*() and rhs = e2.getParent*()
53+
lhs.getAChild*() = e1 and rhs.getAChild*() = e2
5454
)
5555
or
5656
// 6.5.15 point 4 - There is a sequence point between the first operand and the evaluation of the second or third.
5757
exists(ConditionalExpr cond |
58-
cond.getCondition() = e1 and
59-
(cond.getThen() = e2 or cond.getElse() = e2)
58+
cond.getCondition().getAChild*() = e1 and
59+
(cond.getThen().getAChild*() = e2 or cond.getElse().getAChild*() = e2)
6060
)
6161
or
6262
// Between the evaluation of a full expression and the next to be evaluated full expression.

0 commit comments

Comments
 (0)