File tree Expand file tree Collapse file tree
cpp/ql/src/semmle/code/cpp/models/implementations Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import semmle.code.cpp.models.interfaces.DataFlow
22import semmle.code.cpp.models.interfaces.Taint
3+ import semmle.code.cpp.models.interfaces.Alias
34
45/**
56 * The standard function `swap`. A use of `swap` looks like this:
@@ -25,7 +26,7 @@ private class Swap extends DataFlowFunction {
2526 * obj1.swap(obj2)
2627 * ```
2728 */
28- private class MemberSwap extends TaintFunction , MemberFunction {
29+ private class MemberSwap extends TaintFunction , MemberFunction , AliasFunction {
2930 MemberSwap ( ) {
3031 this .hasName ( "swap" ) and
3132 this .getNumberOfParameters ( ) = 1 and
@@ -40,4 +41,10 @@ private class MemberSwap extends TaintFunction, MemberFunction {
4041 input .isParameterDeref ( 0 ) and
4142 output .isQualifierObject ( )
4243 }
44+
45+ override predicate parameterNeverEscapes ( int index ) { none ( ) }
46+
47+ override predicate parameterEscapesOnlyViaReturn ( int index ) { index = 0 }
48+
49+ override predicate parameterIsAlwaysReturned ( int index ) { index = 0 }
4350}
You can’t perform that action at this time.
0 commit comments