diff --git a/cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/SemanticExprSpecific.qll b/cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/SemanticExprSpecific.qll index d929f9d447b7..6bb0ffce89cc 100644 --- a/cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/SemanticExprSpecific.qll +++ b/cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/SemanticExprSpecific.qll @@ -128,42 +128,10 @@ module SemanticExprConfig { int getBasicBlockUniqueId(BasicBlock block) { idOf(block.getFirstInstruction().getAst(), result) } - newtype TSsaVariable = - TSsaInstruction(IR::Instruction instr) { instr.hasMemoryResult() } or - TSsaOperand(IR::Operand op) { op.isDefinitionInexact() } + class SsaVariable extends IR::Instruction { + SsaVariable() { this.hasMemoryResult() } - class SsaVariable extends TSsaVariable { - string toString() { none() } - - Location getLocation() { none() } - - IR::Instruction asInstruction() { none() } - - IR::Operand asOperand() { none() } - } - - class SsaInstructionVariable extends SsaVariable, TSsaInstruction { - IR::Instruction instr; - - SsaInstructionVariable() { this = TSsaInstruction(instr) } - - final override string toString() { result = instr.toString() } - - final override Location getLocation() { result = instr.getLocation() } - - final override IR::Instruction asInstruction() { result = instr } - } - - class SsaOperand extends SsaVariable, TSsaOperand { - IR::Operand op; - - SsaOperand() { this = TSsaOperand(op) } - - final override string toString() { result = op.toString() } - - final override Location getLocation() { result = op.getLocation() } - - final override IR::Operand asOperand() { result = op } + IR::Instruction asInstruction() { result = this } } predicate explicitUpdate(SsaVariable v, Expr sourceExpr) { @@ -180,9 +148,7 @@ module SemanticExprConfig { SsaVariable getAPhiInput(SsaVariable v) { exists(IR::PhiInstruction instr | v.asInstruction() = instr | - result.asInstruction() = instr.getAnInput() - or - result.asOperand() = instr.getAnInputOperand() + result.asInstruction() = instr.getAnInputOperand().getAnyDef() ) } @@ -192,11 +158,7 @@ module SemanticExprConfig { result = getSemanticType(v.asInstruction().getResultIRType()) } - BasicBlock getSsaVariableBasicBlock(SsaVariable v) { - result = v.asInstruction().getBlock() - or - result = v.asOperand().getUse().getBlock() - } + BasicBlock getSsaVariableBasicBlock(SsaVariable v) { result = v.asInstruction().getBlock() } private newtype TReadPosition = TReadPositionBlock(IR::IRBlock block) or @@ -263,11 +225,7 @@ module SemanticExprConfig { pos = TReadPositionPhiInputEdge(operand.getPredecessorBlock(), operand.getUse().getBlock()) | phi.asInstruction() = operand.getUse() and - ( - input.asInstruction() = operand.getDef() - or - input.asOperand() = operand - ) + input.asInstruction() = operand.getAnyDef() ) }