@@ -300,6 +300,14 @@ class FunctionCall extends Call, @funbindexpr {
300300 }
301301}
302302
303+ /** A _user-defined_ unary `operator*` function. */
304+ class OverloadedPointerDereferenceFunction extends Function {
305+ OverloadedPointerDereferenceFunction ( ) {
306+ this .hasName ( "operator*" ) and
307+ this .getEffectiveNumberOfParameters ( ) = 1
308+ }
309+ }
310+
303311/**
304312 * An instance of a _user-defined_ unary `operator*` applied to its argument.
305313 * ```
@@ -309,8 +317,7 @@ class FunctionCall extends Call, @funbindexpr {
309317 */
310318class OverloadedPointerDereferenceExpr extends FunctionCall {
311319 OverloadedPointerDereferenceExpr ( ) {
312- getTarget ( ) .hasName ( "operator*" ) and
313- getTarget ( ) .getEffectiveNumberOfParameters ( ) = 1
320+ this .getTarget ( ) instanceof OverloadedPointerDereferenceFunction
314321 }
315322
316323 override string getAPrimaryQlClass ( ) { result = "OverloadedPointerDereferenceExpr" }
@@ -350,53 +357,6 @@ class OverloadedPointerDereferenceExpr extends FunctionCall {
350357 }
351358}
352359
353- /**
354- * An instance of a call to a _user-defined_ `operator->`.
355- * ```
356- * struct T2 { T1 b; };
357- * struct T3 { T2* operator->(); };
358- * T3 a;
359- * T1 x = a->b;
360- * ```
361- */
362- class OverloadedArrowExpr extends FunctionCall {
363- OverloadedArrowExpr ( ) { getTarget ( ) .hasName ( "operator->" ) }
364-
365- override string getAPrimaryQlClass ( ) { result = "OverloadedArrowExpr" }
366-
367- /** Gets the expression this `operator->` applies to. */
368- Expr getExpr ( ) { result = this .getQualifier ( ) }
369-
370- /** Gets the field accessed by this call to `operator->`, if any. */
371- FieldAccess getFieldAccess ( ) { result .getQualifier ( ) = this }
372-
373- override predicate mayBeImpure ( ) {
374- FunctionCall .super .mayBeImpure ( ) and
375- (
376- this .getExpr ( ) .mayBeImpure ( )
377- or
378- not exists ( Class declaring |
379- this .getTarget ( ) .getDeclaringType ( ) .isConstructedFrom * ( declaring )
380- |
381- declaring .getNamespace ( ) instanceof StdNamespace
382- )
383- )
384- }
385-
386- override predicate mayBeGloballyImpure ( ) {
387- FunctionCall .super .mayBeGloballyImpure ( ) and
388- (
389- this .getExpr ( ) .mayBeGloballyImpure ( )
390- or
391- not exists ( Class declaring |
392- this .getTarget ( ) .getDeclaringType ( ) .isConstructedFrom * ( declaring )
393- |
394- declaring .getNamespace ( ) instanceof StdNamespace
395- )
396- )
397- }
398- }
399-
400360/**
401361 * An instance of a _user-defined_ binary `operator[]` applied to its arguments.
402362 * ```
0 commit comments