Skip to content

Commit be8195a

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 f47dd2b commit be8195a

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

  • cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal

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
@@ -1159,7 +1159,7 @@ class Definition extends SsaImpl::Definition {
11591159
exists(SourceVariable sv, IRBlock bb, int i, UseImpl use |
11601160
ssaDefReachesRead(sv, this, bb, i) and
11611161
use.hasIndexInBlock(bb, i, sv) and
1162-
result = use.getNode().asOperand()
1162+
use = TDirectUseImpl(result, 0)
11631163
)
11641164
}
11651165

@@ -1177,10 +1177,11 @@ class Definition extends SsaImpl::Definition {
11771177
* value that was defined by the definition.
11781178
*/
11791179
Operand getAnIndirectUse(int indirectionIndex) {
1180+
indirectionIndex > 0 and
11801181
exists(SourceVariable sv, IRBlock bb, int i, UseImpl use |
11811182
ssaDefReachesRead(sv, this, bb, i) and
11821183
use.hasIndexInBlock(bb, i, sv) and
1183-
result = use.getNode().asIndirectOperand(indirectionIndex)
1184+
use = TDirectUseImpl(result, indirectionIndex)
11841185
)
11851186
}
11861187

0 commit comments

Comments
 (0)