@@ -174,6 +174,15 @@ predicate sinkModel(
174174 )
175175}
176176
177+ /** Holds if a barrier model exists for the given parameters. */
178+ predicate barrierModel (
179+ string package , string type , boolean subtypes , string name , string signature , string ext ,
180+ string output , string kind , string provenance , QlBuiltins:: ExtensionId madId
181+ ) {
182+ Extensions:: barrierModel ( package , type , subtypes , name , signature , ext , output , kind , provenance ,
183+ madId )
184+ }
185+
177186/** Holds if a summary model exists for the given parameters. */
178187predicate summaryModel (
179188 string package , string type , boolean subtypes , string name , string signature , string ext ,
@@ -234,6 +243,7 @@ predicate interpretModelForTest(QlBuiltins::ExtensionId madId, string model) {
234243 "Summary: " + package + "; " + type + "; " + subtypes + "; " + name + "; " + signature + "; " +
235244 ext + "; " + input + "; " + output + "; " + kind + "; " + provenance
236245 )
246+ //TODO: possibly barrier models?
237247}
238248
239249/** Holds if a neutral model exists for the given parameters. */
@@ -292,6 +302,7 @@ predicate modelCoverage(string package, int pkgs, string kind, string part, int
292302 summaryModel ( subpkg , type , subtypes , name , signature , ext , input , output , kind , provenance ,
293303 _)
294304 )
305+ // TODO: possibly barrier models?
295306 )
296307}
297308
@@ -303,7 +314,8 @@ module ModelValidation {
303314 summaryModel ( _, _, _, _, _, _, path , _, _, _, _) or
304315 summaryModel ( _, _, _, _, _, _, _, path , _, _, _) or
305316 sinkModel ( _, _, _, _, _, _, path , _, _, _) or
306- sourceModel ( _, _, _, _, _, _, path , _, _, _)
317+ sourceModel ( _, _, _, _, _, _, path , _, _, _) or
318+ barrierModel ( _, _, _, _, _, _, path , _, _, _)
307319 }
308320
309321 private module MkAccessPath = AccessPathSyntax:: AccessPath< getRelevantAccessPath / 1 > ;
@@ -338,6 +350,8 @@ module ModelValidation {
338350 exists ( string pred , AccessPath output , AccessPathToken part |
339351 sourceModel ( _, _, _, _, _, _, output , _, _, _) and pred = "source"
340352 or
353+ barrierModel ( _, _, _, _, _, _, output , _, _, _) and pred = "barrier"
354+ or
341355 summaryModel ( _, _, _, _, _, _, _, output , _, _, _) and pred = "summary"
342356 |
343357 (
@@ -355,7 +369,11 @@ module ModelValidation {
355369 private module KindValConfig implements SharedModelVal:: KindValidationConfigSig {
356370 predicate summaryKind ( string kind ) { summaryModel ( _, _, _, _, _, _, _, _, kind , _, _) }
357371
358- predicate sinkKind ( string kind ) { sinkModel ( _, _, _, _, _, _, _, kind , _, _) }
372+ predicate sinkKind ( string kind ) {
373+ sinkModel ( _, _, _, _, _, _, _, kind , _, _)
374+ or
375+ barrierModel ( _, _, _, _, _, _, _, kind , _, _)
376+ }
359377
360378 predicate sourceKind ( string kind ) { sourceModel ( _, _, _, _, _, _, _, kind , _, _) }
361379
@@ -373,6 +391,8 @@ module ModelValidation {
373391 or
374392 sinkModel ( package , type , _, name , signature , ext , _, _, provenance , _) and pred = "sink"
375393 or
394+ barrierModel ( package , type , _, name , signature , ext , _, _, provenance , _) and pred = "barrier"
395+ or
376396 summaryModel ( package , type , _, name , signature , ext , _, _, _, provenance , _) and
377397 pred = "summary"
378398 or
@@ -418,6 +438,8 @@ private predicate elementSpec(
418438 or
419439 sinkModel ( package , type , subtypes , name , signature , ext , _, _, _, _)
420440 or
441+ barrierModel ( package , type , subtypes , name , signature , ext , _, _, _, _)
442+ or
421443 summaryModel ( package , type , subtypes , name , signature , ext , _, _, _, _, _)
422444 or
423445 neutralModel ( package , type , name , signature , _, _) and ext = "" and subtypes = true
@@ -578,6 +600,17 @@ private module Cached {
578600 isSinkNode ( n , kind , model ) and n .asNode ( ) = node
579601 )
580602 }
603+
604+ /**
605+ * Holds if `node` is specified as a barrier with the given kind in a MaD flow
606+ * model.
607+ */
608+ cached
609+ predicate barrierNode ( Node node , string kind , string model ) {
610+ exists ( SourceSinkInterpretationInput:: InterpretNode n |
611+ isBarrierNode ( n , kind , model ) and n .asNode ( ) = node
612+ )
613+ }
581614}
582615
583616import Cached
@@ -594,6 +627,12 @@ predicate sourceNode(Node node, string kind) { sourceNode(node, kind, _) }
594627 */
595628predicate sinkNode ( Node node , string kind ) { sinkNode ( node , kind , _) }
596629
630+ /**
631+ * Holds if `node` is specified as a barrier with the given kind in a MaD flow
632+ * model.
633+ */
634+ predicate barrierNode ( Node node , string kind ) { barrierNode ( node , kind , _) }
635+
597636// adapter class for converting Mad summaries to `SummarizedCallable`s
598637private class SummarizedCallableAdapter extends SummarizedCallable {
599638 SummarizedCallableAdapter ( ) { summaryElement ( this , _, _, _, _, _, _) }
0 commit comments