Skip to content

Commit 381b65c

Browse files
committed
C++: Do not rely on dataflow nodes when implement 'getAUse' and 'getAnIndirectUse'. This will solve a non-monotonic recursion issue later.
1 parent 60e3fee commit 381b65c

File tree

1 file changed

+3
-2
lines changed
  • cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal

1 file changed

+3
-2
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,7 +1155,7 @@ class Definition extends SsaImpl::Definition {
11551155
exists(SourceVariable sv, IRBlock bb, int i, UseImpl use |
11561156
ssaDefReachesRead(sv, this, bb, i) and
11571157
use.hasIndexInBlock(bb, i, sv) and
1158-
result = use.getNode().asOperand()
1158+
use = TDirectUseImpl(result, 0)
11591159
)
11601160
}
11611161

@@ -1173,10 +1173,11 @@ class Definition extends SsaImpl::Definition {
11731173
* value that was defined by the definition.
11741174
*/
11751175
Operand getAnIndirectUse(int indirectionIndex) {
1176+
indirectionIndex > 0 and
11761177
exists(SourceVariable sv, IRBlock bb, int i, UseImpl use |
11771178
ssaDefReachesRead(sv, this, bb, i) and
11781179
use.hasIndexInBlock(bb, i, sv) and
1179-
result = use.getNode().asIndirectOperand(indirectionIndex)
1180+
use = TDirectUseImpl(result, indirectionIndex)
11801181
)
11811182
}
11821183

0 commit comments

Comments
 (0)