Skip to content

Commit 2c51ca1

Browse files
committed
Revert A5-2-6
1 parent 556a757 commit 2c51ca1

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

cpp/autosar/src/rules/A5-2-6/OperandsOfALogicalAndOrNotParenthesized.ql

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,11 @@
1717
import cpp
1818
import codingstandards.cpp.autosar
1919

20-
from BinaryLogicalOperation op, Expr operand
20+
from BinaryLogicalOperation op, BinaryOperation binop
2121
where
2222
not isExcluded(op, OrderOfEvaluationPackage::operandsOfALogicalAndOrNotParenthesizedQuery()) and
23-
operand = op.getAnOperand() and
24-
/* The operand is a built-in arithmetic/logic binary operation */
25-
if operand instanceof BinaryOperation
26-
then
27-
not exists(ParenthesisExpr p | p = operand.getFullyConverted()) and
28-
// Exclude binary operations expanded by a macro.
29-
not operand.isInMacroExpansion()
30-
else
31-
/* The operand should not be a field access operation */
32-
not operand instanceof FieldAccess
33-
select op, "Binary $@ operand of logical operation is not parenthesized.", operand, "operator"
23+
op.getAnOperand() = binop and
24+
not exists(ParenthesisExpr p | p = binop.getFullyConverted()) and
25+
// Exclude binary operations expanded by a macro.
26+
not binop.isInMacroExpansion()
27+
select op, "Binary $@ operand of logical operation is not parenthesized.", binop, "operator"

0 commit comments

Comments
 (0)