Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C++: Disable the workaround for bitwise operations #458

Merged
merged 2 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import cpp
import codingstandards.c.misra
import codingstandards.c.misra.EssentialTypes
import codingstandards.cpp.Bitwise

/**
* Holds if the operator `operator` has an operand `child` that is of an inappropriate essential type
Expand Down Expand Up @@ -178,7 +177,7 @@ predicate isInappropriateEssentialType(
child =
[
operator.(BinaryBitwiseOperation).getAnOperand(),
operator.(Bitwise::AssignBitwiseOperation).getAnOperand()
operator.(AssignBitwiseOperation).getAnOperand()
] and
not operator instanceof LShiftExpr and
not operator instanceof RShiftExpr and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,14 @@

import cpp
import codingstandards.cpp.autosar
import codingstandards.cpp.Bitwise
import codingstandards.cpp.Conversion

predicate isBinaryBitwiseOperation(Operation o, VariableAccess l, VariableAccess r) {
exists(BinaryBitwiseOperation bbo | bbo = o |
l = bbo.getLeftOperand() and r = bbo.getRightOperand()
)
or
exists(Bitwise::AssignBitwiseOperation abo | abo = o |
exists(AssignBitwiseOperation abo | abo = o |
l = abo.getLValue() and
r = abo.getRValue()
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,14 @@

import cpp
import codingstandards.cpp.autosar
import codingstandards.cpp.Bitwise

from Operation o, VariableAccess va
where
not isExcluded(o, ExpressionsPackage::bitwiseOperatorAppliedToSignedTypesQuery()) and
(
o instanceof UnaryBitwiseOperation or
o instanceof BinaryBitwiseOperation or
o instanceof Bitwise::AssignBitwiseOperation
o instanceof AssignBitwiseOperation
) and
o.getAnOperand() = va and
va.getTarget().getUnderlyingType().(IntegralType).isSigned()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

import cpp
import codingstandards.cpp.autosar
import codingstandards.cpp.Bitwise

class ShiftOperation extends Operation {
Expr leftOperand;
Expand All @@ -34,7 +33,7 @@ class ShiftOperation extends Operation {
rightOperand = o.getRightOperand()
)
or
exists(Bitwise::AssignBitwiseOperation o | this = o |
exists(AssignBitwiseOperation o | this = o |
(
o instanceof AssignLShiftExpr
or
Expand Down
20 changes: 0 additions & 20 deletions cpp/common/src/codingstandards/cpp/Bitwise.qll

This file was deleted.

Loading