@@ -144,49 +144,32 @@ module MakeImplStage1<LocationSig Location, InputSig<Location> Lang> {
144144 exists ( node )
145145 }
146146
147- /**
148- * Holds if `node` comes from a file that was in the diff for which we
149- * are producing results.
150- */
151- overlay [ global]
152- private predicate isDiffFileNode ( Node node ) {
153- exists ( string filePath |
154- node .getLocation ( ) .hasLocationInfo ( filePath , _, _, _, _) and
155- AlertFiltering:: fileIsInDiff ( filePath )
156- )
157- }
158-
159147 overlay [ global]
160148 pragma [ nomagic]
161149 private predicate isFilteredSource ( Node source ) {
162150 Config:: isSource ( source , _) and
163151 // Data flow is always incremental in one of two ways.
164- // 1. If the configuration is diff-informed and diff information is
165- // available, we filter to only include nodes in the diff, which
166- // gives the smallest set of nodes .
152+ // 1. If the configuration is diff-informed, we filter to only include nodes in the diff,
153+ // which gives the smallest set of nodes.
154+ // If diff information is not available, we do not filter at all .
167155 // 2. If not, in global evaluation with overlay, we filter to only
168- // include nodes from files in the overlay or the diff; flow from
169- // other nodes will be added back later. There can be two reasons
170- // why we are in this case:
171- // 1. This could be the primary configuration for a query that
172- // hasn't yet become diff-informed. In that case, the
173- // `getASelectedSourceLocation` information is probably just the
174- // default, and it's a fairly safe overapproximation to
175- // effectively expand to all nodes in the file (via
176- // `isDiffFileNode`).
177- // 2. This could be a secondary configuration, like a helper
178- // configuration for finding sources or sinks of a primary
179- // configuration. In that case, the results of this configuration
180- // are typically in the same file as the final alert.
181- if
182- Config:: observeDiffInformedIncrementalMode ( )
183- then AlertFiltering:: diffInformationAvailable ( ) implies AlertFiltering:: locationIsInDiff ( Config:: getASelectedSourceLocation ( source ) )
156+ // include nodes from files in the overlay; flow from
157+ // other nodes will be added back later.
158+ // We start by seing if we should be in case 1.
159+ if Config:: observeDiffInformedIncrementalMode ( )
160+ then
161+ // Case 1: We are meant to be diff-informed.
162+ // We still only filter if we have diff information.
163+ AlertFiltering:: diffInformationAvailable ( )
164+ implies
165+ AlertFiltering:: locationIsInDiff ( Config:: getASelectedSourceLocation ( source ) )
184166 else (
167+ // Case 2: We are not meant to be diff-informed, so we fall back to overlay-based filtering.
185168 // If we are in base-only global evaluation, do not filter out any sources.
186169 not isEvaluatingInOverlay ( )
187170 or
188171 // If we are in global evaluation with an overlay present, restrict
189- // sources to those visible in the overlay or
172+ // sources to those visible in the overlay.
190173 isOverlayNode ( source )
191174 )
192175 }
@@ -199,18 +182,16 @@ module MakeImplStage1<LocationSig Location, InputSig<Location> Lang> {
199182 Config:: isSink ( sink )
200183 ) and
201184 // See the comments in `isFilteredSource` for the reasoning behind the following.
202- if
203- Config:: observeDiffInformedIncrementalMode ( )
204- then AlertFiltering:: diffInformationAvailable ( ) implies AlertFiltering:: locationIsInDiff ( Config:: getASelectedSinkLocation ( sink ) )
185+ if Config:: observeDiffInformedIncrementalMode ( )
186+ then
187+ AlertFiltering:: diffInformationAvailable ( )
188+ implies
189+ AlertFiltering:: locationIsInDiff ( Config:: getASelectedSinkLocation ( sink ) )
205190 else (
206- // If we are in base-only global evaluation, do not filter out any sources.
207191 not isEvaluatingInOverlay ( )
208192 or
209- // If we are in global evaluation with an overlay present, restrict
210- // sources to those visible in the overlay or
211193 isOverlayNode ( sink )
212194 )
213-
214195 }
215196
216197 private predicate hasFilteredSource ( ) { isFilteredSource ( _) }
0 commit comments