@@ -103,6 +103,7 @@ predicate hasRawIndirectInstruction(Instruction instr, int indirectionIndex) {
103
103
104
104
cached
105
105
private newtype TDefOrUseImpl =
106
+ TDefAddressImpl ( BaseIRVariable v ) or
106
107
TDefImpl ( BaseSourceVariableInstruction base , Operand address , int indirectionIndex ) {
107
108
isDef ( _, _, address , base , _, indirectionIndex )
108
109
} or
@@ -272,7 +273,41 @@ abstract class DefImpl extends DefOrUseImpl {
272
273
abstract Node0Impl getValue ( ) ;
273
274
}
274
275
275
- abstract class OperandBasedDef extends DefImpl {
276
+ /** An initial definition of an `IRVariable`'s address. */
277
+ private class DefAddressImpl extends DefImpl , TDefAddressImpl {
278
+ BaseIRVariable v ;
279
+
280
+ DefAddressImpl ( ) {
281
+ this = TDefAddressImpl ( v ) and
282
+ ind = 0
283
+ }
284
+
285
+ final override int getIndirection ( ) { result = 0 }
286
+
287
+ final override predicate isCertain ( ) { any ( ) }
288
+
289
+ final override Node0Impl getValue ( ) { none ( ) }
290
+
291
+ final override predicate hasIndexInBlock ( IRBlock block , int index ) {
292
+ block = v .getIRVariable ( ) .getEnclosingIRFunction ( ) .getEntryBlock ( ) and
293
+ index = 0
294
+ }
295
+
296
+ override Cpp:: Location getLocation ( ) { result = v .getIRVariable ( ) .getLocation ( ) }
297
+
298
+ final override SourceVariable getSourceVariable ( ) {
299
+ result .getBaseVariable ( ) = v and
300
+ result .getIndirection ( ) = 0
301
+ }
302
+
303
+ final override BaseSourceVariableInstruction getBase ( ) { none ( ) }
304
+ }
305
+
306
+ /**
307
+ * An SSA definition that has an associated `Operand` representing the address
308
+ * that is being written to.
309
+ */
310
+ abstract private class OperandBasedDef extends DefImpl {
276
311
Operand address ;
277
312
278
313
bindingset [ ind]
0 commit comments