@@ -981,7 +981,7 @@ private predicate subEdgeIncludingDestructors(Pos p1, Node n1, Node n2, Pos p2)
981981 // called, connect the "before destructors" node directly to the "after
982982 // destructors" node. For performance, only do this when the nodes exist.
983983 exists ( Pos afterDtors | afterDtors .isAfterDestructors ( ) | subEdge ( afterDtors , n1 , _, _) ) and
984- not synthetic_destructor_call ( n1 , 0 , _ ) and
984+ not exists ( getSynthesisedDestructorCallAfterNode ( n1 , 0 ) ) and
985985 p1 .nodeBeforeDestructors ( n1 , n1 ) and
986986 p2 .nodeAfterDestructors ( n2 , n1 )
987987 or
@@ -990,12 +990,12 @@ private predicate subEdgeIncludingDestructors(Pos p1, Node n1, Node n2, Pos p2)
990990 exists ( int maxCallIndex |
991991 maxCallIndex = max ( int i | exists ( getSynthesisedDestructorCallAfterNode ( n , i ) ) ) and
992992 p1 .nodeBeforeDestructors ( n1 , n ) and
993- p2 .nodeAt ( n2 , getSynthesisedDestructorCallVariableAccessAfterNode ( n , maxCallIndex ) ) )
993+ p2 .nodeAt ( n2 , getSynthesisedDestructorCallAfterNode ( n , maxCallIndex ) . getQualifier ( ) ) )
994994 or
995995 // call(i+1) -> access(i)
996996 exists ( int i |
997997 p1 .nodeAt ( n1 , getSynthesisedDestructorCallAfterNode ( n , i + 1 ) ) and
998- p2 .nodeAt ( n2 , getSynthesisedDestructorCallVariableAccessAfterNode ( n , i ) )
998+ p2 .nodeAt ( n2 , getSynthesisedDestructorCallAfterNode ( n , i ) . getQualifier ( ) )
999999 )
10001000 or
10011001 // call(0) -> after destructors end
@@ -1005,9 +1005,13 @@ private predicate subEdgeIncludingDestructors(Pos p1, Node n1, Node n2, Pos p2)
10051005}
10061006
10071007/**
1008- * Gets the `index`'th synthetic destructor call that should follow `node`. The
1009- * exact placement of that call in the CFG depends on the type of `node` as
1010- * follows:
1008+ * Gets the synthetic constructor call for the `index`'th entity that
1009+ * should be destructed following `node`. Note that entities should be
1010+ * destructed in reverse construction order, so these should be called
1011+ * from highest to lowest index.
1012+ *
1013+ * The exact placement of that call in the CFG depends on the type of
1014+ * `node` as follows:
10111015 *
10121016 * - `Block`: after ordinary control flow falls off the end of the block
10131017 * without jumps or exceptions.
@@ -1036,10 +1040,6 @@ DestructorCall getSynthesisedDestructorCallAfterNode(Node n, int i) {
10361040 synthetic_destructor_call ( n , i , result )
10371041}
10381042
1039- VariableAccess getSynthesisedDestructorCallVariableAccessAfterNode ( Node n , int i ) {
1040- result = getSynthesisedDestructorCallAfterNode ( n , i ) .getChild ( - 1 )
1041- }
1042-
10431043/**
10441044 * An expression whose outgoing true/false sub-edges may come from different
10451045 * sub-nodes.
0 commit comments