File tree Expand file tree Collapse file tree 4 files changed +25
-0
lines changed
cpp/ql/lib/semmle/code/cpp/ir/implementation Expand file tree Collapse file tree 4 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -2167,6 +2167,18 @@ class ChiInstruction extends Instruction {
2167
2167
*/
2168
2168
class InitializeGroupInstruction extends Instruction {
2169
2169
InitializeGroupInstruction ( ) { this .getOpcode ( ) instanceof Opcode:: InitializeGroup }
2170
+
2171
+ /**
2172
+ * Gets an `IRVariable` whose memory is initialized by this instruction, if any.
2173
+ * Note: Allocations that are not represented as `IRVariable`s (such as
2174
+ * dynamic allocations) are not returned by this predicate even if this
2175
+ * instruction initializes such memory.
2176
+ */
2177
+ final IRVariable getAnIRVariable ( ) { result = Construction:: getAnInitializeGroupVariable ( this ) }
2178
+
2179
+ final override string getImmediateString ( ) {
2180
+ result = strictconcat ( this .getAnIRVariable ( ) .toString ( ) , "," )
2181
+ }
2170
2182
}
2171
2183
2172
2184
/**
Original file line number Diff line number Diff line change @@ -263,6 +263,14 @@ private module Cached {
263
263
)
264
264
}
265
265
266
+ cached
267
+ IRVariable getAnInitializeGroupVariable ( InitializeGroupInstruction init ) {
268
+ exists ( Alias:: VariableGroup vg |
269
+ init = initializeGroup ( vg ) and
270
+ result = vg .getAnAllocation ( ) .getABaseInstruction ( ) .( VariableInstruction ) .getIRVariable ( )
271
+ )
272
+ }
273
+
266
274
/**
267
275
* Holds if `instr` is part of a cycle in the operand graph that doesn't go
268
276
* through a phi instruction and therefore should be impossible.
Original file line number Diff line number Diff line change @@ -407,6 +407,8 @@ predicate hasUnreachedInstruction(IRFunction func) {
407
407
)
408
408
}
409
409
410
+ IRVariable getAnInitializeGroupVariable ( InitializeGroupInstruction instr ) { none ( ) }
411
+
410
412
import CachedForDebugging
411
413
412
414
cached
Original file line number Diff line number Diff line change @@ -263,6 +263,9 @@ private module Cached {
263
263
)
264
264
}
265
265
266
+ cached
267
+ IRVariable getAnInitializeGroupVariable ( InitializeGroupInstruction instr ) { none ( ) }
268
+
266
269
/**
267
270
* Holds if `instr` is part of a cycle in the operand graph that doesn't go
268
271
* through a phi instruction and therefore should be impossible.
You can’t perform that action at this time.
0 commit comments