File tree Expand file tree Collapse file tree
cpp/ql/test/library-tests/ir/escape Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1616 exists ( IRFunction irFunc |
1717 irFunc = var .getEnclosingIRFunction ( ) and
1818 (
19- shouldEscape ( var ) and variableAddressEscapes ( var )
19+ shouldEscape ( var ) and allocationEscapes ( var )
2020 or
21- not shouldEscape ( var ) and not variableAddressEscapes ( var )
21+ not shouldEscape ( var ) and not allocationEscapes ( var )
2222 )
2323 )
2424select var
Original file line number Diff line number Diff line change 11import default
22import semmle.code.cpp.ir.implementation.aliased_ssa.internal.AliasAnalysis
3+ import semmle.code.cpp.ir.implementation.aliased_ssa.internal.AliasConfiguration
34import semmle.code.cpp.ir.implementation.unaliased_ssa.IR
45import semmle.code.cpp.ir.implementation.UseSoundEscapeAnalysis
56
6- predicate shouldEscape ( IRAutomaticUserVariable var ) {
7- exists ( string name |
8- name = var .getVariable ( ) .getName ( ) and
9- name .matches ( "no_%" )
10- )
7+ class InterestingAllocation extends VariableAllocation {
8+ IRUserVariable userVar ;
9+
10+ InterestingAllocation ( ) { userVar = this .getIRVariable ( ) }
11+
12+ final predicate shouldEscape ( ) { userVar .getVariable ( ) .getName ( ) .matches ( "no_%" ) }
1113}
1214
13- from IRAutomaticUserVariable var
15+ from InterestingAllocation var
1416where
1517 exists ( IRFunction irFunc |
1618 irFunc = var .getEnclosingIRFunction ( ) and
1719 (
18- shouldEscape ( var ) and variableAddressEscapes ( var )
20+ var . shouldEscape ( ) and allocationEscapes ( var )
1921 or
20- not shouldEscape ( var ) and not variableAddressEscapes ( var )
22+ not var . shouldEscape ( ) and not allocationEscapes ( var )
2123 )
2224 )
2325select var
You can’t perform that action at this time.
0 commit comments