-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Go: Use shared basic block lib #21224
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
base: main
Are you sure you want to change the base?
Conversation
| // predicate nodeIsPostDominanceExit(Node node) { node instanceof ControlFlow::NormalExitNode } | ||
| } | ||
|
|
||
| private module BbImpl = BB::Make<Location, Input>; |
Check warning
Code scanning / CodeQL
Dead code Warning
| this.succ0(pred, succ, t) | ||
| or | ||
| exists(Completion cmpl | | ||
| lastNode(this.getBody(), pred, cmpl) and | ||
| // last node of function body can be reached without going through a `defer` statement | ||
| pred = notDeferSucc0*(this.getEntry()) | ||
| | | ||
| // panic goes directly to exit, non-panic reads result variables first | ||
| if cmpl = Panic() then succ = MkExitNode(this) else succ = this.getEpilogueNode(0) | ||
| ( | ||
| ( | ||
| if cmpl = Panic() | ||
| then succ = MkExitNode(this) and t instanceof ExceptionSuccessor | ||
| else succ = this.getEpilogueNode(0) | ||
| ) and | ||
| t instanceof DirectSuccessor | ||
| ) | ||
| ) | ||
| or | ||
| lastNode(this.getBody(), pred, _) and | ||
| exists(DeferStmt defer | defer = this.getADeferStmt() | | ||
| succ = MkExprNode(defer.getCall()) and | ||
| // the last `DeferStmt` executed before pred is this `defer` | ||
| pred = notDeferSucc0*(MkDeferNode(defer)) | ||
| ) | ||
| or | ||
| exists(DeferStmt predDefer, DeferStmt succDefer | | ||
| predDefer = this.getADeferStmt() and | ||
| succDefer = this.getADeferStmt() | ||
| | | ||
| // reversed because `defer`s are executed in LIFO order | ||
| MkDeferNode(predDefer) = nextDefer(MkDeferNode(succDefer)) and | ||
| pred = MkExprNode(predDefer.getCall()) and | ||
| succ = MkExprNode(succDefer.getCall()) | ||
| ) | ||
| ) and | ||
| t instanceof DirectSuccessor | ||
| or | ||
| this.firstDefer(pred) and | ||
| ( | ||
| // conservatively assume that we might either panic (and hence skip the result reads) | ||
| // or not | ||
| succ = MkExitNode(this) | ||
| succ = MkExitNode(this) and t instanceof ExitSuccessor | ||
| or | ||
| succ = this.getEpilogueNode(0) | ||
| ) |
Check warning
Code scanning / CodeQL
Var only used in one side of disjunct Warning
variable t
| this.succ0(pred, succ, _) | ||
| } | ||
|
|
||
| pragma[nomagic] |
Check warning
Code scanning / CodeQL
Override with unmentioned parameter Warning
t
| pragma[nomagic] | ||
| override predicate succ0(ControlFlow::Node pred, ControlFlow::Node succ, SuccessorType t) { | ||
| ControlFlowTree.super.succ0(pred, succ, t) | ||
| or |
Check warning
Code scanning / CodeQL
Override with unmentioned parameter Warning
t
Check warning
Code scanning / CodeQL
Dead code Warning
No description provided.