mirror of
https://github.com/github/codeql.git
synced 2025-12-21 11:16:30 +01:00
C++: Improve 'toString' on the 'InitializeGroup' instruction.
This commit is contained in:
@@ -2167,6 +2167,18 @@ class ChiInstruction extends Instruction {
|
|||||||
*/
|
*/
|
||||||
class InitializeGroupInstruction extends Instruction {
|
class InitializeGroupInstruction extends Instruction {
|
||||||
InitializeGroupInstruction() { this.getOpcode() instanceof Opcode::InitializeGroup }
|
InitializeGroupInstruction() { this.getOpcode() instanceof Opcode::InitializeGroup }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets an `IRVariable` whose memory is initialized by this instruction, if any.
|
||||||
|
* Note: Allocations that are not represented as `IRVariable`s (such as
|
||||||
|
* dynamic allocations) are not returned by this predicate even if this
|
||||||
|
* instruction initializes such memory.
|
||||||
|
*/
|
||||||
|
final IRVariable getAnIRVariable() { result = Construction::getAnInitializeGroupVariable(this) }
|
||||||
|
|
||||||
|
final override string getImmediateString() {
|
||||||
|
result = strictconcat(this.getAnIRVariable().toString(), ",")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -263,6 +263,14 @@ private module Cached {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cached
|
||||||
|
IRVariable getAnInitializeGroupVariable(InitializeGroupInstruction init) {
|
||||||
|
exists(Alias::VariableGroup vg |
|
||||||
|
init = initializeGroup(vg) and
|
||||||
|
result = vg.getAnAllocation().getABaseInstruction().(VariableInstruction).getIRVariable()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds if `instr` is part of a cycle in the operand graph that doesn't go
|
* Holds if `instr` is part of a cycle in the operand graph that doesn't go
|
||||||
* through a phi instruction and therefore should be impossible.
|
* through a phi instruction and therefore should be impossible.
|
||||||
|
|||||||
@@ -407,6 +407,8 @@ predicate hasUnreachedInstruction(IRFunction func) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IRVariable getAnInitializeGroupVariable(InitializeGroupInstruction instr) { none() }
|
||||||
|
|
||||||
import CachedForDebugging
|
import CachedForDebugging
|
||||||
|
|
||||||
cached
|
cached
|
||||||
|
|||||||
@@ -263,6 +263,9 @@ private module Cached {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cached
|
||||||
|
IRVariable getAnInitializeGroupVariable(InitializeGroupInstruction instr) { none() }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds if `instr` is part of a cycle in the operand graph that doesn't go
|
* Holds if `instr` is part of a cycle in the operand graph that doesn't go
|
||||||
* through a phi instruction and therefore should be impossible.
|
* through a phi instruction and therefore should be impossible.
|
||||||
|
|||||||
Reference in New Issue
Block a user