7878 */
7979
8080private import go
81- import internal.ExternalFlowExtensions
81+ import internal.ExternalFlowExtensions as FlowExtensions
8282private import FlowSummary as FlowSummary
8383private import internal.DataFlowPrivate
8484private import internal.FlowSummaryImpl
@@ -87,6 +87,82 @@ private import internal.FlowSummaryImpl::Private
8787private import internal.FlowSummaryImpl:: Private:: External
8888private import codeql.mad.ModelValidation as SharedModelVal
8989
90+ /** Gets the prefix for a group of packages. */
91+ string groupPrefix ( ) { result = "group:" }
92+
93+ /** Gets a group that `package` is in, according to `packageGrouping`. */
94+ private string getGroup ( string package ) {
95+ exists ( string group |
96+ FlowExtensions:: packageGrouping ( group , package ) and
97+ result = groupPrefix ( ) + group
98+ )
99+ }
100+
101+ /**
102+ * Holds if a source model exists for the given parameters.
103+ *
104+ * Note that we consider all packages in the same group.
105+ */
106+ predicate sourceModel (
107+ string package , string type , boolean subtypes , string name , string signature , string ext ,
108+ string output , string kind , string provenance , QlBuiltins:: ExtensionId madId
109+ ) {
110+ FlowExtensions:: sourceModel ( package , type , subtypes , name , signature , ext , output , kind ,
111+ provenance , madId )
112+ or
113+ // Also look for models that are defined for a group that `package` is part of.
114+ FlowExtensions:: sourceModel ( getGroup ( package ) , type , subtypes , name , signature , ext , output , kind ,
115+ provenance , madId )
116+ }
117+
118+ /**
119+ * Holds if a sink model exists for the given parameters.
120+ *
121+ * Note that we consider all packages in the same group.
122+ */
123+ predicate sinkModel (
124+ string package , string type , boolean subtypes , string name , string signature , string ext ,
125+ string input , string kind , string provenance , QlBuiltins:: ExtensionId madId
126+ ) {
127+ FlowExtensions:: sinkModel ( package , type , subtypes , name , signature , ext , input , kind , provenance ,
128+ madId )
129+ or
130+ // Also look for models that are defined for a group that `package` is part of.
131+ FlowExtensions:: sinkModel ( getGroup ( package ) , type , subtypes , name , signature , ext , input , kind ,
132+ provenance , madId )
133+ }
134+
135+ /**
136+ * Holds if a summary model exists for the given parameters.
137+ *
138+ * Note that we consider all packages in the same group.
139+ */
140+ predicate summaryModel (
141+ string package , string type , boolean subtypes , string name , string signature , string ext ,
142+ string input , string output , string kind , string provenance , QlBuiltins:: ExtensionId madId
143+ ) {
144+ FlowExtensions:: summaryModel ( package , type , subtypes , name , signature , ext , input , output , kind ,
145+ provenance , madId )
146+ or
147+ // Also look for models that are defined for a group that `package` is part of.
148+ FlowExtensions:: summaryModel ( getGroup ( package ) , type , subtypes , name , signature , ext , input ,
149+ output , kind , provenance , madId )
150+ }
151+
152+ /**
153+ * Holds if a neutral model exists for the given parameters.
154+ *
155+ * Note that we consider all packages in the same group.
156+ */
157+ predicate neutralModel (
158+ string package , string type , string name , string signature , string kind , string provenance
159+ ) {
160+ FlowExtensions:: neutralModel ( package , type , name , signature , kind , provenance )
161+ or
162+ // Also look for models that are defined for a group that `package` is part of.
163+ FlowExtensions:: neutralModel ( getGroup ( package ) , type , name , signature , kind , provenance )
164+ }
165+
90166/**
91167 * Holds if the given extension tuple `madId` should pretty-print as `model`.
92168 *
0 commit comments