-
Notifications
You must be signed in to change notification settings - Fork 1.7k
DataFlow: Run overlay-informed if not diff-informed #19857
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
bceb147
3cbaf51
052023e
4f49718
ddaf0b2
3c2c871
c1214db
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
To ensure good performance, always run data flow overlay-informed unless the configuration has opted in to being diff-informed. This change affects only databases with an overlay and therefore has no immediate production consequences.
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
* Provides an implementation of a fast initial pruning of global | ||
* (interprocedural) data flow reachability (Stage 1). | ||
*/ | ||
overlay[local?] | ||
overlay[local?] // when this is removed, put `overlay[local?]` on `isOverlayNode`. | ||
module; | ||
|
||
private import codeql.util.Unit | ||
|
@@ -129,14 +129,38 @@ module MakeImplStage1<LocationSig Location, InputSig<Location> Lang> { | |
|
||
private module AlertFiltering = AlertFilteringImpl<Location>; | ||
|
||
/** | ||
* Holds if the given node is visible in overlay-only local evaluation. | ||
* | ||
* This predicate needs to be `overlay[local?]`, either directly or | ||
* through annotations from an outer scope. If `Node` is global for the | ||
* language under analysis, then every node is considered an overlay | ||
* node, which means there will effectively be no overlay-based | ||
* filtering of sources and sinks. | ||
*/ | ||
private predicate isOverlayNode(Node node) { | ||
Comment on lines
+135
to
+141
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not give this predicate an explicit overlay annotation now? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The compiler gives a warning that it's redundant because the file module is also annotated |
||
isEvaluatingInOverlay() and | ||
// Any local node is an overlay node if we are evaluating in overlay mode | ||
node = node | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The predicate Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The canonical way to write this is |
||
} | ||
|
||
overlay[global] | ||
pragma[nomagic] | ||
private predicate isFilteredSource(Node source) { | ||
Config::isSource(source, _) and | ||
if Config::observeDiffInformedIncrementalMode() | ||
then AlertFiltering::filterByLocation(Config::getASelectedSourceLocation(source)) | ||
else any() | ||
else ( | ||
// If we are in base-only global evaluation, do not filter out any sources. | ||
not isEvaluatingInOverlay() | ||
or | ||
// If we are in global evaluation with an overlay present, restrict | ||
// sources to those visible in the overlay. | ||
isOverlayNode(source) | ||
) | ||
} | ||
|
||
overlay[global] | ||
pragma[nomagic] | ||
private predicate isFilteredSink(Node sink) { | ||
( | ||
|
@@ -145,7 +169,14 @@ module MakeImplStage1<LocationSig Location, InputSig<Location> Lang> { | |
) and | ||
if Config::observeDiffInformedIncrementalMode() | ||
then AlertFiltering::filterByLocation(Config::getASelectedSinkLocation(sink)) | ||
else any() | ||
else ( | ||
// If we are in base-only global evaluation, do not filter out any sinks. | ||
not isEvaluatingInOverlay() | ||
or | ||
// If we are in global evaluation with an overlay present, restrict | ||
// sinks to those visible in the overlay. | ||
isOverlayNode(sink) | ||
) | ||
} | ||
|
||
private predicate hasFilteredSource() { isFilteredSource(_) } | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default
isEvaluatingInOverlay
predicate lacks the requiredoverlay[local]
annotation, so overlay-local evaluations won't see it. Addoverlay[local]
to its definition.Copilot uses AI. Check for mistakes.