Skip to content

Commit 06066f0

Browse files
authored
Merge pull request github#3659 from jbj/getFieldSizeOfClass-perf
C++: Performance tweak for 1-field struct loads
2 parents f77f486 + a341912 commit 06066f0

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -564,10 +564,11 @@ private predicate simpleInstructionLocalFlowStep(Instruction iFrom, Instruction
564564
or
565565
// Flow from stores to structs with a single field to a load of that field.
566566
iTo.(LoadInstruction).getSourceValueOperand().getAnyDef() = iFrom and
567-
exists(int size, Type type |
567+
exists(int size, Type type, Class cTo |
568568
type = iFrom.getResultType() and
569-
iTo.getResultType().getSize() = size and
570-
getFieldSizeOfClass(iTo.getResultType(), type, size)
569+
cTo = iTo.getResultType() and
570+
cTo.getSize() = size and
571+
getFieldSizeOfClass(cTo, type, size)
571572
)
572573
or
573574
// Flow through modeled functions

0 commit comments

Comments
 (0)