@@ -169,19 +169,21 @@ private newtype TDefOrUseImpl =
169
169
// Avoid creating parameter nodes if there is no definitions of the variable other than the initializaion.
170
170
exists ( SsaInternals0:: Def def |
171
171
def .getSourceVariable ( ) .getBaseVariable ( ) .( BaseIRVariable ) .getIRVariable ( ) .getAst ( ) = p and
172
- not def .getValue ( ) .asInstruction ( ) instanceof InitializeParameterInstruction
173
- ) and
174
- // If the type is modifiable
175
- exists ( CppType cppType |
176
- cppType .hasUnspecifiedType ( p .getUnspecifiedType ( ) , _) and
177
- isModifiableAt ( cppType , indirectionIndex + 1 )
178
- ) and
179
- exists ( Indirection indirection |
180
- indirection .getType ( ) = p .getUnspecifiedType ( ) and
181
- indirectionIndex = [ 1 .. indirection .getNumberOfIndirections ( ) ]
172
+ not def .getValue ( ) .asInstruction ( ) instanceof InitializeParameterInstruction and
173
+ unspecifiedTypeIsModifiableAt ( p .getUnspecifiedType ( ) , indirectionIndex )
182
174
)
183
175
}
184
176
177
+ private predicate unspecifiedTypeIsModifiableAt ( Type unspecified , int indirectionIndex ) {
178
+ indirectionIndex = [ 1 .. getIndirectionForUnspecifiedType ( unspecified ) .getNumberOfIndirections ( ) ] and
179
+ exists ( CppType cppType |
180
+ cppType .hasUnspecifiedType ( unspecified , _) and
181
+ isModifiableAt ( cppType , indirectionIndex + 1 )
182
+ )
183
+ }
184
+
185
+ private Indirection getIndirectionForUnspecifiedType ( Type t ) { result .getType ( ) = t }
186
+
185
187
abstract private class DefOrUseImpl extends TDefOrUseImpl {
186
188
/** Gets a textual representation of this element. */
187
189
abstract string toString ( ) ;
0 commit comments