From 047fa068ff84db39a1a8c70de025c367c914fc3e Mon Sep 17 00:00:00 2001 From: Jeroen Ketema Date: Fri, 9 Jan 2026 14:07:57 +0100 Subject: [PATCH] C++: Add `isThisAccess` predicate to `ParamAccessForType` --- cpp/ql/lib/semmle/code/cpp/exprs/Access.qll | 5 +++++ cpp/ql/lib/semmlecode.cpp.dbscheme | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/cpp/ql/lib/semmle/code/cpp/exprs/Access.qll b/cpp/ql/lib/semmle/code/cpp/exprs/Access.qll index 333493e6f5d..d181299f2ff 100644 --- a/cpp/ql/lib/semmle/code/cpp/exprs/Access.qll +++ b/cpp/ql/lib/semmle/code/cpp/exprs/Access.qll @@ -394,6 +394,11 @@ class FunctionAccess extends Access, @routineexpr { */ class ParamAccessForType extends Expr, @param_ref { override string toString() { result = "param access" } + + /** + * Holds if the accessed parameter is implicit object parameter of the function. + */ + predicate isThisAccess() { param_ref_to_this(underlyingElement(this)) } } /** diff --git a/cpp/ql/lib/semmlecode.cpp.dbscheme b/cpp/ql/lib/semmlecode.cpp.dbscheme index 2f1916a4c9b..1402ab319d2 100644 --- a/cpp/ql/lib/semmlecode.cpp.dbscheme +++ b/cpp/ql/lib/semmlecode.cpp.dbscheme @@ -2040,6 +2040,10 @@ new_array_allocated_type( int type_id: @type ref ); +param_ref_to_this( + int expr: @param_ref ref +) + /** * The field being initialized by an initializer expression within an aggregate * initializer for a class/struct/union. Position is used to sort repeated initializers.