-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Shared/Java: Introduce a shared control flow reachability library and replace the Java Nullness implementation. #20367
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
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
db1f399
Java: Preparatory Nullness refactor.
aschackmull 1ebdcdf
Guards: Support integer ranges.
aschackmull 924a8ea
Java: Improve precision of SuccessorType labels in CFG.
aschackmull 452bbf7
Java: Add some more nullness tests.
aschackmull 4a8ffea
Shared: Add control flow reachability lib.
aschackmull 03321ff
Java: Replace nullness implementation.
aschackmull 60d07cf
Java: Clean up IntegerGuards.qll
aschackmull e8f1ec6
Java: Accept guards test results.
aschackmull 2743fc0
Guards: Include ConditionalExpr in exprHasValue.
aschackmull f9ffee0
Java: Minor nullness cleanup.
aschackmull e302616
Java: Accept qltest change.
aschackmull b308c54
Java: Add a change note, and a minor ql comment.
aschackmull be39c4c
Shared: Minor precision improvement.
aschackmull acb4d9f
Shared: Copy some qldoc from Guards.qll
aschackmull File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| /** | ||
| * Provides an implementation of local (intraprocedural) control flow reachability. | ||
| */ | ||
| overlay[local?] | ||
| module; | ||
|
|
||
| import java | ||
| private import codeql.controlflow.ControlFlow | ||
| private import semmle.code.java.dataflow.SSA as SSA | ||
| private import semmle.code.java.controlflow.Guards as Guards | ||
|
|
||
| private module ControlFlowInput implements InputSig<Location, ControlFlowNode, BasicBlock> { | ||
| private import java as J | ||
|
|
||
| AstNode getEnclosingAstNode(ControlFlowNode node) { node.getAstNode() = result } | ||
|
|
||
| class AstNode = ExprParent; | ||
|
|
||
| AstNode getParent(AstNode node) { | ||
| result = node.(Expr).getParent() or | ||
| result = node.(Stmt).getParent() | ||
| } | ||
|
|
||
| class FinallyBlock extends AstNode { | ||
| FinallyBlock() { any(TryStmt try).getFinally() = this } | ||
| } | ||
|
|
||
| class Expr = J::Expr; | ||
|
|
||
| class SourceVariable = SSA::SsaSourceVariable; | ||
|
|
||
| class SsaDefinition = SSA::SsaVariable; | ||
|
|
||
| class SsaWriteDefinition extends SsaDefinition instanceof SSA::SsaExplicitUpdate { | ||
| Expr getDefinition() { | ||
| super.getDefiningExpr().(VariableAssign).getSource() = result or | ||
| super.getDefiningExpr().(AssignOp) = result | ||
| } | ||
| } | ||
|
|
||
| class SsaPhiNode = SSA::SsaPhiNode; | ||
|
|
||
| class SsaUncertainDefinition extends SsaDefinition instanceof SSA::SsaUncertainImplicitUpdate { | ||
| SsaDefinition getPriorDefinition() { result = super.getPriorDef() } | ||
| } | ||
|
|
||
| class GuardValue = Guards::GuardValue; | ||
|
|
||
| predicate ssaControlsBranchEdge(SsaDefinition def, BasicBlock bb1, BasicBlock bb2, GuardValue v) { | ||
| Guards::Guards_v3::ssaControlsBranchEdge(def, bb1, bb2, v) | ||
| } | ||
|
|
||
| predicate ssaControls(SsaDefinition def, BasicBlock bb, GuardValue v) { | ||
| Guards::Guards_v3::ssaControls(def, bb, v) | ||
| } | ||
|
|
||
| import Guards::Guards_v3::InternalUtil | ||
| } | ||
|
|
||
| module ControlFlow = Make<Location, Cfg, ControlFlowInput>; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check warning
Code scanning / CodeQL
Names only differing by case Warning