File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
cpp/ql/src/semmle/code/cpp Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -115,6 +115,10 @@ class Variable extends Declaration, @variable {
115
115
else result = this .getADeclarationLocation ( )
116
116
}
117
117
118
+ /** Pulled out of `getAnAssignedValue` to fix a bad join order */
119
+ pragma [ noinline]
120
+ private predicate aggregateLiteralHasType ( AggregateLiteral lit , Class c ) { lit .getType ( ) = c }
121
+
118
122
/**
119
123
* Gets an expression that is assigned to this variable somewhere in the
120
124
* program.
@@ -126,8 +130,9 @@ class Variable extends Declaration, @variable {
126
130
or
127
131
exists ( AssignExpr ae | ae .getLValue ( ) .( Access ) .getTarget ( ) = this and result = ae .getRValue ( ) )
128
132
or
129
- exists ( AggregateLiteral l |
130
- this .getDeclaringType ( ) = l .getType ( ) and
133
+ exists ( AggregateLiteral l , Class c |
134
+ this .( Field ) .getDeclaringType ( ) = c and
135
+ aggregateLiteralHasType ( l , c ) and
131
136
result = l .getChild ( this .( Field ) .getInitializationOrder ( ) )
132
137
)
133
138
}
You can’t perform that action at this time.
0 commit comments