Skip to content

Commit 962a640

Browse files
committed
Provide more useful predicate names
1 parent 84b1ad8 commit 962a640

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

c/misra/src/rules/RULE-13-2/UnsequencedSideEffects.ql

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ predicate isOrHasSideEffect(Expr e) {
2222
any(VariableEffect ve).getAnAccess() = e
2323
}
2424

25-
predicate originatingInStatement(Expr e, FullExpr fe) {
25+
predicate partOfFullExpr(Expr e, FullExpr fe) {
2626
isOrHasSideEffect(e) and
2727
(
2828
e.(VariableEffect).getAnAccess() = fe.getAChild+()
@@ -36,19 +36,19 @@ class ConstituentExprOrdering extends Ordering::Configuration {
3636

3737
override predicate isCandidate(Expr e1, Expr e2) {
3838
exists(FullExpr fe |
39-
originatingInStatement(e1, fe) and
40-
originatingInStatement(e2, fe)
39+
partOfFullExpr(e1, fe) and
40+
partOfFullExpr(e2, fe)
4141
)
4242
}
4343
}
4444

4545
pragma[noinline]
4646
predicate sameFullExpr(FullExpr fe, Expr e1, Expr e2) {
47-
originatingInStatement(e1, fe) and
48-
originatingInStatement(e2, fe)
47+
partOfFullExpr(e1, fe) and
48+
partOfFullExpr(e2, fe)
4949
}
5050

51-
predicate effect(VariableEffect ve, VariableAccess va, Variable v) {
51+
predicate destructureEffect(VariableEffect ve, VariableAccess va, Variable v) {
5252
ve.getAnAccess() = va and
5353
va.getTarget() = v and
5454
ve.getTarget() = v
@@ -60,8 +60,8 @@ from
6060
where
6161
not isExcluded(fullExpr, SideEffects3Package::unsequencedSideEffectsQuery()) and
6262
sameFullExpr(fullExpr, va1, va2) and
63-
effect(variableEffect1, va1, v1) and
64-
effect(variableEffect2, va2, v2) and
63+
destructureEffect(variableEffect1, va1, v1) and
64+
destructureEffect(variableEffect2, va2, v2) and
6565
// Exclude the same effect applying to different objects.
6666
// This occurs when on is a subject of the other.
6767
// For example, foo.bar = 1; where both foo and bar are objects modified by the assignment.

0 commit comments

Comments
 (0)