@@ -38,13 +38,12 @@ private module Cached {
3838 TVariableNode ( Variable var ) or
3939 TPostFieldUpdateNode ( FieldAddress operand , int indirectionIndex ) {
4040 indirectionIndex =
41- [ 0 .. Ssa:: countIndirectionsForCppType ( operand .getObjectAddress ( ) .getResultLanguageType ( ) ) -
42- 1 ]
41+ [ 1 .. Ssa:: countIndirectionsForCppType ( operand .getObjectAddress ( ) .getResultLanguageType ( ) ) ]
4342 } or
4443 TSsaPhiNode ( Ssa:: PhiNode phi ) or
4544 TIndirectArgumentOutNode ( ArgumentOperand operand , int indirectionIndex ) {
4645 Ssa:: isModifiableByCall ( operand ) and
47- indirectionIndex = [ 0 .. Ssa:: countIndirectionsForCppType ( operand .getLanguageType ( ) ) - 1 ]
46+ indirectionIndex = [ 1 .. Ssa:: countIndirectionsForCppType ( operand .getLanguageType ( ) ) ]
4847 } or
4948 TIndirectOperand ( Operand op , int indirectionIndex ) {
5049 Ssa:: hasIndirectOperand ( op , indirectionIndex )
@@ -370,19 +369,15 @@ class PostFieldUpdateNode extends TPostFieldUpdateNode, PartialDefinitionNode {
370369
371370 override Declaration getEnclosingCallable ( ) { result = this .getFunction ( ) }
372371
373- override IRType getType ( ) { result = fieldAddress .getIRType ( ) }
374-
375372 FieldAddress getFieldAddress ( ) { result = fieldAddress }
376373
377374 Field getUpdatedField ( ) { result = fieldAddress .getField ( ) }
378375
379376 int getIndirectionIndex ( ) { result = indirectionIndex }
380377
381378 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.
384379 hasOperandAndIndex ( result , pragma [ only_bind_into ] ( fieldAddress ) .getObjectAddressOperand ( ) ,
385- indirectionIndex + 1 )
380+ indirectionIndex )
386381 }
387382
388383 override Expr getDefinedExpr ( ) {
@@ -536,9 +531,7 @@ class IndirectArgumentOutNode extends Node, TIndirectArgumentOutNode, PostUpdate
536531
537532 override Function getFunction ( ) { result = this .getCallInstruction ( ) .getEnclosingFunction ( ) }
538533
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 ) }
542535
543536 override string toStringImpl ( ) {
544537 // This string should be unique enough to be helpful but common enough to
@@ -1075,7 +1068,7 @@ predicate simpleLocalFlowStep(Node nodeFrom, Node nodeTo) {
10751068 store .getDestinationAddressOperand ( ) = address
10761069 )
10771070 or
1078- Ssa:: outNodeHasAddressAndIndex ( nodeFrom , address , indirectionIndex - 1 )
1071+ Ssa:: outNodeHasAddressAndIndex ( nodeFrom , address , indirectionIndex )
10791072 )
10801073}
10811074
0 commit comments