@@ -306,7 +306,14 @@ class ExprNode extends AstNode {
306306
307307 ExprNode ( ) { expr = ast }
308308
309- override AstNode getChildInternal ( int childIndex ) { result .getAst ( ) = expr .getChild ( childIndex ) }
309+ override AstNode getChildInternal ( int childIndex ) {
310+ result .getAst ( ) = expr .getChild ( childIndex )
311+ or
312+ exists ( int destructorIndex |
313+ result .getAst ( ) = expr .getSyntheticDestructor ( destructorIndex ) and
314+ childIndex = destructorIndex + max ( int index | exists ( expr .getChild ( index ) ) or index = 0 ) + 1
315+ )
316+ }
310317
311318 override string getProperty ( string key ) {
312319 result = super .getProperty ( key )
@@ -439,6 +446,11 @@ class StmtNode extends AstNode {
439446 result .getAst ( ) = child .( Stmt )
440447 )
441448 )
449+ or
450+ exists ( int destructorIndex |
451+ result .getAst ( ) = stmt .getSyntheticDestructor ( destructorIndex ) and
452+ childIndex = destructorIndex + max ( int index | exists ( stmt .getChild ( index ) ) or index = 0 ) + 1
453+ )
442454 }
443455
444456 override string getChildAccessorPredicateInternal ( int childIndex ) {
@@ -662,13 +674,21 @@ private string getChildAccessorWithoutConversions(Locatable parent, Element chil
662674 or
663675 not namedStmtChildPredicates ( s , child , _) and
664676 exists ( int n | s .getChild ( n ) = child and result = "getChild(" + n + ")" )
677+ or
678+ exists ( int n |
679+ s .getSyntheticDestructor ( n ) = child and result = "getSyntheticDestructor(" + n + ")"
680+ )
665681 )
666682 or
667683 exists ( Expr expr | expr = parent |
668684 namedExprChildPredicates ( expr , child , result )
669685 or
670686 not namedExprChildPredicates ( expr , child , _) and
671687 exists ( int n | expr .getChild ( n ) = child and result = "getChild(" + n + ")" )
688+ or
689+ exists ( int n |
690+ expr .getSyntheticDestructor ( n ) = child and result = "getSyntheticDestructor(" + n + ")"
691+ )
672692 )
673693 )
674694}
0 commit comments