Files
codeql/csharp/ql/test/library-tests/controlflow/splits/SplittingStressTest.ql
Tom Hvitved 4774bc969a C#: Apply static CFG splitting limit
The predicate `maxSplits()` was previously applied dynamically to ensure that
any control flow node would keep track of at most `maxSplits()` number of splits.
However, there was no guarantee that two different copies of the same AST element
wouldn't contain different splits, so in general the number of copies for a given
AST element `e` could be on the order `$\binom{n}{k}c^k$`, where `n` is the total
number of splits that apply to `e`, `k = maxSplits()`, and `c` is a constant.

With this change, the relevant splits for `e` are instead computed statically,
meaning that the order is instead `$c^k$`.
2019-08-06 11:38:03 +02:00

8 lines
209 B
Plaintext

import csharp
query predicate countSplits(ControlFlowElement cfe, int i) {
i = strictcount(ControlFlow::Nodes::ElementNode n | n.getElement() = cfe)
}
query predicate ssaDef(Ssa::Definition def) { any() }