Skip to content

Commit ef89e3b

Browse files
committed
C++: Added charpred to ensure that only instructions that have a source representation have a GVN
1 parent 63f1d3d commit ef89e3b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

cpp/ql/src/semmle/code/cpp/ir/internal/ASTValueNumbering.qll

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ private import semmle.code.cpp.ir.IR
5151
* methods.
5252
*/
5353
class GVN extends TValueNumber {
54+
GVN() {
55+
exists(Instruction instr |
56+
this = tvalueNumber(instr) and exists(instr.getUnconvertedResultExpression())
57+
)
58+
}
59+
5460
private Instruction getAnInstruction() { this = tvalueNumber(result) }
5561

5662
final string toString() { result = "GVN" }

0 commit comments

Comments
 (0)