@@ -815,24 +815,20 @@ private module Cached {
815815 )
816816 }
817817
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-
826818 /**
827819 * Holds if data can flow from `node1` to `node2` via a direct assignment to
828- * `f `.
820+ * `c `.
829821 *
830822 * This includes reverse steps through reads when the result of the read has
831823 * been stored into, in order to handle cases like `x.f1.f2 = y`.
832824 */
833825 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+ )
836832 }
837833
838834 /**
@@ -932,36 +928,15 @@ private module Cached {
932928 TReturnCtxNoFlowThrough ( ) or
933929 TReturnCtxMaybeFlowThrough ( ReturnPosition pos )
934930
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-
956931 cached
957932 newtype TAccessPathFront =
958- TFrontNil ( DataFlowType t ) or
959- TFrontHead ( TypedContent tc )
933+ TFrontNil ( ) or
934+ TFrontHead ( Content c )
960935
961936 cached
962937 newtype TApproxAccessPathFront =
963- TApproxFrontNil ( DataFlowType t ) or
964- TApproxFrontHead ( TypedContentApprox tc )
938+ TApproxFrontNil ( ) or
939+ TApproxFrontHead ( ContentApprox c )
965940
966941 cached
967942 newtype TAccessPathFrontOption =
@@ -1387,67 +1362,37 @@ class ReturnCtx extends TReturnCtx {
13871362 }
13881363}
13891364
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-
14101365/**
14111366 * The front of an approximated access path. This is either a head or a nil.
14121367 */
14131368abstract class ApproxAccessPathFront extends TApproxAccessPathFront {
14141369 abstract string toString ( ) ;
14151370
1416- abstract DataFlowType getType ( ) ;
1417-
14181371 abstract boolean toBoolNonEmpty ( ) ;
14191372
1420- TypedContentApprox getHead ( ) { this = TApproxFrontHead ( result ) }
1373+ ContentApprox getHead ( ) { this = TApproxFrontHead ( result ) }
14211374
14221375 pragma [ nomagic]
1423- TypedContent getAHead ( ) {
1424- exists ( TypedContentApprox cont |
1376+ Content getAHead ( ) {
1377+ exists ( ContentApprox cont |
14251378 this = TApproxFrontHead ( cont ) and
1426- result = cont . getATypedContent ( )
1379+ cont = getContentApprox ( result )
14271380 )
14281381 }
14291382}
14301383
14311384class 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" }
14391386
14401387 override boolean toBoolNonEmpty ( ) { result = false }
14411388}
14421389
14431390class ApproxAccessPathFrontHead extends ApproxAccessPathFront , TApproxFrontHead {
1444- private TypedContentApprox tc ;
1445-
1446- ApproxAccessPathFrontHead ( ) { this = TApproxFrontHead ( tc ) }
1391+ private ContentApprox c ;
14471392
1448- override string toString ( ) { result = tc . toString ( ) }
1393+ ApproxAccessPathFrontHead ( ) { this = TApproxFrontHead ( c ) }
14491394
1450- override DataFlowType getType ( ) { result = tc . getContainerType ( ) }
1395+ override string toString ( ) { result = c . toString ( ) }
14511396
14521397 override boolean toBoolNonEmpty ( ) { result = true }
14531398}
@@ -1461,65 +1406,31 @@ class ApproxAccessPathFrontOption extends TApproxAccessPathFrontOption {
14611406 }
14621407}
14631408
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-
14881409/**
14891410 * The front of an access path. This is either a head or a nil.
14901411 */
14911412abstract class AccessPathFront extends TAccessPathFront {
14921413 abstract string toString ( ) ;
14931414
1494- abstract DataFlowType getType ( ) ;
1495-
14961415 abstract ApproxAccessPathFront toApprox ( ) ;
14971416
1498- TypedContent getHead ( ) { this = TFrontHead ( result ) }
1417+ Content getHead ( ) { this = TFrontHead ( result ) }
14991418}
15001419
15011420class 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" }
15071422
1508- override DataFlowType getType ( ) { result = t }
1509-
1510- override ApproxAccessPathFront toApprox ( ) { result = TApproxFrontNil ( t ) }
1423+ override ApproxAccessPathFront toApprox ( ) { result = TApproxFrontNil ( ) }
15111424}
15121425
15131426class AccessPathFrontHead extends AccessPathFront , TFrontHead {
1514- private TypedContent tc ;
1515-
1516- AccessPathFrontHead ( ) { this = TFrontHead ( tc ) }
1427+ private Content c ;
15171428
1518- override string toString ( ) { result = tc . toString ( ) }
1429+ AccessPathFrontHead ( ) { this = TFrontHead ( c ) }
15191430
1520- override DataFlowType getType ( ) { result = tc . getContainerType ( ) }
1431+ override string toString ( ) { result = c . toString ( ) }
15211432
1522- override ApproxAccessPathFront toApprox ( ) { result .getAHead ( ) = tc }
1433+ override ApproxAccessPathFront toApprox ( ) { result .getAHead ( ) = c }
15231434}
15241435
15251436/** An optional access path front. */
0 commit comments