@@ -108,8 +108,8 @@ private module Internal {
108108 */
109109 cached
110110 newtype TSsaDefinition =
111- TExplicitDef ( ReachableBasicBlock bb , int i , VarDef d , SsaSourceVariable v ) {
112- bb .defAt ( i , v , d ) and
111+ TExplicitDef ( ReachableBasicBlock bb , int i , VarDef d , SsaSourceVariable v , VarRef lhs ) {
112+ bb .defAt ( i , v , d , lhs ) and
113113 (
114114 liveAfterDef ( bb , i , v ) or
115115 v .isCaptured ( )
@@ -509,19 +509,22 @@ class SsaDefinition extends TSsaDefinition {
509509 */
510510class SsaExplicitDefinition extends SsaDefinition , TExplicitDef {
511511 override predicate definesAt ( ReachableBasicBlock bb , int i , SsaSourceVariable v ) {
512- this = TExplicitDef ( bb , i , _, v )
512+ this = TExplicitDef ( bb , i , _, v , _ )
513513 }
514514
515515 /** This SSA definition corresponds to the definition of `v` at `def`. */
516- predicate defines ( VarDef def , SsaSourceVariable v ) { this = TExplicitDef ( _, _, def , v ) }
516+ predicate defines ( VarDef def , SsaSourceVariable v ) { this = TExplicitDef ( _, _, def , v , _ ) }
517517
518518 /** Gets the variable definition wrapped by this SSA definition. */
519- VarDef getDef ( ) { this = TExplicitDef ( _, _, result , _) }
519+ VarDef getDef ( ) { this = TExplicitDef ( _, _, result , _, _) }
520+
521+ /** Gets the variable reference appearing on the left-hand side of this assignment. */
522+ VarRef getLhs ( ) { this = TExplicitDef ( _, _, _, _, result ) }
520523
521524 /** Gets the basic block to which this definition belongs. */
522525 override ReachableBasicBlock getBasicBlock ( ) { this .definesAt ( result , _, _) }
523526
524- override SsaSourceVariable getSourceVariable ( ) { this = TExplicitDef ( _, _, _, result ) }
527+ override SsaSourceVariable getSourceVariable ( ) { this = TExplicitDef ( _, _, _, result , _ ) }
525528
526529 override VarDef getAContributingVarDef ( ) { result = this .getDef ( ) }
527530
@@ -533,6 +536,8 @@ class SsaExplicitDefinition extends SsaDefinition, TExplicitDef {
533536
534537 override string prettyPrintDef ( ) { result = this .getDef ( ) .toString ( ) }
535538
539+ override Location getLocation ( ) { result = this .getLhs ( ) .getLocation ( ) }
540+
536541 /**
537542 * Gets the data flow node representing the incoming value assigned at this definition,
538543 * if any.
0 commit comments