@@ -815,24 +815,20 @@ private module Cached {
815
815
)
816
816
}
817
817
818
- private predicate store (
819
- Node node1 , Content c , Node node2 , DataFlowType contentType , DataFlowType containerType
820
- ) {
821
- exists ( ContentSet cs |
822
- c = cs .getAStoreContent ( ) and storeSet ( node1 , cs , node2 , contentType , containerType )
823
- )
824
- }
825
-
826
818
/**
827
819
* Holds if data can flow from `node1` to `node2` via a direct assignment to
828
- * `f `.
820
+ * `c `.
829
821
*
830
822
* This includes reverse steps through reads when the result of the read has
831
823
* been stored into, in order to handle cases like `x.f1.f2 = y`.
832
824
*/
833
825
cached
834
- predicate store ( Node node1 , TypedContent tc , Node node2 , DataFlowType contentType ) {
835
- store ( node1 , tc .getContent ( ) , node2 , contentType , tc .getContainerType ( ) )
826
+ predicate store (
827
+ Node node1 , Content c , Node node2 , DataFlowType contentType , DataFlowType containerType
828
+ ) {
829
+ exists ( ContentSet cs |
830
+ c = cs .getAStoreContent ( ) and storeSet ( node1 , cs , node2 , contentType , containerType )
831
+ )
836
832
}
837
833
838
834
/**
@@ -932,36 +928,15 @@ private module Cached {
932
928
TReturnCtxNoFlowThrough ( ) or
933
929
TReturnCtxMaybeFlowThrough ( ReturnPosition pos )
934
930
935
- cached
936
- newtype TTypedContentApprox =
937
- MkTypedContentApprox ( ContentApprox c , DataFlowType t ) {
938
- exists ( Content cont |
939
- c = getContentApprox ( cont ) and
940
- store ( _, cont , _, _, t )
941
- )
942
- }
943
-
944
- cached
945
- newtype TTypedContent = MkTypedContent ( Content c , DataFlowType t ) { store ( _, c , _, _, t ) }
946
-
947
- cached
948
- TypedContent getATypedContent ( TypedContentApprox c ) {
949
- exists ( ContentApprox cls , DataFlowType t , Content cont |
950
- c = MkTypedContentApprox ( cls , pragma [ only_bind_into ] ( t ) ) and
951
- result = MkTypedContent ( cont , pragma [ only_bind_into ] ( t ) ) and
952
- cls = getContentApprox ( cont )
953
- )
954
- }
955
-
956
931
cached
957
932
newtype TAccessPathFront =
958
- TFrontNil ( DataFlowType t ) or
959
- TFrontHead ( TypedContent tc )
933
+ TFrontNil ( ) or
934
+ TFrontHead ( Content c )
960
935
961
936
cached
962
937
newtype TApproxAccessPathFront =
963
- TApproxFrontNil ( DataFlowType t ) or
964
- TApproxFrontHead ( TypedContentApprox tc )
938
+ TApproxFrontNil ( ) or
939
+ TApproxFrontHead ( ContentApprox c )
965
940
966
941
cached
967
942
newtype TAccessPathFrontOption =
@@ -1387,67 +1362,37 @@ class ReturnCtx extends TReturnCtx {
1387
1362
}
1388
1363
}
1389
1364
1390
- /** An approximated `Content` tagged with the type of a containing object. */
1391
- class TypedContentApprox extends MkTypedContentApprox {
1392
- private ContentApprox c ;
1393
- private DataFlowType t ;
1394
-
1395
- TypedContentApprox ( ) { this = MkTypedContentApprox ( c , t ) }
1396
-
1397
- /** Gets a typed content approximated by this value. */
1398
- TypedContent getATypedContent ( ) { result = getATypedContent ( this ) }
1399
-
1400
- /** Gets the content. */
1401
- ContentApprox getContent ( ) { result = c }
1402
-
1403
- /** Gets the container type. */
1404
- DataFlowType getContainerType ( ) { result = t }
1405
-
1406
- /** Gets a textual representation of this approximated content. */
1407
- string toString ( ) { result = c .toString ( ) }
1408
- }
1409
-
1410
1365
/**
1411
1366
* The front of an approximated access path. This is either a head or a nil.
1412
1367
*/
1413
1368
abstract class ApproxAccessPathFront extends TApproxAccessPathFront {
1414
1369
abstract string toString ( ) ;
1415
1370
1416
- abstract DataFlowType getType ( ) ;
1417
-
1418
1371
abstract boolean toBoolNonEmpty ( ) ;
1419
1372
1420
- TypedContentApprox getHead ( ) { this = TApproxFrontHead ( result ) }
1373
+ ContentApprox getHead ( ) { this = TApproxFrontHead ( result ) }
1421
1374
1422
1375
pragma [ nomagic]
1423
- TypedContent getAHead ( ) {
1424
- exists ( TypedContentApprox cont |
1376
+ Content getAHead ( ) {
1377
+ exists ( ContentApprox cont |
1425
1378
this = TApproxFrontHead ( cont ) and
1426
- result = cont . getATypedContent ( )
1379
+ cont = getContentApprox ( result )
1427
1380
)
1428
1381
}
1429
1382
}
1430
1383
1431
1384
class ApproxAccessPathFrontNil extends ApproxAccessPathFront , TApproxFrontNil {
1432
- private DataFlowType t ;
1433
-
1434
- ApproxAccessPathFrontNil ( ) { this = TApproxFrontNil ( t ) }
1435
-
1436
- override string toString ( ) { result = ppReprType ( t ) }
1437
-
1438
- override DataFlowType getType ( ) { result = t }
1385
+ override string toString ( ) { result = "nil" }
1439
1386
1440
1387
override boolean toBoolNonEmpty ( ) { result = false }
1441
1388
}
1442
1389
1443
1390
class ApproxAccessPathFrontHead extends ApproxAccessPathFront , TApproxFrontHead {
1444
- private TypedContentApprox tc ;
1445
-
1446
- ApproxAccessPathFrontHead ( ) { this = TApproxFrontHead ( tc ) }
1391
+ private ContentApprox c ;
1447
1392
1448
- override string toString ( ) { result = tc . toString ( ) }
1393
+ ApproxAccessPathFrontHead ( ) { this = TApproxFrontHead ( c ) }
1449
1394
1450
- override DataFlowType getType ( ) { result = tc . getContainerType ( ) }
1395
+ override string toString ( ) { result = c . toString ( ) }
1451
1396
1452
1397
override boolean toBoolNonEmpty ( ) { result = true }
1453
1398
}
@@ -1461,65 +1406,31 @@ class ApproxAccessPathFrontOption extends TApproxAccessPathFrontOption {
1461
1406
}
1462
1407
}
1463
1408
1464
- /** A `Content` tagged with the type of a containing object. */
1465
- class TypedContent extends MkTypedContent {
1466
- private Content c ;
1467
- private DataFlowType t ;
1468
-
1469
- TypedContent ( ) { this = MkTypedContent ( c , t ) }
1470
-
1471
- /** Gets the content. */
1472
- Content getContent ( ) { result = c }
1473
-
1474
- /** Gets the container type. */
1475
- DataFlowType getContainerType ( ) { result = t }
1476
-
1477
- /** Gets a textual representation of this content. */
1478
- string toString ( ) { result = c .toString ( ) }
1479
-
1480
- /**
1481
- * Holds if access paths with this `TypedContent` at their head always should
1482
- * be tracked at high precision. This disables adaptive access path precision
1483
- * for such access paths.
1484
- */
1485
- predicate forceHighPrecision ( ) { forceHighPrecision ( c ) }
1486
- }
1487
-
1488
1409
/**
1489
1410
* The front of an access path. This is either a head or a nil.
1490
1411
*/
1491
1412
abstract class AccessPathFront extends TAccessPathFront {
1492
1413
abstract string toString ( ) ;
1493
1414
1494
- abstract DataFlowType getType ( ) ;
1495
-
1496
1415
abstract ApproxAccessPathFront toApprox ( ) ;
1497
1416
1498
- TypedContent getHead ( ) { this = TFrontHead ( result ) }
1417
+ Content getHead ( ) { this = TFrontHead ( result ) }
1499
1418
}
1500
1419
1501
1420
class AccessPathFrontNil extends AccessPathFront , TFrontNil {
1502
- private DataFlowType t ;
1503
-
1504
- AccessPathFrontNil ( ) { this = TFrontNil ( t ) }
1505
-
1506
- override string toString ( ) { result = ppReprType ( t ) }
1421
+ override string toString ( ) { result = "nil" }
1507
1422
1508
- override DataFlowType getType ( ) { result = t }
1509
-
1510
- override ApproxAccessPathFront toApprox ( ) { result = TApproxFrontNil ( t ) }
1423
+ override ApproxAccessPathFront toApprox ( ) { result = TApproxFrontNil ( ) }
1511
1424
}
1512
1425
1513
1426
class AccessPathFrontHead extends AccessPathFront , TFrontHead {
1514
- private TypedContent tc ;
1515
-
1516
- AccessPathFrontHead ( ) { this = TFrontHead ( tc ) }
1427
+ private Content c ;
1517
1428
1518
- override string toString ( ) { result = tc . toString ( ) }
1429
+ AccessPathFrontHead ( ) { this = TFrontHead ( c ) }
1519
1430
1520
- override DataFlowType getType ( ) { result = tc . getContainerType ( ) }
1431
+ override string toString ( ) { result = c . toString ( ) }
1521
1432
1522
- override ApproxAccessPathFront toApprox ( ) { result .getAHead ( ) = tc }
1433
+ override ApproxAccessPathFront toApprox ( ) { result .getAHead ( ) = c }
1523
1434
}
1524
1435
1525
1436
/** An optional access path front. */
0 commit comments