@@ -168,9 +168,20 @@ module ModelInput {
168
168
* A unit class for adding additional type model rows from CodeQL models.
169
169
*/
170
170
class TypeModel extends Unit {
171
+ /**
172
+ * Holds if any of the other predicates in this class might have a result
173
+ * for the given `type`.
174
+ *
175
+ * The implementation of this predicate should not depend on `DataFlow::Node`.
176
+ */
177
+ bindingset [ type]
178
+ predicate isTypeUsed ( string type ) { none ( ) }
179
+
171
180
/**
172
181
* Gets a data-flow node that is a source of the given `type`.
173
182
*
183
+ * Note that `type` should also be included in `isTypeUsed`.
184
+ *
174
185
* This must not depend on API graphs, but ensures that an API node is generated for
175
186
* the source.
176
187
*/
@@ -180,6 +191,8 @@ module ModelInput {
180
191
* Gets a data-flow node that is a sink of the given `type`,
181
192
* usually because it is an argument passed to a parameter of that type.
182
193
*
194
+ * Note that `type` should also be included in `isTypeUsed`.
195
+ *
183
196
* This must not depend on API graphs, but ensures that an API node is generated for
184
197
* the sink.
185
198
*/
@@ -188,6 +201,8 @@ module ModelInput {
188
201
/**
189
202
* Gets an API node that is a source or sink of the given `type`.
190
203
*
204
+ * Note that `type` should also be included in `isTypeUsed`.
205
+ *
191
206
* Unlike `getASource` and `getASink`, this may depend on API graphs.
192
207
*/
193
208
API:: Node getAnApiNode ( string type ) { none ( ) }
@@ -367,6 +382,8 @@ predicate isRelevantType(string type) {
367
382
(
368
383
Specific:: isTypeUsed ( type )
369
384
or
385
+ any ( TypeModel model ) .isTypeUsed ( type )
386
+ or
370
387
exists ( TestAllModels t )
371
388
)
372
389
or
0 commit comments