Merge pull request #13257 from smowton/smowton/hotfix/useless-assignment-to-field-exclude-method-receivers

Hotfix: Go: exclude method receivers from dead-store-of-field query
This commit is contained in:
Arthur Baars
2023-05-23 16:20:34 +02:00
committed by GitHub

View File

@@ -38,6 +38,9 @@ predicate escapes(DataFlow::Node nd) {
// if `nd` is passed to a function, then it escapes
nd = any(DataFlow::CallNode c).getASyntacticArgument()
or
// if `nd` is the receiver of a function, then it escapes
nd = any(DataFlow::MethodCallNode c).getReceiver()
or
// if `nd` has its address taken, then it escapes
exists(AddressExpr ae | nd.asExpr() = ae.getOperand())
or