@@ -103,6 +103,7 @@ predicate hasRawIndirectInstruction(Instruction instr, int indirectionIndex) {
103103
104104cached
105105private newtype TDefOrUseImpl =
106+ TDefAddressImpl ( BaseIRVariable v ) or
106107 TDefImpl ( BaseSourceVariableInstruction base , Operand address , int indirectionIndex ) {
107108 isDef ( _, _, address , base , _, indirectionIndex )
108109 } or
@@ -272,7 +273,41 @@ abstract class DefImpl extends DefOrUseImpl {
272273 abstract Node0Impl getValue ( ) ;
273274}
274275
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 {
276311 Operand address ;
277312
278313 bindingset [ ind]
0 commit comments