Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c224bbd

Browse files
C++: Fix Operand.getSize()
1 parent bd46c43 commit c224bbd

3 files changed

Lines changed: 18 additions & 6 deletions

File tree

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,14 @@ class Operand extends TOperand {
2121
result = "Operand"
2222
}
2323

24-
Location getLocation() {
24+
final Location getLocation() {
2525
result = getUseInstruction().getLocation()
2626
}
2727

28+
final FunctionIR getEnclosingFunctionIR() {
29+
result = getUseInstruction().getEnclosingFunctionIR()
30+
}
31+
2832
/**
2933
* Gets the `Instruction` that consumes this operand.
3034
*/
@@ -91,7 +95,7 @@ class Operand extends TOperand {
9195
* a known constant size, this predicate does not hold.
9296
*/
9397
int getSize() {
94-
result = getDefinitionInstruction().getResultSize()
98+
result = getType().getSize()
9599
}
96100
}
97101

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,14 @@ class Operand extends TOperand {
2121
result = "Operand"
2222
}
2323

24-
Location getLocation() {
24+
final Location getLocation() {
2525
result = getUseInstruction().getLocation()
2626
}
2727

28+
final FunctionIR getEnclosingFunctionIR() {
29+
result = getUseInstruction().getEnclosingFunctionIR()
30+
}
31+
2832
/**
2933
* Gets the `Instruction` that consumes this operand.
3034
*/
@@ -91,7 +95,7 @@ class Operand extends TOperand {
9195
* a known constant size, this predicate does not hold.
9296
*/
9397
int getSize() {
94-
result = getDefinitionInstruction().getResultSize()
98+
result = getType().getSize()
9599
}
96100
}
97101

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,14 @@ class Operand extends TOperand {
2121
result = "Operand"
2222
}
2323

24-
Location getLocation() {
24+
final Location getLocation() {
2525
result = getUseInstruction().getLocation()
2626
}
2727

28+
final FunctionIR getEnclosingFunctionIR() {
29+
result = getUseInstruction().getEnclosingFunctionIR()
30+
}
31+
2832
/**
2933
* Gets the `Instruction` that consumes this operand.
3034
*/
@@ -91,7 +95,7 @@ class Operand extends TOperand {
9195
* a known constant size, this predicate does not hold.
9296
*/
9397
int getSize() {
94-
result = getDefinitionInstruction().getResultSize()
98+
result = getType().getSize()
9599
}
96100
}
97101

0 commit comments

Comments
 (0)