@@ -104,7 +104,7 @@ predicate hasRawIndirectInstruction(Instruction instr, int indirectionIndex) {
104
104
105
105
cached
106
106
private newtype TDefImpl =
107
- TDefAddressImpl ( BaseIRVariable v ) or
107
+ TDefAddressImpl ( BaseSourceVariable v ) or
108
108
TDirectDefImpl ( Operand address , int indirectionIndex ) {
109
109
isDef ( _, _, address , _, _, indirectionIndex )
110
110
} or
@@ -325,9 +325,9 @@ private Instruction getInitializationTargetAddress(IRVariable v) {
325
325
)
326
326
}
327
327
328
- /** An initial definition of an `IRVariable`'s address. */
329
- private class DefAddressImpl extends DefImpl , TDefAddressImpl {
330
- BaseIRVariable v ;
328
+ /** An initial definition of an SSA variable address. */
329
+ abstract private class DefAddressImpl extends DefImpl , TDefAddressImpl {
330
+ BaseSourceVariable v ;
331
331
332
332
DefAddressImpl ( ) {
333
333
this = TDefAddressImpl ( v ) and
@@ -342,6 +342,19 @@ private class DefAddressImpl extends DefImpl, TDefAddressImpl {
342
342
343
343
final override Node0Impl getValue ( ) { none ( ) }
344
344
345
+ override Cpp:: Location getLocation ( ) { result = v .getLocation ( ) }
346
+
347
+ final override SourceVariable getSourceVariable ( ) {
348
+ result .getBaseVariable ( ) = v and
349
+ result .getIndirection ( ) = 0
350
+ }
351
+
352
+ final override BaseSourceVariable getBaseSourceVariable ( ) { result = v }
353
+ }
354
+
355
+ private class DefVariableAddressImpl extends DefAddressImpl {
356
+ override BaseIRVariable v ;
357
+
345
358
final override predicate hasIndexInBlock ( IRBlock block , int index ) {
346
359
exists ( IRVariable var | var = v .getIRVariable ( ) |
347
360
block .getInstruction ( index ) = getInitializationTargetAddress ( var )
@@ -353,15 +366,14 @@ private class DefAddressImpl extends DefImpl, TDefAddressImpl {
353
366
index = 0
354
367
)
355
368
}
369
+ }
356
370
357
- override Cpp:: Location getLocation ( ) { result = v .getIRVariable ( ) .getLocation ( ) }
371
+ private class DefCallAddressImpl extends DefAddressImpl {
372
+ override BaseCallVariable v ;
358
373
359
- final override SourceVariable getSourceVariable ( ) {
360
- result .getBaseVariable ( ) = v and
361
- result .getIndirection ( ) = 0
374
+ final override predicate hasIndexInBlock ( IRBlock block , int index ) {
375
+ block .getInstruction ( index ) = v .getCallInstruction ( )
362
376
}
363
-
364
- final override BaseSourceVariable getBaseSourceVariable ( ) { result = v }
365
377
}
366
378
367
379
private class DirectDef extends DefImpl , TDirectDefImpl {
0 commit comments