@@ -17,53 +17,98 @@ TemplateClass getADependentBaseType(TemplateClass t) {
17
17
)
18
18
}
19
19
20
+ /**
21
+ * Helper predicate that ensures we do not join on function pairs by name early on, as that creates
22
+ * a large dataset on big databases with lots of name duplication.
23
+ */
24
+ pragma [ noinline, nomagic]
25
+ private FunctionCall helper_functioncall (
26
+ TemplateClass t , TemplateClass dependentBaseType , Function target , string name
27
+ ) {
28
+ dependentBaseType = getADependentBaseType ( t ) and
29
+ // The target of the call is not declared in the dependent base type
30
+ not target .getDeclaringType ( ) = dependentBaseType and
31
+ result = target .getACallToThisFunction ( ) and
32
+ result .getEnclosingFunction ( ) = t .getAMemberFunction ( ) and
33
+ name = target .getName ( )
34
+ }
35
+
20
36
/**
21
37
* Gets a function call in `TemplateClass` `t` where the target function name exists in a dependent
22
38
* base type and the call is to a function that is not declared in the dependent base type.
23
39
*/
24
40
FunctionCall parentMemberFunctionCall ( TemplateClass t ) {
25
- exists ( TemplateClass dependentBaseType , MemberFunction dependentTypeFunction , Function target |
26
- dependentBaseType = getADependentBaseType ( t ) and
27
- // The target of the call is not declared in the dependent base type
28
- not target .getDeclaringType ( ) = dependentBaseType and
41
+ exists (
42
+ string name , TemplateClass dependentBaseType , MemberFunction dependentTypeFunction ,
43
+ Function target
44
+ |
45
+ result = helper_functioncall ( t , dependentBaseType , target , name ) and
46
+ // The dependentTypeFunction is declared on the dependent base type
29
47
dependentBaseType .getAMember ( ) = dependentTypeFunction and
30
- target .getName ( ) = dependentTypeFunction .getName ( ) and
31
- result = target .getACallToThisFunction ( ) and
32
- result .getEnclosingFunction ( ) = t .getAMemberFunction ( )
48
+ // And has the same name as the target of the function call in the child
49
+ name = dependentTypeFunction .getName ( )
33
50
)
34
51
}
35
52
53
+ /**
54
+ * Helper predicate that ensures we do not join on function pairs by name early on, as that creates
55
+ * a large dataset on big databases with lots of name duplication.
56
+ */
57
+ pragma [ noinline, nomagic]
58
+ private FunctionAccess helper_functionaccess (
59
+ TemplateClass t , TemplateClass dependentBaseType , Function target , string name
60
+ ) {
61
+ dependentBaseType = getADependentBaseType ( t ) and
62
+ // The target of the access is not declared in the dependent base type
63
+ not target .getDeclaringType ( ) = dependentBaseType and
64
+ result = target .getAnAccess ( ) and
65
+ result .getEnclosingFunction ( ) = t .getAMemberFunction ( ) and
66
+ name = target .getName ( )
67
+ }
68
+
36
69
/**
37
70
* Gets a function access in `TemplateClass` `t` where the target function name exists in a dependent
38
71
* base type and the access is to a function declared outside the dependent base type.
39
72
*/
40
73
FunctionAccess parentMemberFunctionAccess ( TemplateClass t ) {
41
- exists ( TemplateClass dependentBaseType , MemberFunction dependentTypeFunction , Function target |
42
- dependentBaseType = getADependentBaseType ( t ) and
43
- // The target of the access is not declared in the dependent base type
44
- not target .getDeclaringType ( ) = dependentBaseType and
74
+ exists (
75
+ string name , TemplateClass dependentBaseType , MemberFunction dependentTypeFunction ,
76
+ Function target
77
+ |
78
+ result = helper_functionaccess ( t , dependentBaseType , target , name ) and
45
79
dependentBaseType .getAMember ( ) = dependentTypeFunction and
46
- target .getName ( ) = dependentTypeFunction .getName ( ) and
47
- result = target .getAnAccess ( ) and
48
- result .getEnclosingFunction ( ) = t .getAMemberFunction ( )
80
+ name = dependentTypeFunction .getName ( )
49
81
)
50
82
}
51
83
84
+ /**
85
+ * Helper predicate that ensures we do not join on variable pairs by name early on, as that creates
86
+ * a large dataset on big databases with lots of name duplication.
87
+ */
88
+ pragma [ noinline, nomagic]
89
+ private VariableAccess helper_memberaccess (
90
+ TemplateClass t , TemplateClass dependentBaseType , Variable target , string name
91
+ ) {
92
+ dependentBaseType = getADependentBaseType ( t ) and
93
+ // The target of the access is not declared in the dependent base type
94
+ not target .getDeclaringType ( ) = dependentBaseType and
95
+ result = target .getAnAccess ( ) and
96
+ result .getEnclosingFunction ( ) = t .getAMemberFunction ( ) and
97
+ name = target .getName ( )
98
+ }
99
+
52
100
/**
53
101
* Gets a memmber access in `TemplateClass` `t` where the target member name exists in a dependent
54
102
* base type and the access is to a variable declared outside the dependent base type.
55
103
*/
56
- Access parentMemberAccess ( TemplateClass t ) {
104
+ VariableAccess parentMemberAccess ( TemplateClass t ) {
57
105
exists (
58
- TemplateClass dependentBaseType , MemberVariable dependentTypeMemberVariable , Variable target
106
+ string name , TemplateClass dependentBaseType , MemberVariable dependentTypeMemberVariable ,
107
+ Variable target
59
108
|
60
- dependentBaseType = getADependentBaseType ( t ) and
61
- // The target of the access is not declared in the dependent base type
62
- not target .getDeclaringType ( ) = dependentBaseType and
109
+ result = helper_memberaccess ( t , dependentBaseType , target , name ) and
63
110
dependentBaseType .getAMemberVariable ( ) = dependentTypeMemberVariable and
64
- target .getName ( ) = dependentTypeMemberVariable .getName ( ) and
65
- result = target .getAnAccess ( ) and
66
- result .getEnclosingFunction ( ) = t .getAMemberFunction ( )
111
+ name = dependentTypeMemberVariable .getName ( )
67
112
)
68
113
}
69
114
0 commit comments