@@ -368,6 +368,19 @@ module Make<
368368 abstract predicate isSink ( string input , string kind , Provenance provenance , string model ) ;
369369 }
370370
371+ /** A barrier element. */
372+ abstract class BarrierElement extends SourceBaseFinal {
373+ bindingset [ this ]
374+ BarrierElement ( ) { any ( ) }
375+
376+ /**
377+ * Holds if this element is a flow barrier of kind `kind`, where data
378+ * flows out as described by `output`.
379+ */
380+ pragma [ nomagic]
381+ abstract predicate isBarrier ( string output , string kind , Provenance provenance , string model ) ;
382+ }
383+
371384 private signature predicate hasKindSig ( string kind ) ;
372385
373386 signature class NeutralCallableSig extends SummarizedCallableBaseFinal {
@@ -723,7 +736,19 @@ module Make<
723736 )
724737 }
725738
726- private predicate summarySpec ( string spec ) {
739+ private predicate isRelevantBarrier (
740+ BarrierElement e , string output , string kind , Provenance provenance , string model
741+ ) {
742+ e .isBarrier ( output , kind , provenance , model ) and
743+ (
744+ provenance .isManual ( )
745+ or
746+ provenance .isGenerated ( ) and
747+ not exists ( Provenance p | p .isManual ( ) and e .isBarrier ( _, kind , p , _) )
748+ )
749+ }
750+
751+ private predicate flowSpec ( string spec ) {
727752 exists ( SummarizedCallable c |
728753 c .propagatesFlow ( spec , _, _, _, _, _)
729754 or
@@ -732,10 +757,12 @@ module Make<
732757 or
733758 isRelevantSource ( _, spec , _, _, _)
734759 or
760+ isRelevantBarrier ( _, spec , _, _, _)
761+ or
735762 isRelevantSink ( _, spec , _, _, _)
736763 }
737764
738- import AccessPathSyntax:: AccessPath< summarySpec / 1 >
765+ import AccessPathSyntax:: AccessPath< flowSpec / 1 >
739766
740767 /** Holds if specification component `token` parses as parameter `pos`. */
741768 predicate parseParam ( AccessPathToken token , ArgumentPosition pos ) {
@@ -1515,6 +1542,18 @@ module Make<
15151542 )
15161543 }
15171544
1545+ /**
1546+ * Holds if `barrier` is a relevant barrier element with output specification `outSpec`.
1547+ */
1548+ predicate barrierSpec (
1549+ BarrierElement barrier , SummaryComponentStack outSpec , string kind , string model
1550+ ) {
1551+ exists ( string output |
1552+ isRelevantBarrier ( barrier , output , kind , _, model ) and
1553+ External:: interpretSpec ( output , outSpec )
1554+ )
1555+ }
1556+
15181557 signature module TypesInputSig {
15191558 /** Gets the type of content `c`. */
15201559 DataFlowType getContentType ( ContentSet c ) ;
0 commit comments