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

Skip to content

Commit ef836c3

Browse files
author
Robert Marsh
committed
C++: respond to PR comments
1 parent 17ad124 commit ef836c3

2 files changed

Lines changed: 4 additions & 6 deletions

File tree

cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/internal/AliasAnalysis.qll

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,6 @@ private predicate operandEscapesNonReturn(Operand operand) {
177177
operandEscapesDomain(operand)
178178
}
179179

180-
181180
private predicate operandMayReachReturn(Operand operand) {
182181
// The address is propagated to the result of the instruction, and that result itself is returned
183182
operandIsPropagated(operand, _) and
@@ -204,15 +203,15 @@ private predicate operandReturned(Operand operand, IntValue bitOffset) {
204203
exists(IntValue bitOffset1, IntValue bitOffset2 |
205204
operandIsPropagated(operand, bitOffset1) and
206205
resultReturned(operand.getUseInstruction(), bitOffset2) and
207-
bitOffset = bitOffset1 + bitOffset2
206+
bitOffset = Ints::add(bitOffset1, bitOffset2)
208207
)
209208
or
210209
// The operand is used in a function call which returns it, and the return value is then returned
211210
exists(CallInstruction ci, Instruction init, IntValue bitOffset1, IntValue bitOffset2 |
212211
isArgumentForParameter(ci, operand, init) and
213212
resultReturned(init, bitOffset1) and
214213
resultReturned(ci, bitOffset2) and
215-
bitOffset = bitOffset1 + bitOffset2
214+
bitOffset = Ints::add(bitOffset1, bitOffset2)
216215

217216
)
218217
or

cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/internal/AliasAnalysis.qll

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,6 @@ private predicate operandEscapesNonReturn(Operand operand) {
177177
operandEscapesDomain(operand)
178178
}
179179

180-
181180
private predicate operandMayReachReturn(Operand operand) {
182181
// The address is propagated to the result of the instruction, and that result itself is returned
183182
operandIsPropagated(operand, _) and
@@ -204,15 +203,15 @@ private predicate operandReturned(Operand operand, IntValue bitOffset) {
204203
exists(IntValue bitOffset1, IntValue bitOffset2 |
205204
operandIsPropagated(operand, bitOffset1) and
206205
resultReturned(operand.getUseInstruction(), bitOffset2) and
207-
bitOffset = bitOffset1 + bitOffset2
206+
bitOffset = Ints::add(bitOffset1, bitOffset2)
208207
)
209208
or
210209
// The operand is used in a function call which returns it, and the return value is then returned
211210
exists(CallInstruction ci, Instruction init, IntValue bitOffset1, IntValue bitOffset2 |
212211
isArgumentForParameter(ci, operand, init) and
213212
resultReturned(init, bitOffset1) and
214213
resultReturned(ci, bitOffset2) and
215-
bitOffset = bitOffset1 + bitOffset2
214+
bitOffset = Ints::add(bitOffset1, bitOffset2)
216215

217216
)
218217
or

0 commit comments

Comments
 (0)