Skip to content

Commit ab876b8

Browse files
Merge pull request github#3814 from nickrolfe/71-this
C++: add MemberFunction::getTypeOfThis()
2 parents 42bca1a + 4b6908c commit ab876b8

File tree

14 files changed

+5265
-755
lines changed

14 files changed

+5265
-755
lines changed

cpp/ql/src/semmle/code/cpp/MemberFunction.qll

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,14 @@ class MemberFunction extends Function {
7070
result = getADeclarationEntry() and result != getDefinition()
7171
)
7272
}
73+
74+
/**
75+
* Gets the type of the `this` parameter associated with this member function, if any. Typically,
76+
* this will be a `PointerType`, possibly with `const` and/or `volatile` qualifiers.
77+
*/
78+
Type getTypeOfThis() {
79+
member_function_this_type(underlyingElement(this), unresolveElement(result))
80+
}
7381
}
7482

7583
/**

cpp/ql/src/semmlecode.cpp.dbscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ function_deleted(unique int id: @function ref);
420420

421421
function_defaulted(unique int id: @function ref);
422422

423-
423+
member_function_this_type(unique int id: @function ref, int this_type: @type ref);
424424

425425
#keyset[id, type_id]
426426
fun_decls(

0 commit comments

Comments
 (0)