Skip to content

Commit f9732c7

Browse files
committed
C++: Patch up various places that depended on the old IPA type.
1 parent 75b6855 commit f9732c7

File tree

3 files changed

+12
-17
lines changed

3 files changed

+12
-17
lines changed

cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowPrivate.qll

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1765,14 +1765,14 @@ module IteratorFlow {
17651765
* Note: Unlike `def.getAnUltimateDefinition()` this predicate also
17661766
* traverses back through iterator increment and decrement operations.
17671767
*/
1768-
private Ssa::Def getAnUltimateDefinition(Ssa::Def def) {
1768+
private Ssa::DefinitionExt getAnUltimateDefinition(Ssa::DefinitionExt def) {
17691769
result = def.getAnUltimateDefinition()
17701770
or
17711771
exists(IRBlock bb, int i, IteratorCrementCall crementCall, Ssa::SourceVariable sv |
17721772
crementCall = def.getValue().asInstruction().(StoreInstruction).getSourceValue() and
17731773
sv = def.getSourceVariable() and
17741774
bb.getInstruction(i) = crementCall and
1775-
Ssa::ssaDefReachesReadExt(sv, result.asDef(), bb, i)
1775+
Ssa::ssaDefReachesReadExt(sv, result, bb, i)
17761776
)
17771777
}
17781778

@@ -1800,13 +1800,13 @@ module IteratorFlow {
18001800
GetsIteratorCall beginCall, Instruction writeToDeref
18011801
) {
18021802
exists(
1803-
StoreInstruction beginStore, IRBlock bbStar, int iStar, Ssa::Def def,
1804-
IteratorPointerDereferenceCall starCall, Ssa::Def ultimate, Operand address
1803+
StoreInstruction beginStore, IRBlock bbStar, int iStar, Ssa::DefinitionExt def,
1804+
IteratorPointerDereferenceCall starCall, Ssa::DefinitionExt ultimate, Operand address
18051805
|
18061806
isIteratorWrite(writeToDeref, address) and
18071807
operandForFullyConvertedCall(address, starCall) and
18081808
bbStar.getInstruction(iStar) = starCall and
1809-
Ssa::ssaDefReachesReadExt(_, def.asDef(), bbStar, iStar) and
1809+
Ssa::ssaDefReachesReadExt(_, def, bbStar, iStar) and
18101810
ultimate = getAnUltimateDefinition*(def) and
18111811
beginStore = ultimate.getValue().asInstruction() and
18121812
operandForFullyConvertedCall(beginStore.getSourceValueOperand(), beginCall)

cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowUtil.qll

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -842,18 +842,11 @@ class InitialGlobalValue extends Node, TInitialGlobalValue {
842842
result.asSourceCallable() = this.getFunction()
843843
}
844844

845-
override Declaration getFunction() { result = globalDef.getIRFunction().getFunction() }
845+
override Declaration getFunction() { result = globalDef.getFunction() }
846846

847847
final override predicate isGLValue() { globalDef.getIndirectionIndex() = 0 }
848848

849-
override DataFlowType getType() {
850-
exists(DataFlowType type |
851-
type = globalDef.getUnderlyingType() and
852-
if this.isGLValue()
853-
then result = type
854-
else result = getTypeImpl(type, globalDef.getIndirectionIndex() - 1)
855-
)
856-
}
849+
override DataFlowType getType() { result = globalDef.getUnderlyingType() }
857850

858851
final override Location getLocationImpl() { result = globalDef.getLocation() }
859852

@@ -1312,7 +1305,7 @@ class UninitializedNode extends Node {
13121305
LocalVariable v;
13131306

13141307
UninitializedNode() {
1315-
exists(Ssa::Def def, Ssa::SourceVariable sv |
1308+
exists(Ssa::DefinitionExt def, Ssa::SourceVariable sv |
13161309
def.getIndirectionIndex() = 0 and
13171310
def.getValue().asInstruction() instanceof UninitializedInstruction and
13181311
Ssa::defToNode(this, def, sv, _, _, _) and

cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/SsaInternals.qll

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -691,8 +691,10 @@ predicate outNodeHasAddressAndIndex(
691691
*
692692
* Holds if `node` is the node that corresponds to the definition of `def`.
693693
*/
694-
predicate defToNode(Node node, Def def, SourceVariable sv, IRBlock bb, int i, boolean uncertain) {
695-
def.hasIndexInBlock(bb, i, sv) and
694+
predicate defToNode(
695+
Node node, DefinitionExt def, SourceVariable sv, IRBlock bb, int i, boolean uncertain
696+
) {
697+
def.definesAt(sv, bb, i, _) and
696698
(
697699
nodeHasOperand(node, def.getValue().asOperand(), def.getIndirectionIndex())
698700
or

0 commit comments

Comments
 (0)