File tree Expand file tree Collapse file tree
lib/semmle/code/cpp/ir/dataflow/internal
test/library-tests/dataflow/dataflow-tests Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ private newtype TIRDataFlowNode =
5353 exists ( Ssa:: FinalParameterUse use |
5454 use .getParameter ( ) = p and
5555 use .getIndirectionIndex ( ) = indirectionIndex and
56- parameterIsDefined ( p )
56+ parameterIsRedefined ( p )
5757 )
5858 } or
5959 TFinalGlobalValue ( Ssa:: GlobalUse globalUse ) or
@@ -66,7 +66,7 @@ private newtype TIRDataFlowNode =
6666 * Only parameters satisfying this predicate will generate a `FinalParameterNode` transferring
6767 * flow out of the function.
6868 */
69- private predicate parameterIsDefined ( Parameter p ) {
69+ private predicate parameterIsRedefined ( Parameter p ) {
7070 exists ( Ssa:: Def def |
7171 def .getSourceVariable ( ) .getBaseVariable ( ) .( Ssa:: BaseIRVariable ) .getIRVariable ( ) .getAst ( ) = p and
7272 def .getIndirectionIndex ( ) = 0 and
Original file line number Diff line number Diff line change @@ -28,6 +28,11 @@ module IRTest {
2828 private import semmle.code.cpp.ir.dataflow.DataFlow
2929 private import semmle.code.cpp.ir.dataflow.internal.DataFlowUtil
3030
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+
3136 class IRParameterDefTest extends InlineExpectationsTest {
3237 IRParameterDefTest ( ) { this = "IRParameterDefTest" }
3338
@@ -41,7 +46,7 @@ module IRTest {
4146 location = f .getLocation ( ) and
4247 element = p .toString ( ) and
4348 tag = "ir-def" and
44- value = "**********" . prefix ( n .getIndirectionIndex ( ) ) + p .getName ( )
49+ value = stars ( n .getIndirectionIndex ( ) ) + p .getName ( )
4550 )
4651 }
4752 }
You can’t perform that action at this time.
0 commit comments