mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
C++: Fix join order in getAnAssignedValue
This commit is contained in:
@@ -115,6 +115,10 @@ class Variable extends Declaration, @variable {
|
||||
else result = this.getADeclarationLocation()
|
||||
}
|
||||
|
||||
/** Pulled out of `getAnAssignedValue` to fix a bad join order */
|
||||
pragma[noinline]
|
||||
private predicate aggregateLiteralHasType(AggregateLiteral lit, Class c) { lit.getType() = c }
|
||||
|
||||
/**
|
||||
* Gets an expression that is assigned to this variable somewhere in the
|
||||
* program.
|
||||
@@ -126,8 +130,9 @@ class Variable extends Declaration, @variable {
|
||||
or
|
||||
exists(AssignExpr ae | ae.getLValue().(Access).getTarget() = this and result = ae.getRValue())
|
||||
or
|
||||
exists(AggregateLiteral l |
|
||||
this.getDeclaringType() = l.getType() and
|
||||
exists(AggregateLiteral l, Class c |
|
||||
this.(Field).getDeclaringType() = c and
|
||||
aggregateLiteralHasType(l, c) and
|
||||
result = l.getChild(this.(Field).getInitializationOrder())
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user