Skip to content

Commit de50e05

Browse files
committed
Performance: Use includeCallableEntry hook
1 parent ccfe9b0 commit de50e05

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

‎go/ql/lib/semmle/go/controlflow/ControlFlowGraphImpl.qll‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1727,8 +1727,15 @@ module CfgImpl {
17271727
}
17281728
}
17291729

1730-
/** Builds the CFG used to determine which `defer` statements have been registered. */
1730+
/**
1731+
* Builds the CFG used to determine which `defer` statements have been registered.
1732+
* Only functions containing `defer` statements need this auxiliary stage.
1733+
*/
17311734
private module EarlyInput2 implements Cfg1::InputSig2 {
1735+
predicate includeCallableEntry(Ast::Callable callable) {
1736+
callable = any(Go::DeferStmt stmt).getEnclosingFunction()
1737+
}
1738+
17321739
predicate beginAbruptCompletion(
17331740
Ast::AstNode ast, PreControlFlowNode n, AbruptCompletion c, boolean always
17341741
) {

0 commit comments

Comments
 (0)