Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
a005dd2
Align old CFG node strings with shared library
owen-mc Aug 11, 2026
a8374d9
Improve redundant recover test coverage
owen-mc Aug 12, 2026
6c10b85
More tests for non-returning functions
owen-mc Aug 13, 2026
e0abcd1
Test semantic invalid types in notype test
owen-mc Jul 13, 2026
16a4ee5
Make KeyValueExpr have the same type as its value
owen-mc Aug 13, 2026
ec08c06
Change mayReturnNormally to mustNotReturnNormally
owen-mc Aug 13, 2026
e607140
Distinguish panic and exit in logrus
owen-mc Aug 13, 2026
93f3473
Model `logrus.Exit` like `os.Exit`
owen-mc Aug 13, 2026
53bcf58
Update two queries so alert locations don't change
owen-mc Jul 14, 2026
18f705f
Make synthetic RangeElementExpr during extraction
owen-mc Aug 13, 2026
1626fa2
Switch to using shared CFG library
owen-mc Aug 13, 2026
b28c2a3
Add go/print-cfg
owen-mc May 13, 2026
a5681f5
Add Go CFG consistency query
owen-mc Jun 1, 2026
56be432
fold implicit-one operand into incdec-rhs instruction
owen-mc Jul 10, 2026
2992cf9
fold compound-assign write into the compound-rhs instruction
owen-mc Jul 10, 2026
2acbd9a
drop implicit slice-bound nodes
owen-mc Jul 10, 2026
298d152
Merge 'result-init' node into 'result-zero-init'
owen-mc Jul 10, 2026
66f62d5
Fold implicit literal element index into the lit-init node
owen-mc Jul 10, 2026
f0a63c4
Fold uninitialised var-decl zero-init and write into one node
owen-mc Jul 10, 2026
430de96
Fold tuple-destructuring extract and write into one node
owen-mc Jul 10, 2026
823b5c7
Unify result-zero-init and zero-init node kinds
owen-mc Jul 10, 2026
1a2aa36
Simplify zero-init code after unifying result-zero-init
owen-mc Jul 10, 2026
d49d8f3
Unify incdec-rhs into the compound-rhs node kind
owen-mc Jul 10, 2026
3ca9265
No CFG nodes for subexprs of const exprs
owen-mc Jul 13, 2026
0e724aa
Add change note
owen-mc Aug 13, 2026
0b8f25d
Replace IfStmt.getCond with IfStmt.getCondition
owen-mc Aug 18, 2026
816261a
Address review comments
owen-mc Aug 18, 2026
a988fc9
Add defer CFG edge-case tests
owen-mc Aug 19, 2026
832a96a
Build defer edges from an early Go CFG
owen-mc Aug 19, 2026
13cfa68
Model Go function epilogues in the body CFG
owen-mc Aug 19, 2026
e7e565b
Address more review comments
owen-mc Aug 19, 2026
21548fe
Change CompoundAssignStmt and IncDecStmt
owen-mc Aug 19, 2026
2a7ba81
Move `getExpr` to `SwitchExpr`
owen-mc Aug 19, 2026
66c53f2
Remove/reduce comments
owen-mc Aug 19, 2026
fad07af
Rename file to ControlFlowGraphImpl.qll
owen-mc Aug 19, 2026
f531531
Use american spelling
owen-mc Aug 19, 2026
655c2cd
Add missing qldoc
owen-mc Aug 19, 2026
65608bc
Update change note
owen-mc Aug 19, 2026
503573b
Fix non-US spelling
owen-mc Sep 1, 2026
3394940
Change function epilogue CFG
owen-mc Sep 2, 2026
36f2b90
Remove CFG hook by making CFG for SelectStmt simpler
owen-mc Sep 2, 2026
3e82736
Remove CFG hook preservesDefaultControlFlow
owen-mc Sep 2, 2026
43dfa1a
Allow empty switch to be a simple leaf node
owen-mc Sep 2, 2026
95c8541
Rename ForeachStmt to ForEachStmt
owen-mc Sep 2, 2026
2e175ba
Undo unnecessary code changes
owen-mc Sep 3, 2026
6345ef9
Go: skip extracting ast.ParenExpr nodes
owen-mc Jul 9, 2026
31dd8c1
Go: deprecate ParenExpr and remove all references
owen-mc Jul 9, 2026
f298ef0
Accept `invalidAbruptCompletionOrigin` results
owen-mc Sep 4, 2026
035cbfd
Fix `invalidAbruptCompletionOrigin` results
owen-mc Sep 4, 2026
6c6f0a9
Cfg: Add consistency check for multiple default cases.
aschackmull Sep 4, 2026
c5ffdee
Go: restore data flow through pointer assignment targets
owen-mc Sep 4, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions go/docs/language/learn-ql/go/ast-class-reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -450,8 +450,6 @@ Miscellaneous
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| ``...`` | `Ellipsis <https://help.semmle.com/qldoc/go/semmle/go/Expr.qll/type.Expr$Ellipsis.html>`__ | | |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| ``(``\ `Expr <https://help.semmle.com/qldoc/go/semmle/go/Expr.qll/type.Expr$Expr.html>`__\ ``)`` | `ParenExpr <https://help.semmle.com/qldoc/go/semmle/go/Expr.qll/type.Expr$ParenExpr.html>`__ | | |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| `Ident <https://help.semmle.com/qldoc/go/semmle/go/Expr.qll/type.Expr$Ident.html>`__\ ``.``\ `Ident <https://help.semmle.com/qldoc/go/semmle/go/Expr.qll/type.Expr$Ident.html>`__ | `SelectorExpr <https://help.semmle.com/qldoc/go/semmle/go/Expr.qll/type.Expr$SelectorExpr.html>`__ | | |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| `Expr <https://help.semmle.com/qldoc/go/semmle/go/Expr.qll/type.Expr$Expr.html>`__\ ``[``\ `Expr <https://help.semmle.com/qldoc/go/semmle/go/Expr.qll/type.Expr$Expr.html>`__\ ``]`` | `IndexExpr <https://help.semmle.com/qldoc/go/semmle/go/Expr.qll/type.Expr$IndexExpr.html>`__ | | |
Expand Down
31 changes: 31 additions & 0 deletions go/downgrades/d0e7336b491e35a4c890e0b9755a4030d32ee444/exprs.ql
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
class Expr_ extends @expr {
string toString() { result = "Expr" }
}

class ExprParent_ extends @exprparent {
string toString() { result = "ExprParent" }
}

// The schema for exprs is:
//
// exprs(unique int id: @expr,
// int kind: int ref,
// int parent: @exprparent ref,
// int idx: int ref);
//
// `@rangeelementexpr` (kind 55) is a synthesized node that groups the loop
// variables (the key and value) of a `range` statement. To downgrade we remove
// those nodes and reparent their children (the key and value expressions)
// directly onto the `range` statement, at the same indices.
from Expr_ id, int kind, ExprParent_ newparent, int idx
where
exists(ExprParent_ parent | exprs(id, kind, parent, idx) and kind != 55 |
// A key or value grouped by a range element node: reparent it onto the
// range statement (the range element node's own parent).
exists(Expr_ pe | pe = parent and exprs(pe, 55, newparent, _))
or
// Any other expression keeps its parent unchanged.
not exists(Expr_ pe | pe = parent and exprs(pe, 55, _, _)) and
newparent = parent
)
select id, kind, newparent, idx
Loading
Loading