Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
78e599a
Align old CFG node strings with shared library
owen-mc Aug 11, 2026
9cb913a
Improve redundant recover test coverage
owen-mc Aug 12, 2026
b1beee3
More tests for non-returning functions
owen-mc Aug 13, 2026
34db2ae
Test semantic invalid types in notype test
owen-mc Jul 13, 2026
4f31f2e
Make KeyValueExpr have the same type as its value
owen-mc Aug 13, 2026
83fa0bd
Change mayReturnNormally to mustNotReturnNormally
owen-mc Aug 13, 2026
c8e5e81
Distinguish panic and exit in logrus
owen-mc Aug 13, 2026
cc2359f
Model `logrus.Exit` like `os.Exit`
owen-mc Aug 13, 2026
7d964e3
Update two queries so alert locations don't change
owen-mc Jul 14, 2026
fdf393c
Make synthetic RangeElementExpr during extraction
owen-mc Aug 13, 2026
341aec6
Switch to using shared CFG library
owen-mc Aug 13, 2026
56d4c0f
Add go/print-cfg
owen-mc May 13, 2026
94db14c
Add Go CFG consistency query
owen-mc Jun 1, 2026
743d6b4
fold implicit-one operand into incdec-rhs instruction
owen-mc Jul 10, 2026
0e3bfb4
fold compound-assign write into the compound-rhs instruction
owen-mc Jul 10, 2026
50b47a1
drop implicit slice-bound nodes
owen-mc Jul 10, 2026
6a1e543
Merge 'result-init' node into 'result-zero-init'
owen-mc Jul 10, 2026
daa8151
Fold implicit literal element index into the lit-init node
owen-mc Jul 10, 2026
aa92473
Fold uninitialised var-decl zero-init and write into one node
owen-mc Jul 10, 2026
5b665d3
Fold tuple-destructuring extract and write into one node
owen-mc Jul 10, 2026
315cbde
Unify result-zero-init and zero-init node kinds
owen-mc Jul 10, 2026
d56d49a
Simplify zero-init code after unifying result-zero-init
owen-mc Jul 10, 2026
811f873
Unify incdec-rhs into the compound-rhs node kind
owen-mc Jul 10, 2026
9445907
No CFG nodes for subexprs of const exprs
owen-mc Jul 13, 2026
5451adf
Add change note
owen-mc Aug 13, 2026
f1a5535
Replace IfStmt.getCond with IfStmt.getCondition
owen-mc Aug 18, 2026
a10615e
Address review comments
owen-mc Aug 18, 2026
40464e6
Add defer CFG edge-case tests
owen-mc Aug 19, 2026
dcde7f4
Build defer edges from an early Go CFG
owen-mc Aug 19, 2026
22b8ba8
Model Go function epilogues in the body CFG
owen-mc Aug 19, 2026
e19d246
Address more review comments
owen-mc Aug 19, 2026
b44fc4c
Change CompoundAssignStmt and IncDecStmt
owen-mc Aug 19, 2026
42f5cb4
Move `getExpr` to `SwitchExpr`
owen-mc Aug 19, 2026
f0393bb
Remove/reduce comments
owen-mc Aug 19, 2026
33417b0
Rename file to ControlFlowGraphImpl.qll
owen-mc Aug 19, 2026
a019e26
Use american spelling
owen-mc Aug 19, 2026
1006091
Add missing qldoc
owen-mc Aug 19, 2026
f361b9f
Update change note
owen-mc Aug 19, 2026
1f3c185
Fix non-US spelling
owen-mc Sep 1, 2026
647bde3
Change function epilogue CFG
owen-mc Sep 2, 2026
95ccfa0
Remove CFG hook by making CFG for SelectStmt simpler
owen-mc Sep 2, 2026
3154d11
Remove CFG hook preservesDefaultControlFlow
owen-mc Sep 2, 2026
bac93a2
Allow empty switch to be a simple leaf node
owen-mc Sep 2, 2026
6a5090e
Rename ForeachStmt to ForEachStmt
owen-mc Sep 2, 2026
80ee4a3
Undo unnecessary code changes
owen-mc Sep 3, 2026
1e2ec20
Go: skip extracting ast.ParenExpr nodes
owen-mc Jul 9, 2026
fbdc763
Go: deprecate ParenExpr and remove all references
owen-mc Jul 9, 2026
290978f
Accept `invalidAbruptCompletionOrigin` results
owen-mc Sep 4, 2026
a7ce6ea
Fix `invalidAbruptCompletionOrigin` results
owen-mc Sep 4, 2026
a6be716
Go: restore data flow through pointer assignment targets
owen-mc Sep 4, 2026
e4fbaec
Fix go/whitespace-contradicts-precendence for ParenExpr removal
owen-mc Sep 8, 2026
dff974b
Fix bad join order
owen-mc Sep 8, 2026
b33950e
(Performance) don't materialize ancestor relation
owen-mc Sep 10, 2026
9489532
Shared CFG: Inline `toString` on `NodeImpl`
owen-mc Sep 10, 2026
9711f0b
(Performance) speed up GVN calculations by using contracted graph
owen-mc Sep 10, 2026
340ac89
Shared CFG: Add `includeCallableEntry` hook
owen-mc Sep 10, 2026
6f74bb4
Performance: Use `includeCallableEntry` hook
owen-mc Sep 10, 2026
5aeefe1
Minor refactor (don't use AstNode.getNumChild)
owen-mc Sep 10, 2026
9f4006c
Refactor: avoid transitive closures
owen-mc Sep 10, 2026
aad68eb
Limit Go build-constraint regex matching to initial comments
owen-mc Sep 10, 2026
a478ddb
Fix bad join order
owen-mc Sep 11, 2026
3684b55
Cache Go CFG root lookup
owen-mc Sep 11, 2026
184cf5e
Use shared CFG leaf representation more for Go
owen-mc Sep 11, 2026
7d42128
Use shared default sequencing for ordinary Go operations
owen-mc Sep 11, 2026
b9a4202
Use shared CFG leaf nodes for Go function literals
owen-mc Sep 11, 2026
e5403b2
Add QLDoc to `skipCfg`
owen-mc Sep 11, 2026
e2ed087
Cache Go IR write-target construction
owen-mc Sep 11, 2026
9ca8617
Limit Go explicit CFG child ranking to its consumers
owen-mc Sep 11, 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