Skip to content

Commit 2f42054

Browse files
committed
C++: Rename 'hasRankInBlock' to 'hasIndexInBlock' since it's not really a rank computation anymore.
1 parent fdb9fb5 commit 2f42054

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/SsaInternals.qll

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -304,8 +304,8 @@ cached
304304
private module Cached {
305305
private predicate defUseFlow(Node nodeFrom, Node nodeTo) {
306306
exists(IRBlock bb1, int i1, IRBlock bb2, int i2, DefOrUse defOrUse, Use use |
307-
defOrUse.hasRankInBlock(bb1, i1) and
308-
use.hasRankInBlock(bb2, i2) and
307+
defOrUse.hasIndexInBlock(bb1, i1) and
308+
use.hasIndexInBlock(bb2, i2) and
309309
adjacentDefRead(_, bb1, i1, bb2, i2) and
310310
nodeFrom.asInstruction() = toInstruction(defOrUse) and
311311
flowOutOfAddressStep(use.getOperand(), nodeTo)
@@ -317,9 +317,9 @@ private module Cached {
317317
exists(IRBlock bb1, int i1, IRBlock bb2, int i2, Def def, Use use |
318318
nodeFrom.isTerminal() and
319319
def.getInstruction() = nodeFrom.getStoreInstruction() and
320-
def.hasRankInBlock(bb1, i1) and
320+
def.hasIndexInBlock(bb1, i1) and
321321
adjacentDefRead(_, bb1, i1, bb2, i2) and
322-
use.hasRankInBlock(bb2, i2) and
322+
use.hasIndexInBlock(bb2, i2) and
323323
flowOutOfAddressStep(use.getOperand(), nodeTo)
324324
)
325325
or
@@ -350,8 +350,8 @@ private module Cached {
350350

351351
private predicate fromReadNode(ReadNode nodeFrom, Node nodeTo) {
352352
exists(IRBlock bb1, int i1, IRBlock bb2, int i2, Use use1, Use use2 |
353-
use1.hasRankInBlock(bb1, i1) and
354-
use2.hasRankInBlock(bb2, i2) and
353+
use1.hasIndexInBlock(bb1, i1) and
354+
use2.hasIndexInBlock(bb2, i2) and
355355
use1.getOperand().getDef() = nodeFrom.getInstruction() and
356356
adjacentDefRead(_, bb1, i1, bb2, i2) and
357357
flowOutOfAddressStep(use2.getOperand(), nodeTo)
@@ -362,15 +362,15 @@ private module Cached {
362362
exists(PhiNode phi, Use use, IRBlock block, int rnk |
363363
phi = nodeFrom.getPhiNode() and
364364
adjacentDefRead(phi, _, _, block, rnk) and
365-
use.hasRankInBlock(block, rnk) and
365+
use.hasIndexInBlock(block, rnk) and
366366
flowOutOfAddressStep(use.getOperand(), nodeTo)
367367
)
368368
}
369369

370370
private predicate toPhiNode(Node nodeFrom, SsaPhiNode nodeTo) {
371371
// Flow to phi nodes
372372
exists(Def def, IRBlock block, int rnk |
373-
def.hasRankInBlock(block, rnk) and
373+
def.hasIndexInBlock(block, rnk) and
374374
nodeTo.hasInputAtRankInBlock(block, rnk)
375375
|
376376
exists(StoreNodeInstr storeNode |
@@ -503,8 +503,8 @@ private module Cached {
503503
|
504504
store = def.getInstruction() and
505505
store.getSourceValueOperand() = operand and
506-
def.hasRankInBlock(block1, rnk1) and
507-
use.hasRankInBlock(block2, rnk2) and
506+
def.hasIndexInBlock(block1, rnk1) and
507+
use.hasIndexInBlock(block2, rnk2) and
508508
adjacentDefRead(_, block1, rnk1, block2, rnk2)
509509
|
510510
// The shared SSA library has determined that `use` is the next use of the operand
@@ -534,12 +534,12 @@ private module Cached {
534534
not operand = getSourceAddressOperand(_) and
535535
exists(Use use1, Use use2, IRBlock block1, int rnk1, IRBlock block2, int rnk2 |
536536
use1.getOperand() = operand and
537-
use1.hasRankInBlock(block1, rnk1) and
537+
use1.hasIndexInBlock(block1, rnk1) and
538538
// Don't flow to the next use if this use is part of a store operation that totally
539539
// overrides a variable.
540540
not explicitWrite(true, _, use1.getOperand().getDef()) and
541541
adjacentDefRead(_, block1, rnk1, block2, rnk2) and
542-
use2.hasRankInBlock(block2, rnk2) and
542+
use2.hasIndexInBlock(block2, rnk2) and
543543
flowOutOfAddressStep(use2.getOperand(), nodeTo)
544544
)
545545
or
@@ -611,7 +611,7 @@ import Cached
611611
predicate variableWrite(IRBlock bb, int i, SourceVariable v, boolean certain) {
612612
DataFlowImplCommon::forceCachingInSameStage() and
613613
exists(Def def |
614-
def.hasRankInBlock(bb, i) and
614+
def.hasIndexInBlock(bb, i) and
615615
v = def.getSourceVariable() and
616616
(if def.isCertain() then certain = true else certain = false)
617617
)
@@ -623,7 +623,7 @@ predicate variableWrite(IRBlock bb, int i, SourceVariable v, boolean certain) {
623623
*/
624624
predicate variableRead(IRBlock bb, int i, SourceVariable v, boolean certain) {
625625
exists(Use use |
626-
use.hasRankInBlock(bb, i) and
626+
use.hasIndexInBlock(bb, i) and
627627
v = use.getSourceVariable() and
628628
certain = true
629629
)

0 commit comments

Comments
 (0)