C++: Added charpred to ensure that only instructions that have a source representation have a GVN

This commit is contained in:
Mathias Vorreiter Pedersen
2020-02-05 11:20:34 +01:00
parent 63f1d3ded7
commit ef89e3bdb5

View File

@@ -51,6 +51,12 @@ private import semmle.code.cpp.ir.IR
* methods.
*/
class GVN extends TValueNumber {
GVN() {
exists(Instruction instr |
this = tvalueNumber(instr) and exists(instr.getUnconvertedResultExpression())
)
}
private Instruction getAnInstruction() { this = tvalueNumber(result) }
final string toString() { result = "GVN" }