@@ -1369,6 +1369,12 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
1369
1369
1370
1370
CcCall ccSomeCall ( ) ;
1371
1371
1372
+ predicate instanceofCc ( Cc cc ) ;
1373
+
1374
+ predicate instanceofCcCall ( CcCall cc ) ;
1375
+
1376
+ predicate instanceofCcNoCall ( CcNoCall cc ) ;
1377
+
1372
1378
class LocalCc ;
1373
1379
1374
1380
DataFlowCallable viableImplCallContextReduced ( DataFlowCall call , CcCall ctx ) ;
@@ -1386,8 +1392,8 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
1386
1392
bindingset [ call, c]
1387
1393
CcNoCall getCallContextReturn ( DataFlowCallable c , DataFlowCall call ) ;
1388
1394
1389
- bindingset [ c , cc]
1390
- LocalCc getLocalCc ( DataFlowCallable c , Cc cc ) ;
1395
+ bindingset [ cc]
1396
+ LocalCc getLocalCc ( Cc cc ) ;
1391
1397
1392
1398
bindingset [ node1, state1]
1393
1399
bindingset [ node2, state2]
@@ -1476,7 +1482,7 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
1476
1482
or
1477
1483
exists ( NodeEx mid , FlowState state0 , Typ t0 , LocalCc localCc |
1478
1484
fwdFlow ( mid , state0 , cc , summaryCtx , argT , argAp , t0 , ap , apa ) and
1479
- localCc = getLocalCc ( mid . getEnclosingCallable ( ) , cc )
1485
+ localCc = getLocalCc ( cc )
1480
1486
|
1481
1487
localStep ( mid , state0 , node , state , true , _, localCc ) and
1482
1488
t = t0
@@ -1613,7 +1619,7 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
1613
1619
ApOption argAp , Typ t , Ap ap , boolean emptyAp , ApApprox apa , boolean cc
1614
1620
) {
1615
1621
fwdFlow ( arg , state , outercc , summaryCtx , argT , argAp , t , ap , apa ) and
1616
- ( if outercc instanceof CcCall then cc = true else cc = false ) and
1622
+ ( if instanceofCcCall ( outercc ) then cc = true else cc = false ) and
1617
1623
if ap instanceof ApNil then emptyAp = true else emptyAp = false
1618
1624
}
1619
1625
@@ -1669,6 +1675,7 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
1669
1675
DataFlowCall call , ArgNodeEx arg , CcCall ctx
1670
1676
) {
1671
1677
callEdgeArgParamRestricted ( call , _, arg , _, _, _) and
1678
+ instanceofCcCall ( ctx ) and
1672
1679
result = viableImplCallContextReducedInlineLate ( call , ctx )
1673
1680
}
1674
1681
@@ -1684,6 +1691,7 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
1684
1691
bindingset [ call, ctx]
1685
1692
pragma [ inline_late]
1686
1693
private predicate viableImplNotCallContextReducedInlineLate ( DataFlowCall call , Cc ctx ) {
1694
+ instanceofCc ( ctx ) and
1687
1695
viableImplNotCallContextReduced ( call , ctx )
1688
1696
}
1689
1697
@@ -1693,6 +1701,7 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
1693
1701
DataFlowCall call , ArgNodeEx arg , Cc outercc
1694
1702
) {
1695
1703
callEdgeArgParamRestricted ( call , _, arg , _, _, _) and
1704
+ instanceofCc ( outercc ) and
1696
1705
viableImplNotCallContextReducedInlineLate ( call , outercc )
1697
1706
}
1698
1707
@@ -1837,6 +1846,7 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
1837
1846
RetNodeEx ret , FlowState state , CcNoCall cc , ParamNodeOption summaryCtx , TypOption argT ,
1838
1847
ApOption argAp , Typ t , Ap ap , ApApprox apa
1839
1848
) {
1849
+ instanceofCcNoCall ( cc ) and
1840
1850
fwdFlow ( ret , state , cc , summaryCtx , argT , argAp , t , ap , apa )
1841
1851
}
1842
1852
@@ -1896,6 +1906,7 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
1896
1906
1897
1907
pragma [ nomagic]
1898
1908
private predicate fwdFlow1Param ( ParamNodeEx p , FlowState state , CcCall cc , Typ t0 , Ap ap ) {
1909
+ instanceofCcCall ( cc ) and
1899
1910
fwdFlow1 ( p , state , cc , _, _, _, t0 , _, ap , _)
1900
1911
}
1901
1912
@@ -1962,6 +1973,7 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
1962
1973
ApApprox argApa , Typ t , Ap ap , ApApprox apa
1963
1974
) {
1964
1975
exists ( ReturnKindExt kind |
1976
+ instanceofCcCall ( ccc ) and
1965
1977
fwdFlow ( pragma [ only_bind_into ] ( ret ) , state , ccc ,
1966
1978
TParamNodeSome ( pragma [ only_bind_into ] ( summaryCtx .asNode ( ) ) ) , TypOption:: some ( argT ) ,
1967
1979
pragma [ only_bind_into ] ( apSome ( argAp ) ) , t , ap , pragma [ only_bind_into ] ( apa ) ) and
@@ -2527,10 +2539,16 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
2527
2539
2528
2540
CcCall ccSomeCall ( ) { result = true }
2529
2541
2542
+ predicate instanceofCc ( Cc cc ) { any ( ) }
2543
+
2544
+ predicate instanceofCcCall ( CcCall cc ) { any ( ) }
2545
+
2546
+ predicate instanceofCcNoCall ( CcNoCall cc ) { any ( ) }
2547
+
2530
2548
class LocalCc = Unit ;
2531
2549
2532
- bindingset [ c , cc]
2533
- LocalCc getLocalCc ( DataFlowCallable c , Cc cc ) { any ( ) }
2550
+ bindingset [ cc]
2551
+ LocalCc getLocalCc ( Cc cc ) { any ( ) }
2534
2552
2535
2553
DataFlowCallable viableImplCallContextReduced ( DataFlowCall call , CcCall ctx ) { none ( ) }
2536
2554
@@ -4081,7 +4099,7 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
4081
4099
state = mid .getState ( ) and
4082
4100
cc = mid .getCallContext ( ) and
4083
4101
sc = mid .getSummaryCtx ( ) and
4084
- localCC = PrunedCallContextSensitivityStage5:: getLocalCc ( midnode . getEnclosingCallable ( ) , cc ) and
4102
+ localCC = PrunedCallContextSensitivityStage5:: getLocalCc ( cc ) and
4085
4103
t = mid .getType ( ) and
4086
4104
ap = mid .getAp ( ) and
4087
4105
summaryLabel = mid .getSummaryLabel ( )
@@ -5144,7 +5162,7 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
5144
5162
boolean isStoreStep
5145
5163
) {
5146
5164
not isUnreachableInCall1 ( node ,
5147
- CachedCallContextSensitivity:: LocalCallContext:: getLocalCc ( node . getEnclosingCallable ( ) , cc ) ) and
5165
+ CachedCallContextSensitivity:: LocalCallContext:: getLocalCc ( cc ) ) and
5148
5166
(
5149
5167
localFlowStepEx ( mid .getNodeEx ( ) , node , _) and
5150
5168
state = mid .getState ( ) and
0 commit comments