Skip to content

Commit 393c9e9

Browse files
committed
CPP: QLDoc example for ImplicitThisFieldAccess.
1 parent 1c0fdef commit 393c9e9

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

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

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -274,11 +274,28 @@ private predicate exprHasReferenceConversion(Expr e) { referenceConversion(e.get
274274

275275
/**
276276
* A field access of a field of `this` which has no qualifier because
277-
* the use of `this` is implicit. For example, `field` is equivalent to
278-
* `this->field` if `field` is a member of `this`.
277+
* the use of `this` is implicit. For example, in the following code the
278+
* implicit call to the destructor of `A` has no qualifier because the
279+
* use of `this` is implicit:
280+
* ```
281+
* class A {
282+
* public:
283+
* ~A() {
284+
* // ...
285+
* }
286+
* };
279287
*
288+
* class B {
289+
* public:
290+
* A a;
291+
*
292+
* ~B() {
293+
* // Implicit call to the destructor of `A`.
294+
* }
295+
* };
296+
* ```
280297
* Note: the C++ front-end often automatically desugars `field` to
281-
* `this->field`, so most implicit accesses of `this->field` are instances
298+
* `this->field`, so most accesses of `this->field` are instances
282299
* of `PointerFieldAccess` (with `ThisExpr` as the qualifier), not
283300
* `ImplicitThisFieldAccess`.
284301
*/

0 commit comments

Comments
 (0)