@@ -108,8 +108,8 @@ private module Internal {
108
108
*/
109
109
cached
110
110
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
113
113
(
114
114
liveAfterDef ( bb , i , v ) or
115
115
v .isCaptured ( )
@@ -509,19 +509,22 @@ class SsaDefinition extends TSsaDefinition {
509
509
*/
510
510
class SsaExplicitDefinition extends SsaDefinition , TExplicitDef {
511
511
override predicate definesAt ( ReachableBasicBlock bb , int i , SsaSourceVariable v ) {
512
- this = TExplicitDef ( bb , i , _, v )
512
+ this = TExplicitDef ( bb , i , _, v , _ )
513
513
}
514
514
515
515
/** 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 , _ ) }
517
517
518
518
/** 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 ) }
520
523
521
524
/** Gets the basic block to which this definition belongs. */
522
525
override ReachableBasicBlock getBasicBlock ( ) { this .definesAt ( result , _, _) }
523
526
524
- override SsaSourceVariable getSourceVariable ( ) { this = TExplicitDef ( _, _, _, result ) }
527
+ override SsaSourceVariable getSourceVariable ( ) { this = TExplicitDef ( _, _, _, result , _ ) }
525
528
526
529
override VarDef getAContributingVarDef ( ) { result = this .getDef ( ) }
527
530
@@ -533,6 +536,8 @@ class SsaExplicitDefinition extends SsaDefinition, TExplicitDef {
533
536
534
537
override string prettyPrintDef ( ) { result = this .getDef ( ) .toString ( ) }
535
538
539
+ override Location getLocation ( ) { result = this .getLhs ( ) .getLocation ( ) }
540
+
536
541
/**
537
542
* Gets the data flow node representing the incoming value assigned at this definition,
538
543
* if any.
0 commit comments