Skip to content

Commit e0cd595

Browse files
committed
C++: Reduce intermediate tuple counts
1 parent a6e619c commit e0cd595

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -417,8 +417,6 @@ predicate simpleLocalFlowStep(Node nodeFrom, Node nodeTo) {
417417
simpleInstructionLocalFlowStep(nodeFrom.asInstruction(), nodeTo.asInstruction())
418418
}
419419

420-
private predicate hasSize(Type t, int size) { t.getSize() = size }
421-
422420
cached
423421
private predicate simpleInstructionLocalFlowStep(Instruction iFrom, Instruction iTo) {
424422
iTo.(CopyInstruction).getSourceValue() = iFrom
@@ -467,11 +465,12 @@ private predicate simpleInstructionLocalFlowStep(Instruction iFrom, Instruction
467465
iTo.(LoadInstruction).getSourceValueOperand().getAnyDef() = chi
468466
)
469467
or
470-
iTo.(CopyInstruction).getSourceValueOperand().getAnyDef() = iFrom and
471-
exists(Class c, int size |
468+
iTo.(LoadInstruction).getSourceValueOperand().getAnyDef() = iFrom.(StoreInstruction) and
469+
exists(Class c, Type t |
472470
c = iTo.getResultType() and
473-
hasSize(c, size) and
474-
hasSize(iFrom.getResultType(), size)
471+
t = iFrom.getResultType() and
472+
c.getAField().getUnspecifiedType() = t and
473+
c.getSize() = t.getSize()
475474
)
476475
or
477476
// Flow through modeled functions

0 commit comments

Comments
 (0)