File tree Expand file tree Collapse file tree
cpp/ql/test/library-tests/dataflow/crement Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ void test_crement () {
2+ int x1 = 0 ;
3+ ++x1; // flow [NOT DETECTED]
4+
5+ int x2 = 0 ;
6+ x2++; // flow [NOT DETECTED]
7+
8+ int x3 = 0 ;
9+ x3 -= 1 ; // flow [NOT DETECTED]
10+
11+ int x4 = 0 ;
12+ x4 |= 1 ; // flow [NOT DETECTED]
13+
14+ int x5 = 0 ;
15+ x5 = x5 - 1 ; // flow (to RHS)
16+ }
Original file line number Diff line number Diff line change 1+ | crements.cpp:15:8:15:9 | x5 |
Original file line number Diff line number Diff line change 1+ import cpp
2+ import semmle.code.cpp.ir.dataflow.DataFlow
3+
4+ class Cfg extends DataFlow:: Configuration {
5+ Cfg ( ) { this = "from0::Cfg" }
6+
7+ override predicate isSource ( DataFlow:: Node source ) { source .asExpr ( ) .getValue ( ) = "0" }
8+
9+ override predicate isSink ( DataFlow:: Node sink ) { sink .asExpr ( ) instanceof VariableAccess }
10+ }
11+
12+ from Cfg cfg , Expr sink
13+ where cfg .hasFlowToExpr ( sink )
14+ select sink
You can’t perform that action at this time.
0 commit comments