From 71482fb472f574cec4fbab892b96dc4f19212f4d Mon Sep 17 00:00:00 2001 From: Andrzej Kotulski Date: Tue, 1 Dec 2015 10:11:13 -0800 Subject: [PATCH] Refactor CompoundBinaryOperator to use same code as BinaryOperator Summary: public These two functions were doing very same things. After last refactor code of both functions started to look very similar. Reviewed By: dulmarod Differential Revision: D2707502 fb-gh-sync-id: b0559a3 --- infer/src/clang/cArithmetic_trans.ml | 87 +++++++++---------- infer/src/clang/cArithmetic_trans.mli | 3 - infer/src/clang/cTrans.ml | 42 +-------- .../arithmetic/compound_assignment.c.dot | 20 ++--- .../conditional_operator/preincrement.c.dot | 8 +- .../loops/for_condition_side_effects.c.dot | 2 +- .../c/frontend/loops/for_no_condition.c.dot | 2 +- .../loops/for_no_condition_incr.c.dot | 2 +- .../c/frontend/loops/for_simple.c.dot | 2 +- .../loops/while_with_continue_and_break.c.dot | 2 +- .../nestedoperators/nestedassignment.c.dot | 2 +- .../var_decl_inside_for.cpp.dot | 4 +- .../var_decl_inside_while.cpp.dot | 8 +- .../fast_enumeration/Fast_enumeration.dot | 4 +- 14 files changed, 71 insertions(+), 117 deletions(-) diff --git a/infer/src/clang/cArithmetic_trans.ml b/infer/src/clang/cArithmetic_trans.ml index 26c7868e6..c3db97bc7 100644 --- a/infer/src/clang/cArithmetic_trans.ml +++ b/infer/src/clang/cArithmetic_trans.ml @@ -51,6 +51,47 @@ let assignment_arc_mode context e1 typ e2 loc rhs_owning_method is_e1_decl = (e1, [retain; autorelease; assign], []) | _ -> (e1, [assign], []) +(* Returns a pair ([binary_expression], instructions) for binary operator representing a *) +(* CompoundAssignment. "binary_expression" is returned when we are calculating an expression*) +(* "instructions" is not empty when the binary operator is actually a statement like an *) +(* assignment. *) +let compound_assignment_binary_operation_instruction boi e1 typ e2 loc = + let id = Ident.create_fresh Ident.knormal in + let instr1 = Sil.Letderef (id, e1, typ, loc) in + let e_res, instr_op = match boi.Clang_ast_t.boi_kind with + | `AddAssign -> + let e1_plus_e2 = Sil.BinOp(Sil.PlusA, Sil.Var id, e2) in + (e1, [Sil.Set (e1, typ, e1_plus_e2, loc)]) + | `SubAssign -> + let e1_sub_e2 = Sil.BinOp(Sil.MinusA, Sil.Var id, e2) in + (e1, [Sil.Set (e1, typ, e1_sub_e2, loc)]) + | `MulAssign -> + let e1_mul_e2 = Sil.BinOp(Sil.Mult, Sil.Var id, e2) in + (e1, [Sil.Set (e1, typ, e1_mul_e2, loc)]) + | `DivAssign -> + let e1_div_e2 = Sil.BinOp(Sil.Div, Sil.Var id, e2) in + (e1, [Sil.Set (e1, typ, e1_div_e2, loc)]) + | `ShlAssign -> + let e1_shl_e2 = Sil.BinOp(Sil.Shiftlt, Sil.Var id, e2) in + (e1, [Sil.Set (e1, typ, e1_shl_e2, loc)]) + | `ShrAssign -> + let e1_shr_e2 = Sil.BinOp(Sil.Shiftrt, Sil.Var id, e2) in + (e1, [Sil.Set (e1, typ, e1_shr_e2, loc)]) + | `RemAssign -> + let e1_mod_e2 = Sil.BinOp(Sil.Mod, Sil.Var id, e2) in + (e1, [Sil.Set (e1, typ, e1_mod_e2, loc)]) + | `AndAssign -> + let e1_and_e2 = Sil.BinOp(Sil.BAnd, Sil.Var id, e2) in + (e1, [Sil.Set (e1, typ, e1_and_e2, loc)]) + | `OrAssign -> + let e1_or_e2 = Sil.BinOp(Sil.BOr, Sil.Var id, e2) in + (e1, [Sil.Set (e1, typ, e1_or_e2, loc)]) + | `XorAssign -> + let e1_xor_e2 = Sil.BinOp(Sil.BXor, Sil.Var id, e2) in + (e1, [Sil.Set (e1, typ, e1_xor_e2, loc)]) + | bok -> assert false in + (e_res, instr1:: instr_op, [id]) + (* Returns a pair ([binary_expression], instructions). "binary_expression" *) (* is returned when we are calculating an expression "instructions" is not *) (* empty when the binary operator is actually a statement like an *) @@ -84,7 +125,7 @@ let binary_operation_instruction context boi e1 typ e2 loc rhs_owning_method = | `Comma -> (e2, [], []) (* C99 6.5.17-2 *) | `MulAssign | `DivAssign | `RemAssign | `AddAssign | `SubAssign | `ShlAssign | `ShrAssign | `AndAssign | `XorAssign | `OrAssign -> - assert false + compound_assignment_binary_operation_instruction boi e1 typ e2 loc (* We should not get here. *) (* These should be treated by compound_assignment_binary_operation_instruction*) | bok -> @@ -93,50 +134,6 @@ let binary_operation_instruction context boi e1 typ e2 loc rhs_owning_method = (Clang_ast_j.string_of_binary_operator_kind bok); (Sil.exp_minus_one, [], []) -(* Returns a pair ([binary_expression], instructions) for binary operator representing a CompoundAssignment. *) -(* "binary_expression" is returned when we are calculating an expression*) -(* "instructions" is not empty when the binary operator is actually a statement like an assignment. *) -let compound_assignment_binary_operation_instruction boi e1 typ e2 loc = - let id = Ident.create_fresh Ident.knormal in - let instr1 = Sil.Letderef (id, e1, typ, loc) in - let e_res, instr_op = match boi.Clang_ast_t.boi_kind with - | `AddAssign -> - let e1_plus_e2 = Sil.BinOp(Sil.PlusA, Sil.Var id, e2) in - (e1, [Sil.Set (e1, typ, e1_plus_e2, loc)]) - | `SubAssign -> - let e1_sub_e2 = Sil.BinOp(Sil.MinusA, Sil.Var id, e2) in - (e1, [Sil.Set (e1, typ, e1_sub_e2, loc)]) - | `MulAssign -> - let e1_mul_e2 = Sil.BinOp(Sil.Mult, Sil.Var id, e2) in - (e1, [Sil.Set (e1, typ, e1_mul_e2, loc)]) - | `DivAssign -> - let e1_div_e2 = Sil.BinOp(Sil.Div, Sil.Var id, e2) in - (e1, [Sil.Set (e1, typ, e1_div_e2, loc)]) - | `ShlAssign -> - let e1_shl_e2 = Sil.BinOp(Sil.Shiftlt, Sil.Var id, e2) in - (e1, [Sil.Set (e1, typ, e1_shl_e2, loc)]) - | `ShrAssign -> - let e1_shr_e2 = Sil.BinOp(Sil.Shiftrt, Sil.Var id, e2) in - (e1, [Sil.Set (e1, typ, e1_shr_e2, loc)]) - | `RemAssign -> - let e1_mod_e2 = Sil.BinOp(Sil.Mod, Sil.Var id, e2) in - (e1, [Sil.Set (e1, typ, e1_mod_e2, loc)]) - | `AndAssign -> - let e1_and_e2 = Sil.BinOp(Sil.BAnd, Sil.Var id, e2) in - (e1, [Sil.Set (e1, typ, e1_and_e2, loc)]) - | `OrAssign -> - let e1_or_e2 = Sil.BinOp(Sil.BOr, Sil.Var id, e2) in - (e1, [Sil.Set (e1, typ, e1_or_e2, loc)]) - | `XorAssign -> - let e1_xor_e2 = Sil.BinOp(Sil.BXor, Sil.Var id, e2) in - (e1, [Sil.Set (e1, typ, e1_xor_e2, loc)]) - | bok -> - Printing.log_stats - "\nWARNING: Missing translation for CompoundAssignment Binary Operator Kind %s. Construct ignored...\n" - (Clang_ast_j.string_of_binary_operator_kind bok); - (Sil.exp_minus_one, []) in - ([id], e_res, instr1:: instr_op) - let unary_operation_instruction uoi e typ loc = let uok = Clang_ast_j.string_of_unary_operator_kind (uoi.Clang_ast_t.uoi_kind) in let un_exp op = diff --git a/infer/src/clang/cArithmetic_trans.mli b/infer/src/clang/cArithmetic_trans.mli index 3c9aac48c..4b2cf341e 100644 --- a/infer/src/clang/cArithmetic_trans.mli +++ b/infer/src/clang/cArithmetic_trans.mli @@ -19,9 +19,6 @@ val unary_operation_instruction : Clang_ast_t.unary_operator_info -> Sil.exp -> Sil.typ -> Location.t -> Ident.t list * Sil.exp * Sil.instr list -val compound_assignment_binary_operation_instruction : Clang_ast_t.binary_operator_info -> Sil.exp -> - Sil.typ -> Sil.exp -> Location.t -> Ident.t list * Sil.exp * Sil.instr list - val assignment_arc_mode : CContext.t -> Sil.exp -> Sil.typ -> Sil.exp -> Location.t -> bool -> bool -> Sil.exp * Sil.instr list * Ident.t list diff --git a/infer/src/clang/cTrans.ml b/infer/src/clang/cTrans.ml index 5c5a8e03d..0615fccfd 100644 --- a/infer/src/clang/cTrans.ml +++ b/infer/src/clang/cTrans.ml @@ -1382,46 +1382,6 @@ struct let loop = Clang_ast_t.WhileStmt (stmt_info, [null_stmt; cond; body']) in instruction trans_state (Clang_ast_t.CompoundStmt (stmt_info, [assign_next_object; loop])) - (* Assumption: We expect precisely 2 stmt corresponding to the 2 operands. *) - and compoundAssignOperator trans_state stmt_info binary_operator_info expr_info stmt_list = - let context = trans_state.context in - let pln = trans_state.parent_line_number in - Printing.log_out " CompoundAssignOperator '%s' .\n" - (Clang_ast_j.string_of_binary_operator_kind binary_operator_info.Clang_ast_t.boi_kind); - (* claim priority if no ancestors has claimed priority before *) - let trans_state_pri = PriorityNode.try_claim_priority_node trans_state stmt_info in - let sil_loc = CLocation.get_sil_location stmt_info pln context in - let line_number = CLocation.get_line stmt_info pln in - let sil_typ = - CTypes_decl.type_ptr_to_sil_type context.CContext.tenv expr_info.Clang_ast_t.ei_type_ptr in - (match stmt_list with - | [s1; s2] -> - let trans_state' = { trans_state_pri with succ_nodes = []; parent_line_number = line_number } in - let res_trans_s1 = instruction trans_state' s1 in - let res_trans_s2 = instruction trans_state' s2 in - let (lhs_e, lhs_typ) = extract_exp_from_list res_trans_s1.exps - "\nWARNING: Missing LHS operand in Compount Assign operator. Need Fixing.\n" in - let (sil_e2, sil_typ2) = extract_exp_from_list res_trans_s2.exps - "\nWARNING: Missing RHS operand in Compount Assign operator. Need Fixing.\n" in - let id_op, exp_op, instr_op = CArithmetic_trans.compound_assignment_binary_operation_instruction - binary_operator_info lhs_e sil_typ sil_e2 sil_loc in - let extra_deref_instrs, extra_deref_ids, exp_to_parent = - if not (PriorityNode.own_priority_node trans_state_pri.priority stmt_info) && - (* assignment operator result is lvalue in CPP, rvalue in C, hence the difference *) - not (General_utils.is_cpp_translation !CFrontend_config.language) then - let id = Ident.create_fresh Ident.knormal in - let instr = Sil.Letderef (id, lhs_e, sil_typ, sil_loc) in - [instr], [id], (Sil.Var id, sil_typ) - else [], [], (exp_op, sil_typ) in - let op_res_trans = { empty_res_trans with - ids = id_op @ extra_deref_ids; - instrs = instr_op @ extra_deref_instrs } in - let all_res_trans = [res_trans_s1; res_trans_s2; op_res_trans] in - let res_trans_to_parent = PriorityNode.compute_results_to_parent trans_state_pri - sil_loc "ComppoundAssignStmt" stmt_info all_res_trans in - { res_trans_to_parent with exps = [exp_to_parent] } - | _ -> assert false) (* Compound assign statement should have two operands*) - and initListExpr_trans trans_state var_res_trans stmt_info expr_info stmts = let var_exp, _ = extract_exp_from_list var_res_trans.exps "WARNING: InitListExpr expects one variable expression" in @@ -2044,7 +2004,7 @@ struct nullStmt_trans trans_state.succ_nodes stmt_info | CompoundAssignOperator(stmt_info, stmt_list, expr_info, binary_operator_info, caoi) -> - compoundAssignOperator trans_state stmt_info binary_operator_info expr_info stmt_list + binaryOperator_trans trans_state binary_operator_info stmt_info expr_info stmt_list | DeclStmt(stmt_info, stmt_list, decl_list) -> declStmt_trans trans_state decl_list stmt_info diff --git a/infer/tests/codetoanalyze/c/frontend/arithmetic/compound_assignment.c.dot b/infer/tests/codetoanalyze/c/frontend/arithmetic/compound_assignment.c.dot index b04cd4c67..31dcfb8c5 100644 --- a/infer/tests/codetoanalyze/c/frontend/arithmetic/compound_assignment.c.dot +++ b/infer/tests/codetoanalyze/c/frontend/arithmetic/compound_assignment.c.dot @@ -3,19 +3,19 @@ digraph iCFG { 15 -> 14 ; -14 [label="14: ComppoundAssignStmt \n n$9=*&x:double [line 12]\n *&x:double =(n$9 + 1.000000) [line 12]\n REMOVE_TEMPS(n$9); [line 12]\n " shape="box"] +14 [label="14: BinaryOperatorStmt: AddAssign \n n$9=*&x:double [line 12]\n *&x:double =(n$9 + 1.000000) [line 12]\n REMOVE_TEMPS(n$9); [line 12]\n " shape="box"] 14 -> 13 ; -13 [label="13: ComppoundAssignStmt \n n$8=*&x:double [line 13]\n *&x:double =(n$8 - 1.000000) [line 13]\n REMOVE_TEMPS(n$8); [line 13]\n " shape="box"] +13 [label="13: BinaryOperatorStmt: SubAssign \n n$8=*&x:double [line 13]\n *&x:double =(n$8 - 1.000000) [line 13]\n REMOVE_TEMPS(n$8); [line 13]\n " shape="box"] 13 -> 12 ; -12 [label="12: ComppoundAssignStmt \n n$7=*&x:double [line 14]\n *&x:double =(n$7 / 1.000000) [line 14]\n REMOVE_TEMPS(n$7); [line 14]\n " shape="box"] +12 [label="12: BinaryOperatorStmt: DivAssign \n n$7=*&x:double [line 14]\n *&x:double =(n$7 / 1.000000) [line 14]\n REMOVE_TEMPS(n$7); [line 14]\n " shape="box"] 12 -> 11 ; -11 [label="11: ComppoundAssignStmt \n n$6=*&x:double [line 15]\n *&x:double =(n$6 * 1.000000) [line 15]\n REMOVE_TEMPS(n$6); [line 15]\n NULLIFY(&x,false); [line 15]\n " shape="box"] +11 [label="11: BinaryOperatorStmt: MulAssign \n n$6=*&x:double [line 15]\n *&x:double =(n$6 * 1.000000) [line 15]\n REMOVE_TEMPS(n$6); [line 15]\n NULLIFY(&x,false); [line 15]\n " shape="box"] 11 -> 10 ; @@ -23,27 +23,27 @@ digraph iCFG { 10 -> 9 ; -9 [label="9: ComppoundAssignStmt \n n$5=*&b:int [line 17]\n *&b:int =(n$5 << 1) [line 17]\n REMOVE_TEMPS(n$5); [line 17]\n " shape="box"] +9 [label="9: BinaryOperatorStmt: ShlAssign \n n$5=*&b:int [line 17]\n *&b:int =(n$5 << 1) [line 17]\n REMOVE_TEMPS(n$5); [line 17]\n " shape="box"] 9 -> 8 ; -8 [label="8: ComppoundAssignStmt \n n$4=*&b:int [line 18]\n *&b:int =(n$4 >> 1) [line 18]\n REMOVE_TEMPS(n$4); [line 18]\n " shape="box"] +8 [label="8: BinaryOperatorStmt: ShrAssign \n n$4=*&b:int [line 18]\n *&b:int =(n$4 >> 1) [line 18]\n REMOVE_TEMPS(n$4); [line 18]\n " shape="box"] 8 -> 7 ; -7 [label="7: ComppoundAssignStmt \n n$3=*&b:int [line 19]\n *&b:int =(n$3 % 1) [line 19]\n REMOVE_TEMPS(n$3); [line 19]\n " shape="box"] +7 [label="7: BinaryOperatorStmt: RemAssing \n n$3=*&b:int [line 19]\n *&b:int =(n$3 % 1) [line 19]\n REMOVE_TEMPS(n$3); [line 19]\n " shape="box"] 7 -> 6 ; -6 [label="6: ComppoundAssignStmt \n n$2=*&b:int [line 20]\n *&b:int =(n$2 & 1) [line 20]\n REMOVE_TEMPS(n$2); [line 20]\n " shape="box"] +6 [label="6: BinaryOperatorStmt: AndAssign \n n$2=*&b:int [line 20]\n *&b:int =(n$2 & 1) [line 20]\n REMOVE_TEMPS(n$2); [line 20]\n " shape="box"] 6 -> 5 ; -5 [label="5: ComppoundAssignStmt \n n$1=*&b:int [line 21]\n *&b:int =(n$1 | 1) [line 21]\n REMOVE_TEMPS(n$1); [line 21]\n " shape="box"] +5 [label="5: BinaryOperatorStmt: OrAssign \n n$1=*&b:int [line 21]\n *&b:int =(n$1 | 1) [line 21]\n REMOVE_TEMPS(n$1); [line 21]\n " shape="box"] 5 -> 4 ; -4 [label="4: ComppoundAssignStmt \n n$0=*&b:int [line 22]\n *&b:int =(n$0 ^ 1) [line 22]\n REMOVE_TEMPS(n$0); [line 22]\n NULLIFY(&b,false); [line 22]\n " shape="box"] +4 [label="4: BinaryOperatorStmt: XorAssign \n n$0=*&b:int [line 22]\n *&b:int =(n$0 ^ 1) [line 22]\n REMOVE_TEMPS(n$0); [line 22]\n NULLIFY(&b,false); [line 22]\n " shape="box"] 4 -> 3 ; diff --git a/infer/tests/codetoanalyze/c/frontend/conditional_operator/preincrement.c.dot b/infer/tests/codetoanalyze/c/frontend/conditional_operator/preincrement.c.dot index 0a6a37128..05ccc704f 100644 --- a/infer/tests/codetoanalyze/c/frontend/conditional_operator/preincrement.c.dot +++ b/infer/tests/codetoanalyze/c/frontend/conditional_operator/preincrement.c.dot @@ -1,10 +1,10 @@ digraph iCFG { -26 [label="26: ComppoundAssignStmt \n n$12=*&p:struct s * [line 15]\n n$13=*n$12.x:int [line 15]\n *n$12.x:int =(n$13 + 1) [line 15]\n REMOVE_TEMPS(n$12,n$13); [line 15]\n " shape="box"] +26 [label="26: BinaryOperatorStmt: AddAssign \n n$12=*&p:struct s * [line 15]\n n$13=*n$12.x:int [line 15]\n *n$12.x:int =(n$13 + 1) [line 15]\n REMOVE_TEMPS(n$12,n$13); [line 15]\n " shape="box"] 26 -> 21 ; 26 -> 22 ; -25 [label="25: ComppoundAssignStmt \n n$10=*&SIL_temp_conditional___20:struct s * [line 16]\n NULLIFY(&SIL_temp_conditional___20,true); [line 16]\n n$11=*n$10.x:int [line 16]\n *n$10.x:int =(n$11 + 1) [line 16]\n REMOVE_TEMPS(n$10,n$11); [line 16]\n " shape="box"] +25 [label="25: BinaryOperatorStmt: AddAssign \n n$10=*&SIL_temp_conditional___20:struct s * [line 16]\n NULLIFY(&SIL_temp_conditional___20,true); [line 16]\n n$11=*n$10.x:int [line 16]\n *n$10.x:int =(n$11 + 1) [line 16]\n REMOVE_TEMPS(n$10,n$11); [line 16]\n " shape="box"] 25 -> 15 ; @@ -29,7 +29,7 @@ digraph iCFG { 20 -> 25 ; -19 [label="19: ComppoundAssignStmt \n n$5=*&p:struct s * [line 17]\n n$6=*&SIL_temp_conditional___14:int [line 17]\n NULLIFY(&SIL_temp_conditional___14,true); [line 17]\n n$7=*n$5.x:int [line 17]\n *n$5.x:int =(n$7 + n$6) [line 17]\n REMOVE_TEMPS(n$5,n$6,n$7); [line 17]\n " shape="box"] +19 [label="19: BinaryOperatorStmt: AddAssign \n n$5=*&p:struct s * [line 17]\n n$6=*&SIL_temp_conditional___14:int [line 17]\n NULLIFY(&SIL_temp_conditional___14,true); [line 17]\n n$7=*n$5.x:int [line 17]\n *n$5.x:int =(n$7 + n$6) [line 17]\n REMOVE_TEMPS(n$5,n$6,n$7); [line 17]\n " shape="box"] 19 -> 4 ; @@ -54,7 +54,7 @@ digraph iCFG { 14 -> 19 ; -13 [label="13: ComppoundAssignStmt \n n$2=*&SIL_temp_conditional___3:struct s * [line 18]\n NULLIFY(&SIL_temp_conditional___3,true); [line 18]\n n$3=*&SIL_temp_conditional___8:int [line 18]\n NULLIFY(&SIL_temp_conditional___8,true); [line 18]\n n$4=*n$2.x:int [line 18]\n *n$2.x:int =(n$4 + n$3) [line 18]\n REMOVE_TEMPS(n$2,n$3,n$4); [line 18]\n APPLY_ABSTRACTION; [line 18]\n " shape="box"] +13 [label="13: BinaryOperatorStmt: AddAssign \n n$2=*&SIL_temp_conditional___3:struct s * [line 18]\n NULLIFY(&SIL_temp_conditional___3,true); [line 18]\n n$3=*&SIL_temp_conditional___8:int [line 18]\n NULLIFY(&SIL_temp_conditional___8,true); [line 18]\n n$4=*n$2.x:int [line 18]\n *n$2.x:int =(n$4 + n$3) [line 18]\n REMOVE_TEMPS(n$2,n$3,n$4); [line 18]\n APPLY_ABSTRACTION; [line 18]\n " shape="box"] 13 -> 2 ; diff --git a/infer/tests/codetoanalyze/c/frontend/loops/for_condition_side_effects.c.dot b/infer/tests/codetoanalyze/c/frontend/loops/for_condition_side_effects.c.dot index 1d39169f7..9110984d4 100644 --- a/infer/tests/codetoanalyze/c/frontend/loops/for_condition_side_effects.c.dot +++ b/infer/tests/codetoanalyze/c/frontend/loops/for_condition_side_effects.c.dot @@ -7,7 +7,7 @@ digraph iCFG { 11 -> 5 ; -10 [label="10: ComppoundAssignStmt \n n$2=*&j:int [line 14]\n n$3=*&j:int [line 14]\n *&j:int =(n$3 + n$2) [line 14]\n REMOVE_TEMPS(n$2,n$3); [line 14]\n " shape="box"] +10 [label="10: BinaryOperatorStmt: AddAssign \n n$2=*&j:int [line 14]\n n$3=*&j:int [line 14]\n *&j:int =(n$3 + n$2) [line 14]\n REMOVE_TEMPS(n$2,n$3); [line 14]\n " shape="box"] 10 -> 6 ; diff --git a/infer/tests/codetoanalyze/c/frontend/loops/for_no_condition.c.dot b/infer/tests/codetoanalyze/c/frontend/loops/for_no_condition.c.dot index 5c38bdc12..9be8b6dc3 100644 --- a/infer/tests/codetoanalyze/c/frontend/loops/for_no_condition.c.dot +++ b/infer/tests/codetoanalyze/c/frontend/loops/for_no_condition.c.dot @@ -3,7 +3,7 @@ digraph iCFG { 10 -> 5 ; -9 [label="9: ComppoundAssignStmt \n n$1=*&j:int [line 13]\n n$2=*&j:int [line 13]\n *&j:int =(n$2 + n$1) [line 13]\n REMOVE_TEMPS(n$1,n$2); [line 13]\n " shape="box"] +9 [label="9: BinaryOperatorStmt: AddAssign \n n$1=*&j:int [line 13]\n n$2=*&j:int [line 13]\n *&j:int =(n$2 + n$1) [line 13]\n REMOVE_TEMPS(n$1,n$2); [line 13]\n " shape="box"] 9 -> 6 ; diff --git a/infer/tests/codetoanalyze/c/frontend/loops/for_no_condition_incr.c.dot b/infer/tests/codetoanalyze/c/frontend/loops/for_no_condition_incr.c.dot index bed84a262..77e6a048d 100644 --- a/infer/tests/codetoanalyze/c/frontend/loops/for_no_condition_incr.c.dot +++ b/infer/tests/codetoanalyze/c/frontend/loops/for_no_condition_incr.c.dot @@ -3,7 +3,7 @@ digraph iCFG { 9 -> 5 ; -8 [label="8: ComppoundAssignStmt \n n$0=*&j:int [line 13]\n n$1=*&j:int [line 13]\n *&j:int =(n$1 + n$0) [line 13]\n REMOVE_TEMPS(n$0,n$1); [line 13]\n APPLY_ABSTRACTION; [line 13]\n " shape="box"] +8 [label="8: BinaryOperatorStmt: AddAssign \n n$0=*&j:int [line 13]\n n$1=*&j:int [line 13]\n *&j:int =(n$1 + n$0) [line 13]\n REMOVE_TEMPS(n$0,n$1); [line 13]\n APPLY_ABSTRACTION; [line 13]\n " shape="box"] 8 -> 4 ; diff --git a/infer/tests/codetoanalyze/c/frontend/loops/for_simple.c.dot b/infer/tests/codetoanalyze/c/frontend/loops/for_simple.c.dot index 03bd23456..f38f18d3b 100644 --- a/infer/tests/codetoanalyze/c/frontend/loops/for_simple.c.dot +++ b/infer/tests/codetoanalyze/c/frontend/loops/for_simple.c.dot @@ -3,7 +3,7 @@ digraph iCFG { 11 -> 5 ; -10 [label="10: ComppoundAssignStmt \n n$2=*&j:int [line 13]\n n$3=*&j:int [line 13]\n *&j:int =(n$3 + n$2) [line 13]\n REMOVE_TEMPS(n$2,n$3); [line 13]\n " shape="box"] +10 [label="10: BinaryOperatorStmt: AddAssign \n n$2=*&j:int [line 13]\n n$3=*&j:int [line 13]\n *&j:int =(n$3 + n$2) [line 13]\n REMOVE_TEMPS(n$2,n$3); [line 13]\n " shape="box"] 10 -> 6 ; diff --git a/infer/tests/codetoanalyze/c/frontend/loops/while_with_continue_and_break.c.dot b/infer/tests/codetoanalyze/c/frontend/loops/while_with_continue_and_break.c.dot index 03e99de1f..f699cc3ea 100644 --- a/infer/tests/codetoanalyze/c/frontend/loops/while_with_continue_and_break.c.dot +++ b/infer/tests/codetoanalyze/c/frontend/loops/while_with_continue_and_break.c.dot @@ -3,7 +3,7 @@ digraph iCFG { 19 -> 4 ; -18 [label="18: ComppoundAssignStmt \n n$2=*&x:int [line 14]\n *&x:int =(n$2 + 1) [line 14]\n REMOVE_TEMPS(n$2); [line 14]\n " shape="box"] +18 [label="18: BinaryOperatorStmt: AddAssign \n n$2=*&x:int [line 14]\n *&x:int =(n$2 + 1) [line 14]\n REMOVE_TEMPS(n$2); [line 14]\n " shape="box"] 18 -> 15 ; diff --git a/infer/tests/codetoanalyze/c/frontend/nestedoperators/nestedassignment.c.dot b/infer/tests/codetoanalyze/c/frontend/nestedoperators/nestedassignment.c.dot index ee850b21c..c6be6eb01 100644 --- a/infer/tests/codetoanalyze/c/frontend/nestedoperators/nestedassignment.c.dot +++ b/infer/tests/codetoanalyze/c/frontend/nestedoperators/nestedassignment.c.dot @@ -11,7 +11,7 @@ digraph iCFG { 7 -> 6 ; -6 [label="6: ComppoundAssignStmt \n n$9=*&x:double [line 15]\n *&x:double =(n$9 + 7) [line 15]\n REMOVE_TEMPS(n$9); [line 15]\n " shape="box"] +6 [label="6: BinaryOperatorStmt: AddAssign \n n$9=*&x:double [line 15]\n *&x:double =(n$9 + 7) [line 15]\n REMOVE_TEMPS(n$9); [line 15]\n " shape="box"] 6 -> 5 ; diff --git a/infer/tests/codetoanalyze/cpp/frontend/nestedoperators/var_decl_inside_for.cpp.dot b/infer/tests/codetoanalyze/cpp/frontend/nestedoperators/var_decl_inside_for.cpp.dot index 189c1fb32..2f014459c 100644 --- a/infer/tests/codetoanalyze/cpp/frontend/nestedoperators/var_decl_inside_for.cpp.dot +++ b/infer/tests/codetoanalyze/cpp/frontend/nestedoperators/var_decl_inside_for.cpp.dot @@ -3,7 +3,7 @@ digraph iCFG { 20 -> 14 ; -19 [label="19: ComppoundAssignStmt \n n$3=*&x:int [line 20]\n n$4=*&result:int [line 20]\n *&result:int =(n$4 + n$3) [line 20]\n REMOVE_TEMPS(n$3,n$4); [line 20]\n NULLIFY(&x,false); [line 20]\n " shape="box"] +19 [label="19: BinaryOperatorStmt: AddAssign \n n$3=*&x:int [line 20]\n n$4=*&result:int [line 20]\n *&result:int =(n$4 + n$3) [line 20]\n REMOVE_TEMPS(n$3,n$4); [line 20]\n NULLIFY(&x,false); [line 20]\n " shape="box"] 19 -> 15 ; @@ -43,7 +43,7 @@ digraph iCFG { 10 -> 4 ; -9 [label="9: ComppoundAssignStmt \n n$2=*&x:int [line 13]\n n$3=*&result:int [line 13]\n *&result:int =(n$3 + n$2) [line 13]\n REMOVE_TEMPS(n$2,n$3); [line 13]\n NULLIFY(&x,false); [line 13]\n " shape="box"] +9 [label="9: BinaryOperatorStmt: AddAssign \n n$2=*&x:int [line 13]\n n$3=*&result:int [line 13]\n *&result:int =(n$3 + n$2) [line 13]\n REMOVE_TEMPS(n$2,n$3); [line 13]\n NULLIFY(&x,false); [line 13]\n " shape="box"] 9 -> 5 ; diff --git a/infer/tests/codetoanalyze/cpp/frontend/nestedoperators/var_decl_inside_while.cpp.dot b/infer/tests/codetoanalyze/cpp/frontend/nestedoperators/var_decl_inside_while.cpp.dot index 0e2f89f94..a5b362966 100644 --- a/infer/tests/codetoanalyze/cpp/frontend/nestedoperators/var_decl_inside_while.cpp.dot +++ b/infer/tests/codetoanalyze/cpp/frontend/nestedoperators/var_decl_inside_while.cpp.dot @@ -7,11 +7,11 @@ digraph iCFG { 27 -> 15 ; -26 [label="26: ComppoundAssignStmt \n n$5=*&a:int [line 24]\n n$6=*&result:int [line 24]\n *&result:int =(n$6 + n$5) [line 24]\n REMOVE_TEMPS(n$5,n$6); [line 24]\n NULLIFY(&a,false); [line 24]\n " shape="box"] +26 [label="26: BinaryOperatorStmt: AddAssign \n n$5=*&a:int [line 24]\n n$6=*&result:int [line 24]\n *&result:int =(n$6 + n$5) [line 24]\n REMOVE_TEMPS(n$5,n$6); [line 24]\n NULLIFY(&a,false); [line 24]\n " shape="box"] 26 -> 25 ; -25 [label="25: ComppoundAssignStmt \n n$4=*&x:int [line 25]\n *&x:int =(n$4 - 1) [line 25]\n REMOVE_TEMPS(n$4); [line 25]\n APPLY_ABSTRACTION; [line 25]\n " shape="box"] +25 [label="25: BinaryOperatorStmt: SubAssign \n n$4=*&x:int [line 25]\n *&x:int =(n$4 - 1) [line 25]\n REMOVE_TEMPS(n$4); [line 25]\n APPLY_ABSTRACTION; [line 25]\n " shape="box"] 25 -> 15 ; @@ -76,11 +76,11 @@ digraph iCFG { 10 -> 4 ; -9 [label="9: ComppoundAssignStmt \n n$3=*&a:int [line 14]\n n$4=*&result:int [line 14]\n *&result:int =(n$4 + n$3) [line 14]\n REMOVE_TEMPS(n$3,n$4); [line 14]\n NULLIFY(&a,false); [line 14]\n " shape="box"] +9 [label="9: BinaryOperatorStmt: AddAssign \n n$3=*&a:int [line 14]\n n$4=*&result:int [line 14]\n *&result:int =(n$4 + n$3) [line 14]\n REMOVE_TEMPS(n$3,n$4); [line 14]\n NULLIFY(&a,false); [line 14]\n " shape="box"] 9 -> 8 ; -8 [label="8: ComppoundAssignStmt \n n$2=*&x:int [line 15]\n *&x:int =(n$2 - 1) [line 15]\n REMOVE_TEMPS(n$2); [line 15]\n APPLY_ABSTRACTION; [line 15]\n " shape="box"] +8 [label="8: BinaryOperatorStmt: SubAssign \n n$2=*&x:int [line 15]\n *&x:int =(n$2 - 1) [line 15]\n REMOVE_TEMPS(n$2); [line 15]\n APPLY_ABSTRACTION; [line 15]\n " shape="box"] 8 -> 4 ; diff --git a/infer/tests/codetoanalyze/objc/frontend/fast_enumeration/Fast_enumeration.dot b/infer/tests/codetoanalyze/objc/frontend/fast_enumeration/Fast_enumeration.dot index 437e2459a..d5af0af65 100644 --- a/infer/tests/codetoanalyze/objc/frontend/fast_enumeration/Fast_enumeration.dot +++ b/infer/tests/codetoanalyze/objc/frontend/fast_enumeration/Fast_enumeration.dot @@ -7,7 +7,7 @@ digraph iCFG { 20 -> 15 ; -19 [label="19: ComppoundAssignStmt \n n$13=*&item:class NSArray * [line 29]\n n$14=_fun_NSArray_count(n$13:class NSArray *) virtual [line 29]\n n$15=*&size:int [line 29]\n *&size:int =(n$15 + n$14) [line 29]\n REMOVE_TEMPS(n$13,n$14,n$15); [line 29]\n NULLIFY(&item,false); [line 29]\n APPLY_ABSTRACTION; [line 29]\n " shape="box"] +19 [label="19: BinaryOperatorStmt: AddAssign \n n$13=*&item:class NSArray * [line 29]\n n$14=_fun_NSArray_count(n$13:class NSArray *) virtual [line 29]\n n$15=*&size:int [line 29]\n *&size:int =(n$15 + n$14) [line 29]\n REMOVE_TEMPS(n$13,n$14,n$15); [line 29]\n NULLIFY(&item,false); [line 29]\n APPLY_ABSTRACTION; [line 29]\n " shape="box"] 19 -> 15 ; @@ -47,7 +47,7 @@ digraph iCFG { 10 -> 4 ; -9 [label="9: ComppoundAssignStmt \n n$4=*&item:class NSArray * [line 20]\n n$5=_fun_NSArray_count(n$4:class NSArray *) virtual [line 20]\n n$6=*&size:int [line 20]\n *&size:int =(n$6 + n$5) [line 20]\n REMOVE_TEMPS(n$4,n$5,n$6); [line 20]\n NULLIFY(&item,false); [line 20]\n " shape="box"] +9 [label="9: BinaryOperatorStmt: AddAssign \n n$4=*&item:class NSArray * [line 20]\n n$5=_fun_NSArray_count(n$4:class NSArray *) virtual [line 20]\n n$6=*&size:int [line 20]\n *&size:int =(n$6 + n$5) [line 20]\n REMOVE_TEMPS(n$4,n$5,n$6); [line 20]\n NULLIFY(&item,false); [line 20]\n " shape="box"] 9 -> 8 ;