@@ -38,13 +38,12 @@ private module Cached {
38
38
TVariableNode ( Variable var ) or
39
39
TPostFieldUpdateNode ( FieldAddress operand , int indirectionIndex ) {
40
40
indirectionIndex =
41
- [ 0 .. Ssa:: countIndirectionsForCppType ( operand .getObjectAddress ( ) .getResultLanguageType ( ) ) -
42
- 1 ]
41
+ [ 1 .. Ssa:: countIndirectionsForCppType ( operand .getObjectAddress ( ) .getResultLanguageType ( ) ) ]
43
42
} or
44
43
TSsaPhiNode ( Ssa:: PhiNode phi ) or
45
44
TIndirectArgumentOutNode ( ArgumentOperand operand , int indirectionIndex ) {
46
45
Ssa:: isModifiableByCall ( operand ) and
47
- indirectionIndex = [ 0 .. Ssa:: countIndirectionsForCppType ( operand .getLanguageType ( ) ) - 1 ]
46
+ indirectionIndex = [ 1 .. Ssa:: countIndirectionsForCppType ( operand .getLanguageType ( ) ) ]
48
47
} or
49
48
TIndirectOperand ( Operand op , int indirectionIndex ) {
50
49
Ssa:: hasIndirectOperand ( op , indirectionIndex )
@@ -370,19 +369,15 @@ class PostFieldUpdateNode extends TPostFieldUpdateNode, PartialDefinitionNode {
370
369
371
370
override Declaration getEnclosingCallable ( ) { result = this .getFunction ( ) }
372
371
373
- override IRType getType ( ) { result = fieldAddress .getIRType ( ) }
374
-
375
372
FieldAddress getFieldAddress ( ) { result = fieldAddress }
376
373
377
374
Field getUpdatedField ( ) { result = fieldAddress .getField ( ) }
378
375
379
376
int getIndirectionIndex ( ) { result = indirectionIndex }
380
377
381
378
override Node getPreUpdateNode ( ) {
382
- // + 1 because we're storing into an lvalue, and the original node should be the rvalue of
383
- // the same address.
384
379
hasOperandAndIndex ( result , pragma [ only_bind_into ] ( fieldAddress ) .getObjectAddressOperand ( ) ,
385
- indirectionIndex + 1 )
380
+ indirectionIndex )
386
381
}
387
382
388
383
override Expr getDefinedExpr ( ) {
@@ -536,9 +531,7 @@ class IndirectArgumentOutNode extends Node, TIndirectArgumentOutNode, PostUpdate
536
531
537
532
override Function getFunction ( ) { result = this .getCallInstruction ( ) .getEnclosingFunction ( ) }
538
533
539
- override IRType getType ( ) { result instanceof IRVoidType }
540
-
541
- override Node getPreUpdateNode ( ) { hasOperandAndIndex ( result , operand , indirectionIndex + 1 ) }
534
+ override Node getPreUpdateNode ( ) { hasOperandAndIndex ( result , operand , indirectionIndex ) }
542
535
543
536
override string toStringImpl ( ) {
544
537
// This string should be unique enough to be helpful but common enough to
@@ -1075,7 +1068,7 @@ predicate simpleLocalFlowStep(Node nodeFrom, Node nodeTo) {
1075
1068
store .getDestinationAddressOperand ( ) = address
1076
1069
)
1077
1070
or
1078
- Ssa:: outNodeHasAddressAndIndex ( nodeFrom , address , indirectionIndex - 1 )
1071
+ Ssa:: outNodeHasAddressAndIndex ( nodeFrom , address , indirectionIndex )
1079
1072
)
1080
1073
}
1081
1074
0 commit comments