Skip to content

Commit fef58ec

Browse files
C++: Add "~" prefix to inexact uses
1 parent ff12ed1 commit fef58ec

File tree

6 files changed

+609
-594
lines changed

6 files changed

+609
-594
lines changed

cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/Operand.qll

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,14 @@ class Operand extends TOperand {
7676
* For example: `this:r3_5`
7777
*/
7878
final string getDumpString() {
79-
result = getDumpLabel() + getDefinitionInstruction().getResultId()
79+
result = getDumpLabel() + getInexactSpecifier() + getDefinitionInstruction().getResultId()
8080
}
8181

82+
/**
83+
* Gets a string prefix to prepend to the operand's definition ID in an IR dump, specifying whether the operand is
84+
* an exact or inexact use of its definition. For an inexact use, the prefix is "~". For an exact use, the prefix is
85+
* the empty string.
86+
*/
8287
private string getInexactSpecifier() {
8388
if isDefinitionInexact() then
8489
result = "~"

cpp/ql/src/semmle/code/cpp/ir/implementation/raw/Operand.qll

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,14 @@ class Operand extends TOperand {
7676
* For example: `this:r3_5`
7777
*/
7878
final string getDumpString() {
79-
result = getDumpLabel() + getDefinitionInstruction().getResultId()
79+
result = getDumpLabel() + getInexactSpecifier() + getDefinitionInstruction().getResultId()
8080
}
8181

82+
/**
83+
* Gets a string prefix to prepend to the operand's definition ID in an IR dump, specifying whether the operand is
84+
* an exact or inexact use of its definition. For an inexact use, the prefix is "~". For an exact use, the prefix is
85+
* the empty string.
86+
*/
8287
private string getInexactSpecifier() {
8388
if isDefinitionInexact() then
8489
result = "~"

cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/Operand.qll

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,14 @@ class Operand extends TOperand {
7676
* For example: `this:r3_5`
7777
*/
7878
final string getDumpString() {
79-
result = getDumpLabel() + getDefinitionInstruction().getResultId()
79+
result = getDumpLabel() + getInexactSpecifier() + getDefinitionInstruction().getResultId()
8080
}
8181

82+
/**
83+
* Gets a string prefix to prepend to the operand's definition ID in an IR dump, specifying whether the operand is
84+
* an exact or inexact use of its definition. For an inexact use, the prefix is "~". For an exact use, the prefix is
85+
* the empty string.
86+
*/
8287
private string getInexactSpecifier() {
8388
if isDefinitionInexact() then
8489
result = "~"

0 commit comments

Comments
 (0)