Skip to content

Commit 4ee1015

Browse files
committed
Extract ArithmeticOperation to Expr.qll.
1 parent 397967f commit 4ee1015

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

cpp/autosar/src/rules/M5-2-10/IncrementAndDecrementOperatorsMixedWithOtherOperatorsInExpression.ql

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,7 @@
1616

1717
import cpp
1818
import codingstandards.cpp.autosar
19-
20-
class ArithmeticOperation extends Operation {
21-
ArithmeticOperation() {
22-
this instanceof UnaryArithmeticOperation or this instanceof BinaryArithmeticOperation
23-
}
24-
}
19+
import codingstandards.cpp.Expr
2520

2621
from CrementOperation cop, ArithmeticOperation op, string name
2722
where

cpp/common/src/codingstandards/cpp/Expr.qll

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@ import cpp
22
private import semmle.code.cpp.valuenumbering.GlobalValueNumbering
33
import codingstandards.cpp.AccessPath
44

5+
/**
6+
* A unary or binary arithmetic operation.
7+
*/
8+
class ArithmeticOperation extends Operation {
9+
ArithmeticOperation() {
10+
this instanceof UnaryArithmeticOperation or this instanceof BinaryArithmeticOperation
11+
}
12+
}
13+
514
/** A full expression as defined in [intro.execution] of N3797. */
615
class FullExpr extends Expr {
716
FullExpr() {

0 commit comments

Comments
 (0)