Skip to content

Commit b3eee97

Browse files
committed
Prefer GlobalValueNumbering over GlobalValueNumberingImpl
These are different libraries, so using them both means that similar information will need to be computed twice. Moreover, `GlobalValueNumbering` yields higher quality results and `GlobalValueNumberingImpl` is going to be deprecated.
1 parent 28bf545 commit b3eee97

4 files changed

+10
-2
lines changed

c/cert/src/rules/EXP30-C/DependenceOnOrderOfFunctionArgumentsForSideEffects.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import codingstandards.c.cert
1616
import codingstandards.cpp.SideEffect
1717
import semmle.code.cpp.dataflow.DataFlow
1818
import semmle.code.cpp.dataflow.TaintTracking
19-
import semmle.code.cpp.valuenumbering.GlobalValueNumberingImpl
19+
import semmle.code.cpp.valuenumbering.GlobalValueNumbering
2020

2121
/** Holds if the function's return value is derived from the `AliasParamter` p. */
2222
predicate returnValueDependsOnAliasParameter(AliasParameter p) {
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
- `EXP30-C` - `DependenceOnOrderOfFunctionArgumentsForSideEffects.ql`:
2+
- Prefer the `GlobalValueNumbering` CodeQL library over the `GlobalValueNumberingImpl` library, as the former yields higher quality results and the latter is going to be deprecated. This also improves performance when multiple queries are evaluated, due to more sharing of intermediate computations.
3+
- `EXP50-CPP` - `DoNotDependOnTheOrderOfEvaluationForSideEffectsInFunctionCallsAsFunctionArguments.ql`:
4+
- Prefer the `GlobalValueNumbering` CodeQL library over the `GlobalValueNumberingImpl` library, as the former yields higher quality results and the latter is going to be deprecated. This also improves performance when multiple queries are evaluated, due to more sharing of intermediate computations.

cpp/cert/src/rules/EXP50-CPP/DoNotDependOnTheOrderOfEvaluationForSideEffectsInFunctionCallsAsFunctionArguments.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import codingstandards.cpp.cert
1616
import codingstandards.cpp.SideEffect
1717
import semmle.code.cpp.dataflow.DataFlow
1818
import semmle.code.cpp.dataflow.TaintTracking
19-
import semmle.code.cpp.valuenumbering.GlobalValueNumberingImpl
19+
import semmle.code.cpp.valuenumbering.GlobalValueNumbering
2020

2121
/** Holds if the function's return value is derived from the `AliasParamter` p. */
2222
predicate returnValueDependsOnAliasParameter(AliasParameter p) {

cpp/cert/test/rules/EXP50-CPP/DoNotDependOnTheOrderOfEvaluationForSideEffectsInFunctionCallsAsFunctionArguments.expected

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,8 @@
22
| test.cpp:84:3:84:4 | call to f2 | Depending on the order of evaluation for the arguments $@ and $@ for side effects on shared state is unspecified and can result in unexpected behavior. | test.cpp:84:6:84:7 | call to f5 | call to f5 | test.cpp:84:12:84:13 | call to f7 | call to f7 |
33
| test.cpp:87:3:87:4 | call to f2 | Depending on the order of evaluation for the arguments $@ and $@ for side effects on shared state is unspecified and can result in unexpected behavior. | test.cpp:87:9:87:10 | call to m1 | call to m1 | test.cpp:87:18:87:19 | call to m1 | call to m1 |
44
| test.cpp:89:3:89:4 | call to f2 | Depending on the order of evaluation for the arguments $@ and $@ for side effects on shared state is unspecified and can result in unexpected behavior. | test.cpp:89:9:89:10 | call to m2 | call to m2 | test.cpp:89:18:89:19 | call to m2 | call to m2 |
5+
| test.cpp:92:3:92:4 | call to f2 | Depending on the order of evaluation for the arguments $@ and $@ for side effects on shared state is unspecified and can result in unexpected behavior. | test.cpp:92:6:92:7 | call to f8 | call to f8 | test.cpp:92:14:92:15 | call to f9 | call to f9 |
6+
| test.cpp:93:3:93:4 | call to f2 | Depending on the order of evaluation for the arguments $@ and $@ for side effects on shared state is unspecified and can result in unexpected behavior. | test.cpp:93:6:93:7 | call to f8 | call to f8 | test.cpp:93:14:93:16 | call to f11 | call to f11 |
7+
| test.cpp:95:3:95:4 | call to f2 | Depending on the order of evaluation for the arguments $@ and $@ for side effects on shared state is unspecified and can result in unexpected behavior. | test.cpp:95:6:95:7 | call to f8 | call to f8 | test.cpp:95:13:95:14 | call to f9 | call to f9 |
8+
| test.cpp:96:3:96:4 | call to f2 | Depending on the order of evaluation for the arguments $@ and $@ for side effects on shared state is unspecified and can result in unexpected behavior. | test.cpp:96:6:96:7 | call to f8 | call to f8 | test.cpp:96:13:96:15 | call to f11 | call to f11 |
59
| test.cpp:99:3:99:4 | call to f2 | Depending on the order of evaluation for the arguments $@ and $@ for side effects on shared state is unspecified and can result in unexpected behavior. | test.cpp:99:9:99:10 | call to m1 | call to m1 | test.cpp:99:18:99:19 | call to m1 | call to m1 |

0 commit comments

Comments
 (0)