Files
codeql/cpp/ql/test/library-tests/controlflow/controlflow/SsaUniqueness.ql
Jonas Jensen 95a333d28c C++: Use StackVariable in SSA libraries
This means we'll no longer get SSA definitions for thread-local
local-scope variables.
2019-11-19 11:30:59 +01:00

20 lines
493 B
Plaintext

/**
* @name SSA unique definition test
* @description SSA unique definition test. For each use there must be zero or one SSA definitions.
* @kind test
*/
import cpp
import semmle.code.cpp.controlflow.SSA
/*
* Count of number of uses where the number of SSA definitions exceeds one.
* Should always be zero *regardless* of the input
*/
select count(SsaDefinition d1, SsaDefinition d2, Expr u, StackVariable v |
d1.getAUse(v) = u and
d2.getAUse(v) = u and
not d1 = d2
)