@@ -229,41 +229,55 @@ private predicate typeModel(string row) { any(TypeModelCsv s).row(inversePad(row
229
229
private predicate typeVariableModel ( string row ) { any ( TypeVariableModelCsv s ) .row ( inversePad ( row ) ) }
230
230
231
231
/** Holds if a source model exists for the given parameters. */
232
- predicate sourceModel ( string type , string path , string kind ) {
232
+ predicate sourceModel ( string type , string path , string kind , string model ) {
233
233
exists ( string row |
234
234
sourceModel ( row ) and
235
235
row .splitAt ( ";" , 0 ) = type and
236
236
row .splitAt ( ";" , 1 ) = path and
237
- row .splitAt ( ";" , 2 ) = kind
237
+ row .splitAt ( ";" , 2 ) = kind and
238
+ model = "SourceModelCsv"
238
239
)
239
240
or
240
- Extensions:: sourceModel ( type , path , kind )
241
+ exists ( QlBuiltins:: ExtensionId madId |
242
+ Extensions:: sourceModel ( type , path , kind , madId ) and
243
+ model = "MaD:" + madId .toString ( )
244
+ )
241
245
}
242
246
243
247
/** Holds if a sink model exists for the given parameters. */
244
- private predicate sinkModel ( string type , string path , string kind ) {
248
+ private predicate sinkModel ( string type , string path , string kind , string model ) {
245
249
exists ( string row |
246
250
sinkModel ( row ) and
247
251
row .splitAt ( ";" , 0 ) = type and
248
252
row .splitAt ( ";" , 1 ) = path and
249
- row .splitAt ( ";" , 2 ) = kind
253
+ row .splitAt ( ";" , 2 ) = kind and
254
+ model = "SinkModelCsv"
250
255
)
251
256
or
252
- Extensions:: sinkModel ( type , path , kind )
257
+ exists ( QlBuiltins:: ExtensionId madId |
258
+ Extensions:: sinkModel ( type , path , kind , madId ) and
259
+ model = "MaD:" + madId .toString ( )
260
+ )
253
261
}
254
262
255
263
/** Holds if a summary model `row` exists for the given parameters. */
256
- private predicate summaryModel ( string type , string path , string input , string output , string kind ) {
264
+ private predicate summaryModel (
265
+ string type , string path , string input , string output , string kind , string model
266
+ ) {
257
267
exists ( string row |
258
268
summaryModel ( row ) and
259
269
row .splitAt ( ";" , 0 ) = type and
260
270
row .splitAt ( ";" , 1 ) = path and
261
271
row .splitAt ( ";" , 2 ) = input and
262
272
row .splitAt ( ";" , 3 ) = output and
263
- row .splitAt ( ";" , 4 ) = kind
273
+ row .splitAt ( ";" , 4 ) = kind and
274
+ model = "SummaryModelCsv"
264
275
)
265
276
or
266
- Extensions:: summaryModel ( type , path , input , output , kind )
277
+ exists ( QlBuiltins:: ExtensionId madId |
278
+ Extensions:: summaryModel ( type , path , input , output , kind , madId ) and
279
+ model = "MaD:" + madId .toString ( )
280
+ )
267
281
}
268
282
269
283
/** Holds if a type model exists for the given parameters. */
@@ -294,9 +308,9 @@ private predicate typeVariableModel(string name, string path) {
294
308
*/
295
309
predicate isRelevantType ( string type ) {
296
310
(
297
- sourceModel ( type , _, _) or
298
- sinkModel ( type , _, _) or
299
- summaryModel ( type , _, _, _, _) or
311
+ sourceModel ( type , _, _, _ ) or
312
+ sinkModel ( type , _, _, _ ) or
313
+ summaryModel ( type , _, _, _, _, _ ) or
300
314
typeModel ( _, type , _)
301
315
) and
302
316
(
@@ -319,9 +333,9 @@ pragma[nomagic]
319
333
predicate isRelevantFullPath ( string type , string path ) {
320
334
isRelevantType ( type ) and
321
335
(
322
- sourceModel ( type , path , _) or
323
- sinkModel ( type , path , _) or
324
- summaryModel ( type , path , _, _, _) or
336
+ sourceModel ( type , path , _, _ ) or
337
+ sinkModel ( type , path , _, _ ) or
338
+ summaryModel ( type , path , _, _, _, _ ) or
325
339
typeModel ( _, type , path )
326
340
)
327
341
}
@@ -331,8 +345,8 @@ private predicate accessPathRange(string s) {
331
345
isRelevantFullPath ( _, s )
332
346
or
333
347
exists ( string type | isRelevantType ( type ) |
334
- summaryModel ( type , _, s , _, _) or
335
- summaryModel ( type , _, _, s , _)
348
+ summaryModel ( type , _, s , _, _, _ ) or
349
+ summaryModel ( type , _, _, s , _, _ )
336
350
)
337
351
or
338
352
typeVariableModel ( _, s )
@@ -543,7 +557,7 @@ private API::Node getNodeFromPath(string type, AccessPath path) {
543
557
544
558
pragma [ nomagic]
545
559
private predicate typeStepModel ( string type , AccessPath basePath , AccessPath output ) {
546
- summaryModel ( type , basePath , "" , output , "type" )
560
+ summaryModel ( type , basePath , "" , output , "type" , _ )
547
561
}
548
562
549
563
pragma [ nomagic]
@@ -621,9 +635,9 @@ module ModelOutput {
621
635
* Holds if a CSV source model contributed `source` with the given `kind`.
622
636
*/
623
637
cached
624
- API:: Node getASourceNode ( string kind ) {
638
+ API:: Node getASourceNode ( string kind , string model ) {
625
639
exists ( string type , string path |
626
- sourceModel ( type , path , kind ) and
640
+ sourceModel ( type , path , kind , model ) and
627
641
result = getNodeFromPath ( type , path )
628
642
)
629
643
}
@@ -632,9 +646,9 @@ module ModelOutput {
632
646
* Holds if a CSV sink model contributed `sink` with the given `kind`.
633
647
*/
634
648
cached
635
- API:: Node getASinkNode ( string kind ) {
649
+ API:: Node getASinkNode ( string kind , string model ) {
636
650
exists ( string type , string path |
637
- sinkModel ( type , path , kind ) and
651
+ sinkModel ( type , path , kind , model ) and
638
652
result = getNodeFromPath ( type , path )
639
653
)
640
654
}
@@ -644,18 +658,18 @@ module ModelOutput {
644
658
*/
645
659
cached
646
660
predicate relevantSummaryModel (
647
- string type , string path , string input , string output , string kind
661
+ string type , string path , string input , string output , string kind , string model
648
662
) {
649
663
isRelevantType ( type ) and
650
- summaryModel ( type , path , input , output , kind )
664
+ summaryModel ( type , path , input , output , kind , model )
651
665
}
652
666
653
667
/**
654
668
* Holds if a `baseNode` is an invocation identified by the `type,path` part of a summary row.
655
669
*/
656
670
cached
657
671
predicate resolvedSummaryBase ( string type , string path , Specific:: InvokeNode baseNode ) {
658
- summaryModel ( type , path , _, _, _) and
672
+ summaryModel ( type , path , _, _, _, _ ) and
659
673
baseNode = getInvocationFromPath ( type , path )
660
674
}
661
675
@@ -664,7 +678,7 @@ module ModelOutput {
664
678
*/
665
679
cached
666
680
predicate resolvedSummaryRefBase ( string type , string path , API:: Node baseNode ) {
667
- summaryModel ( type , path , _, _, _) and
681
+ summaryModel ( type , path , _, _, _, _ ) and
668
682
baseNode = getNodeFromPath ( type , path )
669
683
}
670
684
@@ -680,12 +694,22 @@ module ModelOutput {
680
694
import Specific:: ModelOutputSpecific
681
695
private import codeql.mad.ModelValidation as SharedModelVal
682
696
697
+ /**
698
+ * Holds if a CSV source model contributed `source` with the given `kind`.
699
+ */
700
+ API:: Node getASourceNode ( string kind ) { result = getASourceNode ( kind , _) }
701
+
702
+ /**
703
+ * Holds if a CSV sink model contributed `sink` with the given `kind`.
704
+ */
705
+ API:: Node getASinkNode ( string kind ) { result = getASinkNode ( kind , _) }
706
+
683
707
private module KindValConfig implements SharedModelVal:: KindValidationConfigSig {
684
- predicate summaryKind ( string kind ) { summaryModel ( _, _, _, _, kind ) }
708
+ predicate summaryKind ( string kind ) { summaryModel ( _, _, _, _, kind , _ ) }
685
709
686
- predicate sinkKind ( string kind ) { sinkModel ( _, _, kind ) }
710
+ predicate sinkKind ( string kind ) { sinkModel ( _, _, kind , _ ) }
687
711
688
- predicate sourceKind ( string kind ) { sourceModel ( _, _, kind ) }
712
+ predicate sourceKind ( string kind ) { sourceModel ( _, _, kind , _ ) }
689
713
}
690
714
691
715
private module KindVal = SharedModelVal:: KindValidation< KindValConfig > ;
0 commit comments