Skip to content

Commit 5f8dee4

Browse files
committed
C++: Add isThisAccess predicate to ParamAccessForType
1 parent 5daa73c commit 5f8dee4

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

cpp/ql/lib/semmle/code/cpp/exprs/Access.qll

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,11 @@ class FunctionAccess extends Access, @routineexpr {
394394
*/
395395
class ParamAccessForType extends Expr, @param_ref {
396396
override string toString() { result = "param access" }
397+
398+
/**
399+
* Holds if the accessed parameter is implicit object parameter of the function.
400+
*/
401+
predicate isThisAccess() { param_ref_to_this(underlyingElement(this)) }
397402
}
398403

399404
/**

cpp/ql/lib/semmlecode.cpp.dbscheme

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2040,6 +2040,10 @@ new_array_allocated_type(
20402040
int type_id: @type ref
20412041
);
20422042

2043+
param_ref_to_this(
2044+
int expr: @param_ref ref
2045+
)
2046+
20432047
/**
20442048
* The field being initialized by an initializer expression within an aggregate
20452049
* initializer for a class/struct/union. Position is used to sort repeated initializers.

0 commit comments

Comments
 (0)