Files
codeql/cpp/ql/test/library-tests/ir/escape/ssa_escape.ql
Jonas Jensen 85df60ea65 C++: Replace import default with import cpp
Some tests still used the old name for the top-level library.
2020-05-25 19:07:28 +02:00

26 lines
785 B
Plaintext

import cpp
import semmle.code.cpp.ir.implementation.aliased_ssa.internal.AliasAnalysis
import semmle.code.cpp.ir.implementation.aliased_ssa.internal.AliasConfiguration
import semmle.code.cpp.ir.implementation.unaliased_ssa.IR
import semmle.code.cpp.ir.implementation.UseSoundEscapeAnalysis
class InterestingAllocation extends VariableAllocation {
IRUserVariable userVar;
InterestingAllocation() { userVar = this.getIRVariable() }
final predicate shouldEscape() { userVar.getVariable().getName().matches("no_%") }
}
from InterestingAllocation var
where
exists(IRFunction irFunc |
irFunc = var.getEnclosingIRFunction() and
(
var.shouldEscape() and allocationEscapes(var)
or
not var.shouldEscape() and not allocationEscapes(var)
)
)
select var