File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed
cpp/ql/lib/semmle/code/cpp/exprs Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -1023,9 +1023,23 @@ class DeleteOrDeleteArrayExpr extends Expr, TDeleteOrDeleteArrayExpr {
1023
1023
}
1024
1024
1025
1025
/**
1026
- * Gets the object or array being deleted, and gets a re-use expression when
1027
- * there is a destructor call and the object is also the qualifier of the
1028
- * call.
1026
+ * Gets the object or array being deleted, and gets a `ReuseExpr` when there
1027
+ * is a destructor call and the object is also the qualifier of the call.
1028
+ *
1029
+ * For example, given:
1030
+ * ```
1031
+ * struct HasDestructor { ~HasDestructor(); };
1032
+ * struct PlainOldData { int x, char y; };
1033
+ *
1034
+ * void f(HasDestructor* hasDestructor, PlainOldData* pod) {
1035
+ * delete hasDestructor;
1036
+ * delete pod;
1037
+ * }
1038
+ * ```
1039
+ * This predicate yields a `ReuseExpr` for `delete hasDestructor`, as the
1040
+ * the deleted expression has a destructor, and that expression is also
1041
+ * the qualifier of the destructor call. In the case of `delete pod` the
1042
+ * predicate does not yield a `ReuseExpr`, as there is no destructor call.
1029
1043
*/
1030
1044
Expr getExprWithReuse ( ) { result = this .getChild ( 3 ) }
1031
1045
}
You can’t perform that action at this time.
0 commit comments