File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed
lib/semmle/code/cpp/ir/dataflow/internal
test/library-tests/dataflow/dataflow-tests Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ private newtype TIRDataFlowNode =
53
53
exists ( Ssa:: FinalParameterUse use |
54
54
use .getParameter ( ) = p and
55
55
use .getIndirectionIndex ( ) = indirectionIndex and
56
- parameterIsDefined ( p )
56
+ parameterIsRedefined ( p )
57
57
)
58
58
} or
59
59
TFinalGlobalValue ( Ssa:: GlobalUse globalUse ) or
@@ -66,7 +66,7 @@ private newtype TIRDataFlowNode =
66
66
* Only parameters satisfying this predicate will generate a `FinalParameterNode` transferring
67
67
* flow out of the function.
68
68
*/
69
- private predicate parameterIsDefined ( Parameter p ) {
69
+ private predicate parameterIsRedefined ( Parameter p ) {
70
70
exists ( Ssa:: Def def |
71
71
def .getSourceVariable ( ) .getBaseVariable ( ) .( Ssa:: BaseIRVariable ) .getIRVariable ( ) .getAst ( ) = p and
72
72
def .getIndirectionIndex ( ) = 0 and
Original file line number Diff line number Diff line change @@ -28,6 +28,11 @@ module IRTest {
28
28
private import semmle.code.cpp.ir.dataflow.DataFlow
29
29
private import semmle.code.cpp.ir.dataflow.internal.DataFlowUtil
30
30
31
+ private string stars ( int k ) {
32
+ k = [ 0 .. max ( FinalParameterNode n | | n .getIndirectionIndex ( ) ) ] and
33
+ ( if k = 0 then result = "" else result = "*" + stars ( k - 1 ) )
34
+ }
35
+
31
36
class IRParameterDefTest extends InlineExpectationsTest {
32
37
IRParameterDefTest ( ) { this = "IRParameterDefTest" }
33
38
@@ -41,7 +46,7 @@ module IRTest {
41
46
location = f .getLocation ( ) and
42
47
element = p .toString ( ) and
43
48
tag = "ir-def" and
44
- value = "**********" . prefix ( n .getIndirectionIndex ( ) ) + p .getName ( )
49
+ value = stars ( n .getIndirectionIndex ( ) ) + p .getName ( )
45
50
)
46
51
}
47
52
}
You can’t perform that action at this time.
0 commit comments