diff --git a/infer/src/clang/cTrans.ml b/infer/src/clang/cTrans.ml index 5339fa349..ee88d6426 100644 --- a/infer/src/clang/cTrans.ml +++ b/infer/src/clang/cTrans.ml @@ -485,9 +485,10 @@ struct let ids = pre_trans_result.ids @ deref_ids in { pre_trans_result with ids; instrs; exps = [(exp, field_typ)] } - let method_deref_trans trans_state pre_trans_result decl_ref = + let method_deref_trans trans_state pre_trans_result decl_ref stmt_info decl_kind = let open CContext in let context = trans_state.context in + let sil_loc = CLocation.get_sil_location stmt_info context in let name_info, decl_ptr, type_ptr = get_info_from_decl_ref decl_ref in let method_name = Ast_utils.get_unqualified_name name_info in let class_name = Ast_utils.get_class_name_from_member name_info in @@ -500,21 +501,27 @@ struct let is_cpp_virtual = match ms_opt with | Some ms -> CMethod_signature.ms_is_cpp_virtual ms | _ -> false in - let extra_exps = if is_instance_method then ( + let extra_exps, extra_ids, extra_instrs = if is_instance_method then ( (* pre_trans_result.exps may contain expr for 'this' parameter:*) (* if it comes from CXXMemberCallExpr it will be there *) (* if it comes from CXXOperatorCallExpr it won't be there and will be added later *) (* In case of CXXMemberCallExpr it's possible that type of 'this' parameter *) (* won't have a pointer - if that happens add a pointer to type of the object *) match pre_trans_result.exps with - | [] -> [] - | [(_, Sil.Tptr _ )] -> pre_trans_result.exps - | [(sil, typ)] -> [(sil, Sil.Tptr (typ, Sil.Pk_reference))] + | [] -> [], [], [] + (* We need to add a dereference before a method call to find null dereferences when *) + (* calling a method with null *) + | [(exp, Sil.Tptr (typ, _) )] when decl_kind <> `CXXConstructor -> + let typ = CTypes.expand_structured_type context.tenv typ in + let extra_ids, extra_instrs, _ = CTrans_utils.dereference_var_sil (exp, typ) sil_loc in + pre_trans_result.exps, extra_ids, extra_instrs + | [(_, Sil.Tptr _ )] -> pre_trans_result.exps, [], [] + | [(sil, typ)] -> [(sil, Sil.Tptr (typ, Sil.Pk_reference))], [], [] | _ -> assert false ) else (* don't add 'this' expression for static methods *) - [] in + [], [], [] in (* consider using context.CContext.is_callee_expression to deal with pointers to methods? *) (* unlike field access, for method calls there is no need to expand class type *) let pname = CMethod_trans.create_procdesc_with_pointer context decl_ptr (Some class_name) @@ -522,9 +529,12 @@ struct let method_exp = (Sil.Const (Sil.Cfun pname), method_typ) in Cfg.set_procname_priority context.CContext.cfg pname; { pre_trans_result with - exps = [method_exp] @ extra_exps; is_cpp_call_virtual = is_cpp_virtual } + is_cpp_call_virtual = is_cpp_virtual; + exps = [method_exp] @ extra_exps; + instrs = pre_trans_result.instrs @ extra_instrs; + ids = pre_trans_result.ids @ extra_ids } - let destructor_deref_trans trans_state pvar_trans_result class_type_ptr = + let destructor_deref_trans trans_state pvar_trans_result class_type_ptr si = let open Clang_ast_t in let destruct_decl_ref_opt = match Ast_utils.get_decl_from_typ_ptr class_type_ptr with | Some CXXRecordDecl (_, _, _ , _, _, _, _, cxx_record_info) @@ -532,7 +542,7 @@ struct cxx_record_info.xrdi_destructor | _ -> None in match destruct_decl_ref_opt with - | Some decl_ref -> method_deref_trans trans_state pvar_trans_result decl_ref + | Some decl_ref -> method_deref_trans trans_state pvar_trans_result decl_ref si `CXXDestructor | None -> empty_res_trans let this_expr_trans trans_state sil_loc class_type_ptr = @@ -571,8 +581,8 @@ struct | `Function -> function_deref_trans trans_state decl_ref | `Var | `ImplicitParam | `ParmVar -> var_deref_trans trans_state stmt_info decl_ref | `Field | `ObjCIvar -> field_deref_trans trans_state stmt_info pre_trans_result decl_ref - | `CXXMethod | `CXXConstructor | `CXXConversion -> - method_deref_trans trans_state pre_trans_result decl_ref + | `CXXMethod | `CXXConversion | `CXXConstructor -> + method_deref_trans trans_state pre_trans_result decl_ref stmt_info decl_kind | _ -> let print_error decl_kind = Printing.log_stats @@ -902,7 +912,7 @@ struct and cxx_destructor_call_trans trans_state si this_res_trans class_type_ptr = let trans_state_pri = PriorityNode.try_claim_priority_node trans_state si in - let res_trans_callee = destructor_deref_trans trans_state this_res_trans class_type_ptr in + let res_trans_callee = destructor_deref_trans trans_state this_res_trans class_type_ptr si in let is_cpp_call_virtual = res_trans_callee.is_cpp_call_virtual in if res_trans_callee.exps <> [] then cxx_method_construct_call_trans trans_state_pri res_trans_callee [] si Sil.Tvoid diff --git a/infer/src/clang/cTrans_utils.mli b/infer/src/clang/cTrans_utils.mli index 2a70c1e20..d92b04c69 100644 --- a/infer/src/clang/cTrans_utils.mli +++ b/infer/src/clang/cTrans_utils.mli @@ -109,6 +109,8 @@ val cast_trans : CContext.t -> (Sil.exp * Sil.typ) list -> Location.t -> Procname.t option -> Sil.typ -> (Ident.t * Sil.instr * Sil.exp) option +val dereference_var_sil : Sil.exp * Sil.typ -> Location.t -> Ident.t list * Sil.instr list * Sil.exp + (** Module for creating cfg nodes and other utility functions related to them. *) module Nodes : sig diff --git a/infer/tests/codetoanalyze/cpp/errors/npe/method_call.cpp b/infer/tests/codetoanalyze/cpp/errors/npe/method_call.cpp new file mode 100644 index 000000000..69896d4fc --- /dev/null +++ b/infer/tests/codetoanalyze/cpp/errors/npe/method_call.cpp @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2016 - present Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +struct X { + int f; + int call() { return 1; } +}; + +int npe_call() { + X* x = nullptr; + return x->call(); +} + +X* getX() { return nullptr; } + +void npe_call_after_call() { getX()->call(); } + +struct XForward; + +struct Y { + XForward* x; +}; + +struct XForward { + int call() { return 0; } + int f; +}; + +void call_with_forward_declaration(XForward* x) { x->call(); } + +void npe_call_with_forward_declaration() { + call_with_forward_declaration(nullptr); +} diff --git a/infer/tests/codetoanalyze/cpp/errors/npe/method_call.cpp.dot b/infer/tests/codetoanalyze/cpp/errors/npe/method_call.cpp.dot new file mode 100644 index 000000000..b10973fc2 --- /dev/null +++ b/infer/tests/codetoanalyze/cpp/errors/npe/method_call.cpp.dot @@ -0,0 +1,83 @@ +digraph iCFG { +22 [label="22: Call _fun_call_with_forward_declaration \n _fun_call_with_forward_declaration(null:class XForward *) [line 38]\n APPLY_ABSTRACTION; [line 38]\n " shape="box"] + + + 22 -> 21 ; +21 [label="21: Exit npe_call_with_forward_declaration \n " color=yellow style=filled] + + +20 [label="20: Start npe_call_with_forward_declaration\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 37]\n " color=yellow style=filled] + + + 20 -> 22 ; +19 [label="19: Call _fun_XForward_call \n n$0=*&x:class XForward * [line 35]\n n$1=*n$0:class XForward [line 35]\n n$2=_fun_XForward_call(n$0:class XForward *) [line 35]\n REMOVE_TEMPS(n$0,n$1,n$2); [line 35]\n NULLIFY(&x,false); [line 35]\n APPLY_ABSTRACTION; [line 35]\n " shape="box"] + + + 19 -> 18 ; +18 [label="18: Exit call_with_forward_declaration \n " color=yellow style=filled] + + +17 [label="17: Start call_with_forward_declaration\nFormals: x:class XForward *\nLocals: \n DECLARE_LOCALS(&return); [line 35]\n " color=yellow style=filled] + + + 17 -> 19 ; +16 [label="16: Return Stmt \n *&return:int =0 [line 31]\n APPLY_ABSTRACTION; [line 31]\n " shape="box"] + + + 16 -> 15 ; +15 [label="15: Exit XForward_call \n " color=yellow style=filled] + + +14 [label="14: Start XForward_call\nFormals: this:class XForward *\nLocals: \n DECLARE_LOCALS(&return); [line 31]\n NULLIFY(&this,false); [line 31]\n " color=yellow style=filled] + + + 14 -> 16 ; +13 [label="13: Call _fun_X_call \n n$0=_fun_getX() [line 22]\n n$1=*n$0:class X [line 22]\n n$2=_fun_X_call(n$0:class X *) [line 22]\n REMOVE_TEMPS(n$0,n$1,n$2); [line 22]\n APPLY_ABSTRACTION; [line 22]\n " shape="box"] + + + 13 -> 12 ; +12 [label="12: Exit npe_call_after_call \n " color=yellow style=filled] + + +11 [label="11: Start npe_call_after_call\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 22]\n " color=yellow style=filled] + + + 11 -> 13 ; +10 [label="10: Return Stmt \n *&return:class X *=null [line 20]\n APPLY_ABSTRACTION; [line 20]\n " shape="box"] + + + 10 -> 9 ; +9 [label="9: Exit getX \n " color=yellow style=filled] + + +8 [label="8: Start getX\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 20]\n " color=yellow style=filled] + + + 8 -> 10 ; +7 [label="7: DeclStmt \n *&x:class X *=null [line 16]\n " shape="box"] + + + 7 -> 6 ; +6 [label="6: Return Stmt \n n$0=*&x:class X * [line 17]\n n$1=*n$0:class X [line 17]\n n$2=_fun_X_call(n$0:class X *) [line 17]\n *&return:int =n$2 [line 17]\n REMOVE_TEMPS(n$0,n$1,n$2); [line 17]\n NULLIFY(&x,false); [line 17]\n APPLY_ABSTRACTION; [line 17]\n " shape="box"] + + + 6 -> 5 ; +5 [label="5: Exit npe_call \n " color=yellow style=filled] + + +4 [label="4: Start npe_call\nFormals: \nLocals: x:class X * \n DECLARE_LOCALS(&return,&x); [line 15]\n NULLIFY(&x,false); [line 15]\n " color=yellow style=filled] + + + 4 -> 7 ; +3 [label="3: Return Stmt \n *&return:int =1 [line 12]\n APPLY_ABSTRACTION; [line 12]\n " shape="box"] + + + 3 -> 2 ; +2 [label="2: Exit X_call \n " color=yellow style=filled] + + +1 [label="1: Start X_call\nFormals: this:class X *\nLocals: \n DECLARE_LOCALS(&return); [line 12]\n NULLIFY(&this,false); [line 12]\n " color=yellow style=filled] + + + 1 -> 3 ; +} diff --git a/infer/tests/codetoanalyze/cpp/frontend/constructors/constructor_with_body.cpp.dot b/infer/tests/codetoanalyze/cpp/frontend/constructors/constructor_with_body.cpp.dot index 0c59bbbf8..0c095c9fd 100644 --- a/infer/tests/codetoanalyze/cpp/frontend/constructors/constructor_with_body.cpp.dot +++ b/infer/tests/codetoanalyze/cpp/frontend/constructors/constructor_with_body.cpp.dot @@ -3,7 +3,7 @@ digraph iCFG { 26 -> 25 ; -25 [label="25: Call _fun_X_div \n n$0=_fun_X_div(&x:class X &) [line 40]\n REMOVE_TEMPS(n$0); [line 40]\n NULLIFY(&x,false); [line 40]\n APPLY_ABSTRACTION; [line 40]\n " shape="box"] +25 [label="25: Call _fun_X_div \n n$0=*&x:class X [line 40]\n n$1=_fun_X_div(&x:class X &) [line 40]\n REMOVE_TEMPS(n$0,n$1); [line 40]\n NULLIFY(&x,false); [line 40]\n APPLY_ABSTRACTION; [line 40]\n " shape="box"] 25 -> 24 ; @@ -18,7 +18,7 @@ digraph iCFG { 22 -> 21 ; -21 [label="21: Call _fun_X_div \n n$0=_fun_X_div(&x:class X &) [line 35]\n REMOVE_TEMPS(n$0); [line 35]\n NULLIFY(&x,false); [line 35]\n APPLY_ABSTRACTION; [line 35]\n " shape="box"] +21 [label="21: Call _fun_X_div \n n$0=*&x:class X [line 35]\n n$1=_fun_X_div(&x:class X &) [line 35]\n REMOVE_TEMPS(n$0,n$1); [line 35]\n NULLIFY(&x,false); [line 35]\n APPLY_ABSTRACTION; [line 35]\n " shape="box"] 21 -> 20 ; @@ -33,7 +33,7 @@ digraph iCFG { 18 -> 17 ; -17 [label="17: Call _fun_X_div \n n$0=_fun_X_div(&x:class X &) [line 30]\n REMOVE_TEMPS(n$0); [line 30]\n NULLIFY(&x,false); [line 30]\n APPLY_ABSTRACTION; [line 30]\n " shape="box"] +17 [label="17: Call _fun_X_div \n n$0=*&x:class X [line 30]\n n$1=_fun_X_div(&x:class X &) [line 30]\n REMOVE_TEMPS(n$0,n$1); [line 30]\n NULLIFY(&x,false); [line 30]\n APPLY_ABSTRACTION; [line 30]\n " shape="box"] 17 -> 16 ; @@ -44,11 +44,11 @@ digraph iCFG { 15 -> 18 ; -14 [label="14: DeclStmt \n n$3=*&a:int [line 23]\n n$4=*&b:int [line 23]\n *&c:int =(n$3 + n$4) [line 23]\n REMOVE_TEMPS(n$3,n$4); [line 23]\n NULLIFY(&a,false); [line 23]\n NULLIFY(&b,false); [line 23]\n " shape="box"] +14 [label="14: DeclStmt \n n$4=*&a:int [line 23]\n n$5=*&b:int [line 23]\n *&c:int =(n$4 + n$5) [line 23]\n REMOVE_TEMPS(n$4,n$5); [line 23]\n NULLIFY(&a,false); [line 23]\n NULLIFY(&b,false); [line 23]\n " shape="box"] 14 -> 13 ; -13 [label="13: Call _fun_X_init \n n$2=*&this:class X * [line 24]\n _fun_X_init(n$2:class X *) [line 24]\n REMOVE_TEMPS(n$2); [line 24]\n " shape="box"] +13 [label="13: Call _fun_X_init \n n$2=*&this:class X * [line 24]\n n$3=*n$2:class X [line 24]\n _fun_X_init(n$2:class X *) [line 24]\n REMOVE_TEMPS(n$2,n$3); [line 24]\n " shape="box"] 13 -> 12 ; @@ -74,7 +74,7 @@ digraph iCFG { 7 -> 9 ; -6 [label="6: Call _fun_X_init \n n$0=*&this:class X * [line 15]\n _fun_X_init(n$0:class X *) [line 15]\n REMOVE_TEMPS(n$0); [line 15]\n NULLIFY(&this,false); [line 15]\n APPLY_ABSTRACTION; [line 15]\n " shape="box"] +6 [label="6: Call _fun_X_init \n n$0=*&this:class X * [line 15]\n n$1=*n$0:class X [line 15]\n _fun_X_init(n$0:class X *) [line 15]\n REMOVE_TEMPS(n$0,n$1); [line 15]\n NULLIFY(&this,false); [line 15]\n APPLY_ABSTRACTION; [line 15]\n " shape="box"] 6 -> 5 ; diff --git a/infer/tests/codetoanalyze/cpp/frontend/constructors/temp_object.cpp.dot b/infer/tests/codetoanalyze/cpp/frontend/constructors/temp_object.cpp.dot index 72d1747ab..7105f6f59 100644 --- a/infer/tests/codetoanalyze/cpp/frontend/constructors/temp_object.cpp.dot +++ b/infer/tests/codetoanalyze/cpp/frontend/constructors/temp_object.cpp.dot @@ -76,18 +76,18 @@ digraph iCFG { 23 -> 25 ; -22 [label="22: DeclStmt \n _fun_X_X(&SIL_materialize_temp__n$1:class X *,0:int ,1:int ) [line 27]\n _fun_X_X(&x:class X *,&SIL_materialize_temp__n$1:class X &) [line 27]\n " shape="box"] +22 [label="22: DeclStmt \n _fun_X_X(&SIL_materialize_temp__n$2:class X *,0:int ,1:int ) [line 27]\n _fun_X_X(&x:class X *,&SIL_materialize_temp__n$2:class X &) [line 27]\n " shape="box"] 22 -> 21 ; -21 [label="21: Return Stmt \n n$0=_fun_X_div(&x:class X &) [line 28]\n *&return:int =n$0 [line 28]\n REMOVE_TEMPS(n$0); [line 28]\n NULLIFY(&SIL_materialize_temp__n$1,false); [line 28]\n NULLIFY(&x,false); [line 28]\n APPLY_ABSTRACTION; [line 28]\n " shape="box"] +21 [label="21: Return Stmt \n n$0=*&x:class X [line 28]\n n$1=_fun_X_div(&x:class X &) [line 28]\n *&return:int =n$1 [line 28]\n REMOVE_TEMPS(n$0,n$1); [line 28]\n NULLIFY(&SIL_materialize_temp__n$2,false); [line 28]\n NULLIFY(&x,false); [line 28]\n APPLY_ABSTRACTION; [line 28]\n " shape="box"] 21 -> 20 ; 20 [label="20: Exit assign_temp_div0 \n " color=yellow style=filled] -19 [label="19: Start assign_temp_div0\nFormals: \nLocals: x:class X SIL_materialize_temp__n$1:class X \n DECLARE_LOCALS(&return,&x,&SIL_materialize_temp__n$1); [line 26]\n " color=yellow style=filled] +19 [label="19: Start assign_temp_div0\nFormals: \nLocals: x:class X SIL_materialize_temp__n$2:class X \n DECLARE_LOCALS(&return,&x,&SIL_materialize_temp__n$2); [line 26]\n " color=yellow style=filled] 19 -> 22 ; diff --git a/infer/tests/codetoanalyze/cpp/frontend/destructors/call_on_delete.cpp.dot b/infer/tests/codetoanalyze/cpp/frontend/destructors/call_on_delete.cpp.dot index 0a4104c95..3a226f345 100644 --- a/infer/tests/codetoanalyze/cpp/frontend/destructors/call_on_delete.cpp.dot +++ b/infer/tests/codetoanalyze/cpp/frontend/destructors/call_on_delete.cpp.dot @@ -10,7 +10,7 @@ digraph iCFG { 6 -> 8 ; -5 [label="5: Call delete \n n$0=*&x:class X * [line 14]\n _fun_X_~X(n$0:class X *) [line 14]\n _fun___delete(n$0:class X *) [line 14]\n REMOVE_TEMPS(n$0); [line 14]\n NULLIFY(&x,false); [line 14]\n APPLY_ABSTRACTION; [line 14]\n " shape="box"] +5 [label="5: Call delete \n n$0=*&x:class X * [line 14]\n n$1=*n$0:class X [line 14]\n _fun_X_~X(n$0:class X *) [line 14]\n _fun___delete(n$0:class X *) [line 14]\n REMOVE_TEMPS(n$0,n$1); [line 14]\n NULLIFY(&x,false); [line 14]\n APPLY_ABSTRACTION; [line 14]\n " shape="box"] 5 -> 4 ; diff --git a/infer/tests/codetoanalyze/cpp/frontend/include_header/include_templ.cpp.dot b/infer/tests/codetoanalyze/cpp/frontend/include_header/include_templ.cpp.dot index fdd1bb736..afd66ddbc 100644 --- a/infer/tests/codetoanalyze/cpp/frontend/include_header/include_templ.cpp.dot +++ b/infer/tests/codetoanalyze/cpp/frontend/include_header/include_templ.cpp.dot @@ -25,7 +25,7 @@ digraph iCFG { 30 -> 29 ; -29 [label="29: Call _fun_B_div0 \n n$0=_fun_B_div0(&b:class B &) [line 20]\n REMOVE_TEMPS(n$0); [line 20]\n NULLIFY(&b,false); [line 20]\n APPLY_ABSTRACTION; [line 20]\n " shape="box"] +29 [label="29: Call _fun_B_div0 \n n$0=*&b:class B [line 20]\n n$1=_fun_B_div0(&b:class B &) [line 20]\n REMOVE_TEMPS(n$0,n$1); [line 20]\n NULLIFY(&b,false); [line 20]\n APPLY_ABSTRACTION; [line 20]\n " shape="box"] 29 -> 28 ; @@ -40,7 +40,7 @@ digraph iCFG { 26 -> 25 ; -25 [label="25: Call _fun_B_div0 \n n$0=_fun_B_div0(&b:class B &) [line 15]\n REMOVE_TEMPS(n$0); [line 15]\n NULLIFY(&b,false); [line 15]\n APPLY_ABSTRACTION; [line 15]\n " shape="box"] +25 [label="25: Call _fun_B_div0 \n n$0=*&b:class B [line 15]\n n$1=_fun_B_div0(&b:class B &) [line 15]\n REMOVE_TEMPS(n$0,n$1); [line 15]\n NULLIFY(&b,false); [line 15]\n APPLY_ABSTRACTION; [line 15]\n " shape="box"] 25 -> 24 ; diff --git a/infer/tests/codetoanalyze/cpp/frontend/keywords/self_parameter.cpp.dot b/infer/tests/codetoanalyze/cpp/frontend/keywords/self_parameter.cpp.dot index 78fc18d42..2684572d8 100644 --- a/infer/tests/codetoanalyze/cpp/frontend/keywords/self_parameter.cpp.dot +++ b/infer/tests/codetoanalyze/cpp/frontend/keywords/self_parameter.cpp.dot @@ -1,5 +1,5 @@ digraph iCFG { -9 [label="9: Return Stmt \n n$0=*&a:class A * [line 17]\n n$1=_fun_A_meth_with_self(n$0:class A *,1:int ,2:int ) [line 17]\n n$2=_fun_fun_with_self(10:int ) [line 17]\n *&return:int =(n$1 + n$2) [line 17]\n REMOVE_TEMPS(n$0,n$1,n$2); [line 17]\n NULLIFY(&a,false); [line 17]\n APPLY_ABSTRACTION; [line 17]\n " shape="box"] +9 [label="9: Return Stmt \n n$0=*&a:class A * [line 17]\n n$1=*n$0:class A [line 17]\n n$2=_fun_A_meth_with_self(n$0:class A *,1:int ,2:int ) [line 17]\n n$3=_fun_fun_with_self(10:int ) [line 17]\n *&return:int =(n$2 + n$3) [line 17]\n REMOVE_TEMPS(n$0,n$1,n$2,n$3); [line 17]\n NULLIFY(&a,false); [line 17]\n APPLY_ABSTRACTION; [line 17]\n " shape="box"] 9 -> 8 ; diff --git a/infer/tests/codetoanalyze/cpp/frontend/loops/foreach1.cpp.dot b/infer/tests/codetoanalyze/cpp/frontend/loops/foreach1.cpp.dot index 5aa30e451..286abdf61 100644 --- a/infer/tests/codetoanalyze/cpp/frontend/loops/foreach1.cpp.dot +++ b/infer/tests/codetoanalyze/cpp/frontend/loops/foreach1.cpp.dot @@ -7,36 +7,36 @@ digraph iCFG { 42 -> 35 ; -41 [label="41: DeclStmt \n n$13=_fun_iterator_operator*(&__begin:class iterator &) [line 37]\n *&value:int =n$13 [line 37]\n REMOVE_TEMPS(n$13); [line 37]\n " shape="box"] +41 [label="41: DeclStmt \n n$15=_fun_iterator_operator*(&__begin:class iterator &) [line 37]\n *&value:int =n$15 [line 37]\n REMOVE_TEMPS(n$15); [line 37]\n " shape="box"] 41 -> 40 ; -40 [label="40: DeclStmt \n n$11=*&value:int [line 38]\n n$12=*&value:int [line 38]\n *&temp:int =((n$11 * n$12) + 10) [line 38]\n REMOVE_TEMPS(n$11,n$12); [line 38]\n NULLIFY(&temp,false); [line 38]\n NULLIFY(&value,false); [line 38]\n " shape="box"] +40 [label="40: DeclStmt \n n$13=*&value:int [line 38]\n n$14=*&value:int [line 38]\n *&temp:int =((n$13 * n$14) + 10) [line 38]\n REMOVE_TEMPS(n$13,n$14); [line 38]\n NULLIFY(&temp,false); [line 38]\n NULLIFY(&value,false); [line 38]\n " shape="box"] 40 -> 36 ; -39 [label="39: Prune (false branch) \n PRUNE((n$10 == 0), false); [line 37]\n REMOVE_TEMPS(n$10); [line 37]\n NULLIFY(&SIL_materialize_temp__n$0,false); [line 37]\n NULLIFY(&SIL_materialize_temp__n$3,false); [line 37]\n NULLIFY(&__begin,false); [line 37]\n NULLIFY(&__end,false); [line 37]\n NULLIFY(&__temp_construct_n$8,false); [line 37]\n NULLIFY(&__temp_construct_n$9,false); [line 37]\n NULLIFY(&__temp_return_n$7,false); [line 37]\n NULLIFY(&vector,false); [line 37]\n APPLY_ABSTRACTION; [line 37]\n " shape="invhouse"] +39 [label="39: Prune (false branch) \n PRUNE((n$12 == 0), false); [line 37]\n REMOVE_TEMPS(n$12); [line 37]\n NULLIFY(&SIL_materialize_temp__n$0,false); [line 37]\n NULLIFY(&SIL_materialize_temp__n$4,false); [line 37]\n NULLIFY(&__begin,false); [line 37]\n NULLIFY(&__end,false); [line 37]\n NULLIFY(&__temp_construct_n$10,false); [line 37]\n NULLIFY(&__temp_construct_n$11,false); [line 37]\n NULLIFY(&__temp_return_n$9,false); [line 37]\n NULLIFY(&vector,false); [line 37]\n APPLY_ABSTRACTION; [line 37]\n " shape="invhouse"] 39 -> 32 ; -38 [label="38: Prune (true branch) \n PRUNE((n$10 != 0), true); [line 37]\n REMOVE_TEMPS(n$10); [line 37]\n " shape="invhouse"] +38 [label="38: Prune (true branch) \n PRUNE((n$12 != 0), true); [line 37]\n REMOVE_TEMPS(n$12); [line 37]\n " shape="invhouse"] 38 -> 41 ; -37 [label="37: Call _fun_operator!= \n _fun_iterator_iterator(&__temp_construct_n$8:class iterator *,&__begin:class iterator &) [line 37]\n _fun_iterator_iterator(&__temp_construct_n$9:class iterator *,&__end:class iterator &) [line 37]\n n$10=_fun_operator!=(&__temp_construct_n$8:class iterator ,&__temp_construct_n$9:class iterator ) [line 37]\n " shape="box"] +37 [label="37: Call _fun_operator!= \n _fun_iterator_iterator(&__temp_construct_n$10:class iterator *,&__begin:class iterator &) [line 37]\n _fun_iterator_iterator(&__temp_construct_n$11:class iterator *,&__end:class iterator &) [line 37]\n n$12=_fun_operator!=(&__temp_construct_n$10:class iterator ,&__temp_construct_n$11:class iterator ) [line 37]\n " shape="box"] 37 -> 38 ; 37 -> 39 ; -36 [label="36: Call _fun_iterator_operator++ \n _fun_iterator_operator++(&__begin:class iterator &,&__temp_return_n$7:class iterator *) [line 37]\n APPLY_ABSTRACTION; [line 37]\n " shape="box"] +36 [label="36: Call _fun_iterator_operator++ \n _fun_iterator_operator++(&__begin:class iterator &,&__temp_return_n$9:class iterator *) [line 37]\n APPLY_ABSTRACTION; [line 37]\n " shape="box"] 36 -> 33 ; -35 [label="35: DeclStmt \n n$4=*&__range:class vec & [line 37]\n _fun_vec_begin(n$4:class vec &,&SIL_materialize_temp__n$3:class iterator *) [line 37]\n _fun_iterator_iterator(&__begin:class iterator *,&SIL_materialize_temp__n$3:class iterator &) [line 37]\n REMOVE_TEMPS(n$4); [line 37]\n " shape="box"] +35 [label="35: DeclStmt \n n$5=*&__range:class vec & [line 37]\n n$6=*n$5:class vec [line 37]\n _fun_vec_begin(n$5:class vec &,&SIL_materialize_temp__n$4:class iterator *) [line 37]\n _fun_iterator_iterator(&__begin:class iterator *,&SIL_materialize_temp__n$4:class iterator &) [line 37]\n REMOVE_TEMPS(n$5,n$6); [line 37]\n " shape="box"] 35 -> 34 ; -34 [label="34: DeclStmt \n n$1=*&__range:class vec & [line 37]\n _fun_vec_end(n$1:class vec &,&SIL_materialize_temp__n$0:class iterator *) [line 37]\n _fun_iterator_iterator(&__end:class iterator *,&SIL_materialize_temp__n$0:class iterator &) [line 37]\n REMOVE_TEMPS(n$1); [line 37]\n NULLIFY(&__range,false); [line 37]\n APPLY_ABSTRACTION; [line 37]\n " shape="box"] +34 [label="34: DeclStmt \n n$1=*&__range:class vec & [line 37]\n n$2=*n$1:class vec [line 37]\n _fun_vec_end(n$1:class vec &,&SIL_materialize_temp__n$0:class iterator *) [line 37]\n _fun_iterator_iterator(&__end:class iterator *,&SIL_materialize_temp__n$0:class iterator &) [line 37]\n REMOVE_TEMPS(n$1,n$2); [line 37]\n NULLIFY(&__range,false); [line 37]\n APPLY_ABSTRACTION; [line 37]\n " shape="box"] 34 -> 33 ; @@ -47,7 +47,7 @@ digraph iCFG { 32 [label="32: Exit test \n " color=yellow style=filled] -31 [label="31: Start test\nFormals: \nLocals: __end:class iterator SIL_materialize_temp__n$0:class iterator __begin:class iterator SIL_materialize_temp__n$3:class iterator __temp_return_n$7:class iterator __temp_construct_n$8:class iterator __temp_construct_n$9:class iterator temp:int value:int __range:class vec & vector:class vec \n DECLARE_LOCALS(&return,&__end,&SIL_materialize_temp__n$0,&__begin,&SIL_materialize_temp__n$3,&__temp_return_n$7,&__temp_construct_n$8,&__temp_construct_n$9,&temp,&value,&__range,&vector); [line 35]\n NULLIFY(&__range,false); [line 35]\n NULLIFY(&temp,false); [line 35]\n NULLIFY(&value,false); [line 35]\n " color=yellow style=filled] +31 [label="31: Start test\nFormals: \nLocals: __end:class iterator SIL_materialize_temp__n$0:class iterator __begin:class iterator SIL_materialize_temp__n$4:class iterator __temp_return_n$9:class iterator __temp_construct_n$10:class iterator __temp_construct_n$11:class iterator temp:int value:int __range:class vec & vector:class vec \n DECLARE_LOCALS(&return,&__end,&SIL_materialize_temp__n$0,&__begin,&SIL_materialize_temp__n$4,&__temp_return_n$9,&__temp_construct_n$10,&__temp_construct_n$11,&temp,&value,&__range,&vector); [line 35]\n NULLIFY(&__range,false); [line 35]\n NULLIFY(&temp,false); [line 35]\n NULLIFY(&value,false); [line 35]\n " color=yellow style=filled] 31 -> 43 ; diff --git a/infer/tests/codetoanalyze/cpp/frontend/methods/conversion_operator.cpp.dot b/infer/tests/codetoanalyze/cpp/frontend/methods/conversion_operator.cpp.dot index 2fa95b85a..69bc53a3c 100644 --- a/infer/tests/codetoanalyze/cpp/frontend/methods/conversion_operator.cpp.dot +++ b/infer/tests/codetoanalyze/cpp/frontend/methods/conversion_operator.cpp.dot @@ -3,23 +3,23 @@ digraph iCFG { 61 -> 56 ; -60 [label="60: DeclStmt \n n$3=_fun_X_operator int(&x:class X &) [line 64]\n *&v:int =n$3 [line 64]\n REMOVE_TEMPS(n$3); [line 64]\n " shape="box"] +60 [label="60: DeclStmt \n n$5=*&x:class X [line 64]\n n$6=_fun_X_operator int(&x:class X &) [line 64]\n *&v:int =n$6 [line 64]\n REMOVE_TEMPS(n$5,n$6); [line 64]\n " shape="box"] 60 -> 59 ; -59 [label="59: Return Stmt \n n$2=*&v:int [line 65]\n *&return:int =(1 / n$2) [line 65]\n REMOVE_TEMPS(n$2); [line 65]\n NULLIFY(&v,false); [line 65]\n NULLIFY(&x,false); [line 65]\n APPLY_ABSTRACTION; [line 65]\n " shape="box"] +59 [label="59: Return Stmt \n n$4=*&v:int [line 65]\n *&return:int =(1 / n$4) [line 65]\n REMOVE_TEMPS(n$4); [line 65]\n NULLIFY(&v,false); [line 65]\n NULLIFY(&x,false); [line 65]\n APPLY_ABSTRACTION; [line 65]\n " shape="box"] 59 -> 53 ; -58 [label="58: Prune (false branch) \n PRUNE((n$1 == 0), false); [line 63]\n REMOVE_TEMPS(n$1); [line 63]\n " shape="invhouse"] +58 [label="58: Prune (false branch) \n PRUNE((n$3 == 0), false); [line 63]\n REMOVE_TEMPS(n$2,n$3); [line 63]\n " shape="invhouse"] 58 -> 55 ; -57 [label="57: Prune (true branch) \n PRUNE((n$1 != 0), true); [line 63]\n REMOVE_TEMPS(n$1); [line 63]\n " shape="invhouse"] +57 [label="57: Prune (true branch) \n PRUNE((n$3 != 0), true); [line 63]\n REMOVE_TEMPS(n$2,n$3); [line 63]\n " shape="invhouse"] 57 -> 60 ; -56 [label="56: Call _fun_X_operator bool \n n$1=_fun_X_operator bool(&x:class X &) [line 63]\n " shape="box"] +56 [label="56: Call _fun_X_operator bool \n n$2=*&x:class X [line 63]\n n$3=_fun_X_operator bool(&x:class X &) [line 63]\n " shape="box"] 56 -> 57 ; @@ -28,7 +28,7 @@ digraph iCFG { 55 -> 54 ; -54 [label="54: Return Stmt \n n$0=_fun_X_operator int(&x:class X &) [line 67]\n *&return:int =n$0 [line 67]\n REMOVE_TEMPS(n$0); [line 67]\n NULLIFY(&x,false); [line 67]\n APPLY_ABSTRACTION; [line 67]\n " shape="box"] +54 [label="54: Return Stmt \n n$0=*&x:class X [line 67]\n n$1=_fun_X_operator int(&x:class X &) [line 67]\n *&return:int =n$1 [line 67]\n REMOVE_TEMPS(n$0,n$1); [line 67]\n NULLIFY(&x,false); [line 67]\n APPLY_ABSTRACTION; [line 67]\n " shape="box"] 54 -> 53 ; @@ -43,23 +43,23 @@ digraph iCFG { 51 -> 46 ; -50 [label="50: DeclStmt \n n$3=_fun_X_operator int(&x:class X &) [line 55]\n *&v:int =n$3 [line 55]\n REMOVE_TEMPS(n$3); [line 55]\n " shape="box"] +50 [label="50: DeclStmt \n n$5=*&x:class X [line 55]\n n$6=_fun_X_operator int(&x:class X &) [line 55]\n *&v:int =n$6 [line 55]\n REMOVE_TEMPS(n$5,n$6); [line 55]\n " shape="box"] 50 -> 49 ; -49 [label="49: Return Stmt \n n$2=*&v:int [line 56]\n *&return:int =(1 / n$2) [line 56]\n REMOVE_TEMPS(n$2); [line 56]\n NULLIFY(&v,false); [line 56]\n NULLIFY(&x,false); [line 56]\n APPLY_ABSTRACTION; [line 56]\n " shape="box"] +49 [label="49: Return Stmt \n n$4=*&v:int [line 56]\n *&return:int =(1 / n$4) [line 56]\n REMOVE_TEMPS(n$4); [line 56]\n NULLIFY(&v,false); [line 56]\n NULLIFY(&x,false); [line 56]\n APPLY_ABSTRACTION; [line 56]\n " shape="box"] 49 -> 43 ; -48 [label="48: Prune (false branch) \n PRUNE((n$1 == 0), false); [line 54]\n REMOVE_TEMPS(n$1); [line 54]\n " shape="invhouse"] +48 [label="48: Prune (false branch) \n PRUNE((n$3 == 0), false); [line 54]\n REMOVE_TEMPS(n$2,n$3); [line 54]\n " shape="invhouse"] 48 -> 45 ; -47 [label="47: Prune (true branch) \n PRUNE((n$1 != 0), true); [line 54]\n REMOVE_TEMPS(n$1); [line 54]\n " shape="invhouse"] +47 [label="47: Prune (true branch) \n PRUNE((n$3 != 0), true); [line 54]\n REMOVE_TEMPS(n$2,n$3); [line 54]\n " shape="invhouse"] 47 -> 50 ; -46 [label="46: Call _fun_X_operator bool \n n$1=_fun_X_operator bool(&x:class X &) [line 54]\n " shape="box"] +46 [label="46: Call _fun_X_operator bool \n n$2=*&x:class X [line 54]\n n$3=_fun_X_operator bool(&x:class X &) [line 54]\n " shape="box"] 46 -> 47 ; @@ -68,7 +68,7 @@ digraph iCFG { 45 -> 44 ; -44 [label="44: Return Stmt \n n$0=_fun_X_operator int(&x:class X &) [line 58]\n *&return:int =n$0 [line 58]\n REMOVE_TEMPS(n$0); [line 58]\n NULLIFY(&x,false); [line 58]\n APPLY_ABSTRACTION; [line 58]\n " shape="box"] +44 [label="44: Return Stmt \n n$0=*&x:class X [line 58]\n n$1=_fun_X_operator int(&x:class X &) [line 58]\n *&return:int =n$1 [line 58]\n REMOVE_TEMPS(n$0,n$1); [line 58]\n NULLIFY(&x,false); [line 58]\n APPLY_ABSTRACTION; [line 58]\n " shape="box"] 44 -> 43 ; @@ -91,23 +91,23 @@ digraph iCFG { 39 -> 34 ; -38 [label="38: DeclStmt \n _fun_Y_operator X(&y:class Y &,&SIL_materialize_temp__n$10:class X *) [line 46]\n _fun_X_X(&__temp_construct_n$9:class X *,&SIL_materialize_temp__n$10:class X &) [line 46]\n n$12=_fun_X_operator int(&__temp_construct_n$9:class X &) [line 46]\n *&v:int =n$12 [line 46]\n REMOVE_TEMPS(n$12); [line 46]\n " shape="box"] +38 [label="38: DeclStmt \n n$13=*&y:class Y [line 46]\n _fun_Y_operator X(&y:class Y &,&SIL_materialize_temp__n$12:class X *) [line 46]\n _fun_X_X(&__temp_construct_n$11:class X *,&SIL_materialize_temp__n$12:class X &) [line 46]\n n$15=_fun_X_operator int(&__temp_construct_n$11:class X &) [line 46]\n *&v:int =n$15 [line 46]\n REMOVE_TEMPS(n$13,n$15); [line 46]\n " shape="box"] 38 -> 37 ; -37 [label="37: Return Stmt \n n$8=*&v:int [line 47]\n *&return:int =(1 / n$8) [line 47]\n REMOVE_TEMPS(n$8); [line 47]\n NULLIFY(&v,false); [line 47]\n NULLIFY(&SIL_materialize_temp__n$1,false); [line 47]\n NULLIFY(&SIL_materialize_temp__n$10,false); [line 47]\n NULLIFY(&SIL_materialize_temp__n$5,false); [line 47]\n NULLIFY(&__temp_construct_n$0,false); [line 47]\n NULLIFY(&__temp_construct_n$4,false); [line 47]\n NULLIFY(&__temp_construct_n$9,false); [line 47]\n NULLIFY(&y,false); [line 47]\n APPLY_ABSTRACTION; [line 47]\n " shape="box"] +37 [label="37: Return Stmt \n n$10=*&v:int [line 47]\n *&return:int =(1 / n$10) [line 47]\n REMOVE_TEMPS(n$10); [line 47]\n NULLIFY(&v,false); [line 47]\n NULLIFY(&SIL_materialize_temp__n$1,false); [line 47]\n NULLIFY(&SIL_materialize_temp__n$12,false); [line 47]\n NULLIFY(&SIL_materialize_temp__n$6,false); [line 47]\n NULLIFY(&__temp_construct_n$0,false); [line 47]\n NULLIFY(&__temp_construct_n$11,false); [line 47]\n NULLIFY(&__temp_construct_n$5,false); [line 47]\n NULLIFY(&y,false); [line 47]\n APPLY_ABSTRACTION; [line 47]\n " shape="box"] 37 -> 31 ; -36 [label="36: Prune (false branch) \n PRUNE((n$7 == 0), false); [line 45]\n REMOVE_TEMPS(n$7); [line 45]\n " shape="invhouse"] +36 [label="36: Prune (false branch) \n PRUNE((n$9 == 0), false); [line 45]\n REMOVE_TEMPS(n$7,n$9); [line 45]\n " shape="invhouse"] 36 -> 33 ; -35 [label="35: Prune (true branch) \n PRUNE((n$7 != 0), true); [line 45]\n REMOVE_TEMPS(n$7); [line 45]\n " shape="invhouse"] +35 [label="35: Prune (true branch) \n PRUNE((n$9 != 0), true); [line 45]\n REMOVE_TEMPS(n$7,n$9); [line 45]\n " shape="invhouse"] 35 -> 38 ; -34 [label="34: Call _fun_X_operator bool \n _fun_Y_operator X(&y:class Y &,&SIL_materialize_temp__n$5:class X *) [line 45]\n _fun_X_X(&__temp_construct_n$4:class X *,&SIL_materialize_temp__n$5:class X &) [line 45]\n n$7=_fun_X_operator bool(&__temp_construct_n$4:class X &) [line 45]\n " shape="box"] +34 [label="34: Call _fun_X_operator bool \n n$7=*&y:class Y [line 45]\n _fun_Y_operator X(&y:class Y &,&SIL_materialize_temp__n$6:class X *) [line 45]\n _fun_X_X(&__temp_construct_n$5:class X *,&SIL_materialize_temp__n$6:class X &) [line 45]\n n$9=_fun_X_operator bool(&__temp_construct_n$5:class X &) [line 45]\n " shape="box"] 34 -> 35 ; @@ -116,14 +116,14 @@ digraph iCFG { 33 -> 32 ; -32 [label="32: Return Stmt \n _fun_Y_operator X(&y:class Y &,&SIL_materialize_temp__n$1:class X *) [line 49]\n _fun_X_X(&__temp_construct_n$0:class X *,&SIL_materialize_temp__n$1:class X &) [line 49]\n n$3=_fun_X_operator int(&__temp_construct_n$0:class X &) [line 49]\n *&return:int =n$3 [line 49]\n REMOVE_TEMPS(n$3); [line 49]\n NULLIFY(&SIL_materialize_temp__n$1,false); [line 49]\n NULLIFY(&SIL_materialize_temp__n$10,false); [line 49]\n NULLIFY(&SIL_materialize_temp__n$5,false); [line 49]\n NULLIFY(&__temp_construct_n$0,false); [line 49]\n NULLIFY(&__temp_construct_n$4,false); [line 49]\n NULLIFY(&__temp_construct_n$9,false); [line 49]\n NULLIFY(&y,false); [line 49]\n APPLY_ABSTRACTION; [line 49]\n " shape="box"] +32 [label="32: Return Stmt \n n$2=*&y:class Y [line 49]\n _fun_Y_operator X(&y:class Y &,&SIL_materialize_temp__n$1:class X *) [line 49]\n _fun_X_X(&__temp_construct_n$0:class X *,&SIL_materialize_temp__n$1:class X &) [line 49]\n n$4=_fun_X_operator int(&__temp_construct_n$0:class X &) [line 49]\n *&return:int =n$4 [line 49]\n REMOVE_TEMPS(n$2,n$4); [line 49]\n NULLIFY(&SIL_materialize_temp__n$1,false); [line 49]\n NULLIFY(&SIL_materialize_temp__n$12,false); [line 49]\n NULLIFY(&SIL_materialize_temp__n$6,false); [line 49]\n NULLIFY(&__temp_construct_n$0,false); [line 49]\n NULLIFY(&__temp_construct_n$11,false); [line 49]\n NULLIFY(&__temp_construct_n$5,false); [line 49]\n NULLIFY(&y,false); [line 49]\n APPLY_ABSTRACTION; [line 49]\n " shape="box"] 32 -> 31 ; 31 [label="31: Exit y_branch_div0 \n " color=yellow style=filled] -30 [label="30: Start y_branch_div0\nFormals: \nLocals: __temp_construct_n$0:class X SIL_materialize_temp__n$1:class X __temp_construct_n$4:class X SIL_materialize_temp__n$5:class X v:int __temp_construct_n$9:class X SIL_materialize_temp__n$10:class X y:class Y \n DECLARE_LOCALS(&return,&__temp_construct_n$0,&SIL_materialize_temp__n$1,&__temp_construct_n$4,&SIL_materialize_temp__n$5,&v,&__temp_construct_n$9,&SIL_materialize_temp__n$10,&y); [line 41]\n NULLIFY(&v,false); [line 41]\n " color=yellow style=filled] +30 [label="30: Start y_branch_div0\nFormals: \nLocals: __temp_construct_n$0:class X SIL_materialize_temp__n$1:class X __temp_construct_n$5:class X SIL_materialize_temp__n$6:class X v:int __temp_construct_n$11:class X SIL_materialize_temp__n$12:class X y:class Y \n DECLARE_LOCALS(&return,&__temp_construct_n$0,&SIL_materialize_temp__n$1,&__temp_construct_n$5,&SIL_materialize_temp__n$6,&v,&__temp_construct_n$11,&SIL_materialize_temp__n$12,&y); [line 41]\n NULLIFY(&v,false); [line 41]\n " color=yellow style=filled] 30 -> 41 ; @@ -131,23 +131,23 @@ digraph iCFG { 29 -> 24 ; -28 [label="28: DeclStmt \n n$3=_fun_X_operator int(&x:class X &) [line 35]\n *&v:int =n$3 [line 35]\n REMOVE_TEMPS(n$3); [line 35]\n " shape="box"] +28 [label="28: DeclStmt \n n$5=*&x:class X [line 35]\n n$6=_fun_X_operator int(&x:class X &) [line 35]\n *&v:int =n$6 [line 35]\n REMOVE_TEMPS(n$5,n$6); [line 35]\n " shape="box"] 28 -> 27 ; -27 [label="27: Return Stmt \n n$2=*&v:int [line 36]\n *&return:int =(1 / n$2) [line 36]\n REMOVE_TEMPS(n$2); [line 36]\n NULLIFY(&v,false); [line 36]\n NULLIFY(&x,false); [line 36]\n APPLY_ABSTRACTION; [line 36]\n " shape="box"] +27 [label="27: Return Stmt \n n$4=*&v:int [line 36]\n *&return:int =(1 / n$4) [line 36]\n REMOVE_TEMPS(n$4); [line 36]\n NULLIFY(&v,false); [line 36]\n NULLIFY(&x,false); [line 36]\n APPLY_ABSTRACTION; [line 36]\n " shape="box"] 27 -> 21 ; -26 [label="26: Prune (false branch) \n PRUNE((n$1 == 0), false); [line 34]\n REMOVE_TEMPS(n$1); [line 34]\n " shape="invhouse"] +26 [label="26: Prune (false branch) \n PRUNE((n$3 == 0), false); [line 34]\n REMOVE_TEMPS(n$2,n$3); [line 34]\n " shape="invhouse"] 26 -> 23 ; -25 [label="25: Prune (true branch) \n PRUNE((n$1 != 0), true); [line 34]\n REMOVE_TEMPS(n$1); [line 34]\n " shape="invhouse"] +25 [label="25: Prune (true branch) \n PRUNE((n$3 != 0), true); [line 34]\n REMOVE_TEMPS(n$2,n$3); [line 34]\n " shape="invhouse"] 25 -> 28 ; -24 [label="24: Call _fun_X_operator bool \n n$1=_fun_X_operator bool(&x:class X &) [line 34]\n " shape="box"] +24 [label="24: Call _fun_X_operator bool \n n$2=*&x:class X [line 34]\n n$3=_fun_X_operator bool(&x:class X &) [line 34]\n " shape="box"] 24 -> 25 ; @@ -156,7 +156,7 @@ digraph iCFG { 23 -> 22 ; -22 [label="22: Return Stmt \n n$0=_fun_X_operator int(&x:class X &) [line 38]\n *&return:int =n$0 [line 38]\n REMOVE_TEMPS(n$0); [line 38]\n NULLIFY(&x,false); [line 38]\n APPLY_ABSTRACTION; [line 38]\n " shape="box"] +22 [label="22: Return Stmt \n n$0=*&x:class X [line 38]\n n$1=_fun_X_operator int(&x:class X &) [line 38]\n *&return:int =n$1 [line 38]\n REMOVE_TEMPS(n$0,n$1); [line 38]\n NULLIFY(&x,false); [line 38]\n APPLY_ABSTRACTION; [line 38]\n " shape="box"] 22 -> 21 ; diff --git a/infer/tests/codetoanalyze/cpp/frontend/methods/default_parameters.cpp.dot b/infer/tests/codetoanalyze/cpp/frontend/methods/default_parameters.cpp.dot index b869fe59f..23ea92b8a 100644 --- a/infer/tests/codetoanalyze/cpp/frontend/methods/default_parameters.cpp.dot +++ b/infer/tests/codetoanalyze/cpp/frontend/methods/default_parameters.cpp.dot @@ -1,13 +1,13 @@ digraph iCFG { -8 [label="8: Call _fun_A_fun_default \n n$4=*&a_ptr:class A * [line 18]\n n$5=_fun_A_fun_default(n$4:class A *,1:int ,2:int ,3:int ) [line 18]\n REMOVE_TEMPS(n$4,n$5); [line 18]\n " shape="box"] +8 [label="8: Call _fun_A_fun_default \n n$6=*&a_ptr:class A * [line 18]\n n$7=*n$6:class A [line 18]\n n$8=_fun_A_fun_default(n$6:class A *,1:int ,2:int ,3:int ) [line 18]\n REMOVE_TEMPS(n$6,n$7,n$8); [line 18]\n " shape="box"] 8 -> 7 ; -7 [label="7: Call _fun_A_fun_default \n n$2=*&a_ptr:class A * [line 19]\n n$3=_fun_A_fun_default(n$2:class A *,1:int ,2:int ,20:int ) [line 19]\n REMOVE_TEMPS(n$2,n$3); [line 19]\n " shape="box"] +7 [label="7: Call _fun_A_fun_default \n n$3=*&a_ptr:class A * [line 19]\n n$4=*n$3:class A [line 19]\n n$5=_fun_A_fun_default(n$3:class A *,1:int ,2:int ,20:int ) [line 19]\n REMOVE_TEMPS(n$3,n$4,n$5); [line 19]\n " shape="box"] 7 -> 6 ; -6 [label="6: Call _fun_A_fun_default \n n$0=*&a_ptr:class A * [line 20]\n n$1=_fun_A_fun_default(n$0:class A *,1:int ,10:int ,20:int ) [line 20]\n REMOVE_TEMPS(n$0,n$1); [line 20]\n NULLIFY(&a_ptr,false); [line 20]\n APPLY_ABSTRACTION; [line 20]\n " shape="box"] +6 [label="6: Call _fun_A_fun_default \n n$0=*&a_ptr:class A * [line 20]\n n$1=*n$0:class A [line 20]\n n$2=_fun_A_fun_default(n$0:class A *,1:int ,10:int ,20:int ) [line 20]\n REMOVE_TEMPS(n$0,n$1,n$2); [line 20]\n NULLIFY(&a_ptr,false); [line 20]\n APPLY_ABSTRACTION; [line 20]\n " shape="box"] 6 -> 5 ; diff --git a/infer/tests/codetoanalyze/cpp/frontend/methods/dereference_this.cpp.dot b/infer/tests/codetoanalyze/cpp/frontend/methods/dereference_this.cpp.dot index 91aab6957..1bbbac217 100644 --- a/infer/tests/codetoanalyze/cpp/frontend/methods/dereference_this.cpp.dot +++ b/infer/tests/codetoanalyze/cpp/frontend/methods/dereference_this.cpp.dot @@ -1,5 +1,5 @@ digraph iCFG { -10 [label="10: Call _fun_A_method \n n$0=*&a_ptr:class A * [line 25]\n n$1=_fun_A_method(n$0:class A *) [line 25]\n REMOVE_TEMPS(n$0,n$1); [line 25]\n NULLIFY(&a_ptr,false); [line 25]\n APPLY_ABSTRACTION; [line 25]\n " shape="box"] +10 [label="10: Call _fun_A_method \n n$0=*&a_ptr:class A * [line 25]\n n$1=*n$0:class A [line 25]\n n$2=_fun_A_method(n$0:class A *) [line 25]\n REMOVE_TEMPS(n$0,n$1,n$2); [line 25]\n NULLIFY(&a_ptr,false); [line 25]\n APPLY_ABSTRACTION; [line 25]\n " shape="box"] 10 -> 9 ; @@ -10,7 +10,7 @@ digraph iCFG { 8 -> 10 ; -7 [label="7: Call _fun_A_init \n n$2=*&this:class A * [line 19]\n _fun_A_init(n$2:class A *,10:int ) [line 19]\n REMOVE_TEMPS(n$2); [line 19]\n " shape="box"] +7 [label="7: Call _fun_A_init \n n$2=*&this:class A * [line 19]\n n$3=*n$2:class A [line 19]\n _fun_A_init(n$2:class A *,10:int ) [line 19]\n REMOVE_TEMPS(n$2,n$3); [line 19]\n " shape="box"] 7 -> 6 ; diff --git a/infer/tests/codetoanalyze/cpp/frontend/methods/inline_method.cpp.dot b/infer/tests/codetoanalyze/cpp/frontend/methods/inline_method.cpp.dot index 53b960dc6..744e81a3b 100644 --- a/infer/tests/codetoanalyze/cpp/frontend/methods/inline_method.cpp.dot +++ b/infer/tests/codetoanalyze/cpp/frontend/methods/inline_method.cpp.dot @@ -1,9 +1,9 @@ digraph iCFG { -11 [label="11: Call _fun_A_fun \n n$3=*&a_ptr:class A * [line 24]\n n$4=_fun_A_fun(n$3:class A *) [line 24]\n REMOVE_TEMPS(n$3,n$4); [line 24]\n " shape="box"] +11 [label="11: Call _fun_A_fun \n n$4=*&a_ptr:class A * [line 24]\n n$5=*n$4:class A [line 24]\n n$6=_fun_A_fun(n$4:class A *) [line 24]\n REMOVE_TEMPS(n$4,n$5,n$6); [line 24]\n " shape="box"] 11 -> 10 ; -10 [label="10: Call _fun_A::AIn_fun \n n$0=*&a_ptr:class A * [line 25]\n n$1=*n$0.in:class A::AIn * [line 25]\n n$2=_fun_A::AIn_fun(n$1:class A::AIn *) [line 25]\n REMOVE_TEMPS(n$0,n$1,n$2); [line 25]\n NULLIFY(&a_ptr,false); [line 25]\n APPLY_ABSTRACTION; [line 25]\n " shape="box"] +10 [label="10: Call _fun_A::AIn_fun \n n$0=*&a_ptr:class A * [line 25]\n n$1=*n$0.in:class A::AIn * [line 25]\n n$2=*n$1:class A::AIn [line 25]\n n$3=_fun_A::AIn_fun(n$1:class A::AIn *) [line 25]\n REMOVE_TEMPS(n$0,n$1,n$2,n$3); [line 25]\n NULLIFY(&a_ptr,false); [line 25]\n APPLY_ABSTRACTION; [line 25]\n " shape="box"] 10 -> 9 ; diff --git a/infer/tests/codetoanalyze/cpp/frontend/methods/overloading.cpp.dot b/infer/tests/codetoanalyze/cpp/frontend/methods/overloading.cpp.dot index 9d27f26ce..5e53cdfa9 100644 --- a/infer/tests/codetoanalyze/cpp/frontend/methods/overloading.cpp.dot +++ b/infer/tests/codetoanalyze/cpp/frontend/methods/overloading.cpp.dot @@ -1,9 +1,9 @@ digraph iCFG { -10 [label="10: Call _fun_A_fun \n n$2=*&a_ptr:class A * [line 22]\n n$3=_fun_A_fun(n$2:class A *,1:int ,2:int ) [line 22]\n REMOVE_TEMPS(n$2,n$3); [line 22]\n " shape="box"] +10 [label="10: Call _fun_A_fun \n n$3=*&a_ptr:class A * [line 22]\n n$4=*n$3:class A [line 22]\n n$5=_fun_A_fun(n$3:class A *,1:int ,2:int ) [line 22]\n REMOVE_TEMPS(n$3,n$4,n$5); [line 22]\n " shape="box"] 10 -> 9 ; -9 [label="9: Call _fun_A_fun \n n$0=*&a_ptr:class A * [line 23]\n n$1=_fun_A_fun(n$0:class A *,1:int ,2:int ,3:int ) [line 23]\n REMOVE_TEMPS(n$0,n$1); [line 23]\n NULLIFY(&a_ptr,false); [line 23]\n APPLY_ABSTRACTION; [line 23]\n " shape="box"] +9 [label="9: Call _fun_A_fun \n n$0=*&a_ptr:class A * [line 23]\n n$1=*n$0:class A [line 23]\n n$2=_fun_A_fun(n$0:class A *,1:int ,2:int ,3:int ) [line 23]\n REMOVE_TEMPS(n$0,n$1,n$2); [line 23]\n NULLIFY(&a_ptr,false); [line 23]\n APPLY_ABSTRACTION; [line 23]\n " shape="box"] 9 -> 8 ; diff --git a/infer/tests/codetoanalyze/cpp/frontend/methods/return_struct.cpp.dot b/infer/tests/codetoanalyze/cpp/frontend/methods/return_struct.cpp.dot index 2f1c51b66..95a1b00df 100644 --- a/infer/tests/codetoanalyze/cpp/frontend/methods/return_struct.cpp.dot +++ b/infer/tests/codetoanalyze/cpp/frontend/methods/return_struct.cpp.dot @@ -1,5 +1,5 @@ digraph iCFG { -13 [label="13: DeclStmt \n n$2=*&a:class A * [line 22]\n _fun_A_get(n$2:class A *,1:int ,&SIL_materialize_temp__n$1:class X *) [line 22]\n _fun_X_X(&x:class X *,&SIL_materialize_temp__n$1:class X &) [line 22]\n REMOVE_TEMPS(n$2); [line 22]\n NULLIFY(&a,false); [line 22]\n " shape="box"] +13 [label="13: DeclStmt \n n$2=*&a:class A * [line 22]\n n$3=*n$2:class A [line 22]\n _fun_A_get(n$2:class A *,1:int ,&SIL_materialize_temp__n$1:class X *) [line 22]\n _fun_X_X(&x:class X *,&SIL_materialize_temp__n$1:class X &) [line 22]\n REMOVE_TEMPS(n$2,n$3); [line 22]\n NULLIFY(&a,false); [line 22]\n " shape="box"] 13 -> 12 ; diff --git a/infer/tests/codetoanalyze/cpp/frontend/methods/virtual_methods.cpp.dot b/infer/tests/codetoanalyze/cpp/frontend/methods/virtual_methods.cpp.dot index 8b129cc11..96d607d62 100644 --- a/infer/tests/codetoanalyze/cpp/frontend/methods/virtual_methods.cpp.dot +++ b/infer/tests/codetoanalyze/cpp/frontend/methods/virtual_methods.cpp.dot @@ -1,9 +1,9 @@ digraph iCFG { -53 [label="53: DeclStmt \n n$1=_fun___new(sizeof(class Triangle ):unsigned long ) [line 71]\n *&trgl:class Triangle *=n$1 [line 71]\n REMOVE_TEMPS(n$1); [line 71]\n " shape="box"] +53 [label="53: DeclStmt \n n$2=_fun___new(sizeof(class Triangle ):unsigned long ) [line 71]\n *&trgl:class Triangle *=n$2 [line 71]\n REMOVE_TEMPS(n$2); [line 71]\n " shape="box"] 53 -> 52 ; -52 [label="52: Call delete \n n$0=*&trgl:class Polygon * [line 72]\n _fun_Polygon_~Polygon(n$0:class Polygon *) virtual [line 72]\n _fun___delete(n$0:class Polygon *) [line 72]\n REMOVE_TEMPS(n$0); [line 72]\n NULLIFY(&trgl,false); [line 72]\n APPLY_ABSTRACTION; [line 72]\n " shape="box"] +52 [label="52: Call delete \n n$0=*&trgl:class Polygon * [line 72]\n n$1=*n$0:class Polygon [line 72]\n _fun_Polygon_~Polygon(n$0:class Polygon *) virtual [line 72]\n _fun___delete(n$0:class Polygon *) [line 72]\n REMOVE_TEMPS(n$0,n$1); [line 72]\n NULLIFY(&trgl,false); [line 72]\n APPLY_ABSTRACTION; [line 72]\n " shape="box"] 52 -> 51 ; @@ -26,11 +26,11 @@ digraph iCFG { 47 -> 46 ; -46 [label="46: Call _fun_Polygon_set_values \n n$2=*&ppoly2:class Polygon * [line 63]\n _fun_Polygon_set_values(n$2:class Polygon *,4:int ,5:int ) [line 63]\n REMOVE_TEMPS(n$2); [line 63]\n " shape="box"] +46 [label="46: Call _fun_Polygon_set_values \n n$3=*&ppoly2:class Polygon * [line 63]\n n$4=*n$3:class Polygon [line 63]\n _fun_Polygon_set_values(n$3:class Polygon *,4:int ,5:int ) [line 63]\n REMOVE_TEMPS(n$3,n$4); [line 63]\n " shape="box"] 46 -> 45 ; -45 [label="45: Return Stmt \n n$0=*&ppoly2:class Polygon * [line 64]\n n$1=_fun_Polygon_area(n$0:class Polygon *) [line 64]\n *&return:int =(1 / n$1) [line 64]\n REMOVE_TEMPS(n$0,n$1); [line 64]\n NULLIFY(&ppoly2,false); [line 64]\n NULLIFY(&poly,false); [line 64]\n NULLIFY(&trgl,false); [line 64]\n APPLY_ABSTRACTION; [line 64]\n " shape="box"] +45 [label="45: Return Stmt \n n$0=*&ppoly2:class Polygon * [line 64]\n n$1=*n$0:class Polygon [line 64]\n n$2=_fun_Polygon_area(n$0:class Polygon *) [line 64]\n *&return:int =(1 / n$2) [line 64]\n REMOVE_TEMPS(n$0,n$1,n$2); [line 64]\n NULLIFY(&ppoly2,false); [line 64]\n NULLIFY(&poly,false); [line 64]\n NULLIFY(&trgl,false); [line 64]\n APPLY_ABSTRACTION; [line 64]\n " shape="box"] 45 -> 44 ; @@ -49,7 +49,7 @@ digraph iCFG { 41 -> 40 ; -40 [label="40: Return Stmt \n n$0=*&ppoly3:class Polygon * [line 56]\n n$1=_fun_Polygon_area(n$0:class Polygon *) virtual [line 56]\n *&return:int =(1 / n$1) [line 56]\n REMOVE_TEMPS(n$0,n$1); [line 56]\n NULLIFY(&ppoly3,false); [line 56]\n NULLIFY(&poly,false); [line 56]\n APPLY_ABSTRACTION; [line 56]\n " shape="box"] +40 [label="40: Return Stmt \n n$0=*&ppoly3:class Polygon * [line 56]\n n$1=*n$0:class Polygon [line 56]\n n$2=_fun_Polygon_area(n$0:class Polygon *) virtual [line 56]\n *&return:int =(1 / n$2) [line 56]\n REMOVE_TEMPS(n$0,n$1,n$2); [line 56]\n NULLIFY(&ppoly3,false); [line 56]\n NULLIFY(&poly,false); [line 56]\n APPLY_ABSTRACTION; [line 56]\n " shape="box"] 40 -> 39 ; @@ -72,11 +72,11 @@ digraph iCFG { 35 -> 34 ; -34 [label="34: Call _fun_Polygon_set_values \n n$2=*&ppoly2:class Polygon * [line 49]\n _fun_Polygon_set_values(n$2:class Polygon *,4:int ,5:int ) [line 49]\n REMOVE_TEMPS(n$2); [line 49]\n " shape="box"] +34 [label="34: Call _fun_Polygon_set_values \n n$3=*&ppoly2:class Polygon * [line 49]\n n$4=*n$3:class Polygon [line 49]\n _fun_Polygon_set_values(n$3:class Polygon *,4:int ,5:int ) [line 49]\n REMOVE_TEMPS(n$3,n$4); [line 49]\n " shape="box"] 34 -> 33 ; -33 [label="33: Return Stmt \n n$0=*&ppoly2:class Polygon * [line 50]\n n$1=_fun_Polygon_area(n$0:class Polygon *) virtual [line 50]\n *&return:int =(1 / (n$1 - 10)) [line 50]\n REMOVE_TEMPS(n$0,n$1); [line 50]\n NULLIFY(&ppoly2,false); [line 50]\n NULLIFY(&poly,false); [line 50]\n NULLIFY(&trgl,false); [line 50]\n APPLY_ABSTRACTION; [line 50]\n " shape="box"] +33 [label="33: Return Stmt \n n$0=*&ppoly2:class Polygon * [line 50]\n n$1=*n$0:class Polygon [line 50]\n n$2=_fun_Polygon_area(n$0:class Polygon *) virtual [line 50]\n *&return:int =(1 / (n$2 - 10)) [line 50]\n REMOVE_TEMPS(n$0,n$1,n$2); [line 50]\n NULLIFY(&ppoly2,false); [line 50]\n NULLIFY(&poly,false); [line 50]\n NULLIFY(&trgl,false); [line 50]\n APPLY_ABSTRACTION; [line 50]\n " shape="box"] 33 -> 32 ; @@ -95,11 +95,11 @@ digraph iCFG { 29 -> 28 ; -28 [label="28: Call _fun_Polygon_set_values \n n$2=*&ppoly1:class Polygon * [line 41]\n _fun_Polygon_set_values(n$2:class Polygon *,4:int ,5:int ) [line 41]\n REMOVE_TEMPS(n$2); [line 41]\n " shape="box"] +28 [label="28: Call _fun_Polygon_set_values \n n$3=*&ppoly1:class Polygon * [line 41]\n n$4=*n$3:class Polygon [line 41]\n _fun_Polygon_set_values(n$3:class Polygon *,4:int ,5:int ) [line 41]\n REMOVE_TEMPS(n$3,n$4); [line 41]\n " shape="box"] 28 -> 27 ; -27 [label="27: Return Stmt \n n$0=*&ppoly1:class Polygon * [line 42]\n n$1=_fun_Polygon_area(n$0:class Polygon *) virtual [line 42]\n *&return:int =(1 / (n$1 - 20)) [line 42]\n REMOVE_TEMPS(n$0,n$1); [line 42]\n NULLIFY(&ppoly1,false); [line 42]\n NULLIFY(&rect,false); [line 42]\n APPLY_ABSTRACTION; [line 42]\n " shape="box"] +27 [label="27: Return Stmt \n n$0=*&ppoly1:class Polygon * [line 42]\n n$1=*n$0:class Polygon [line 42]\n n$2=_fun_Polygon_area(n$0:class Polygon *) virtual [line 42]\n *&return:int =(1 / (n$2 - 20)) [line 42]\n REMOVE_TEMPS(n$0,n$1,n$2); [line 42]\n NULLIFY(&ppoly1,false); [line 42]\n NULLIFY(&rect,false); [line 42]\n APPLY_ABSTRACTION; [line 42]\n " shape="box"] 27 -> 26 ; diff --git a/infer/tests/codetoanalyze/cpp/frontend/namespace/namespace.cpp.dot b/infer/tests/codetoanalyze/cpp/frontend/namespace/namespace.cpp.dot index 9e0104088..90a2bbd17 100644 --- a/infer/tests/codetoanalyze/cpp/frontend/namespace/namespace.cpp.dot +++ b/infer/tests/codetoanalyze/cpp/frontend/namespace/namespace.cpp.dot @@ -7,7 +7,7 @@ digraph iCFG { 23 -> 22 ; -22 [label="22: Call _fun_bar::Rectangle_set_values \n _fun_bar::Rectangle_set_values(&rect1:class bar::Rectangle &,3:int ,4:int ) [line 49]\n " shape="box"] +22 [label="22: Call _fun_bar::Rectangle_set_values \n n$4=*&rect1:class bar::Rectangle [line 49]\n _fun_bar::Rectangle_set_values(&rect1:class bar::Rectangle &,3:int ,4:int ) [line 49]\n REMOVE_TEMPS(n$4); [line 49]\n " shape="box"] 22 -> 21 ; @@ -15,7 +15,7 @@ digraph iCFG { 21 -> 20 ; -20 [label="20: Call _fun_foo::Rectangle_set_values \n _fun_foo::Rectangle_set_values(&rect2:class foo::Rectangle &,7:int ,10:int ) [line 52]\n " shape="box"] +20 [label="20: Call _fun_foo::Rectangle_set_values \n n$3=*&rect2:class foo::Rectangle [line 52]\n _fun_foo::Rectangle_set_values(&rect2:class foo::Rectangle &,7:int ,10:int ) [line 52]\n REMOVE_TEMPS(n$3); [line 52]\n " shape="box"] 20 -> 19 ; diff --git a/infer/tests/codetoanalyze/cpp/frontend/reference/member_access.cpp.dot b/infer/tests/codetoanalyze/cpp/frontend/reference/member_access.cpp.dot index 88099fceb..51520ed37 100644 --- a/infer/tests/codetoanalyze/cpp/frontend/reference/member_access.cpp.dot +++ b/infer/tests/codetoanalyze/cpp/frontend/reference/member_access.cpp.dot @@ -1,9 +1,9 @@ digraph iCFG { -11 [label="11: DeclStmt \n n$2=*&x:class X * [line 21]\n n$3=*n$2.f:int [line 21]\n *&f:int =n$3 [line 21]\n REMOVE_TEMPS(n$2,n$3); [line 21]\n NULLIFY(&f,false); [line 21]\n " shape="box"] +11 [label="11: DeclStmt \n n$3=*&x:class X * [line 21]\n n$4=*n$3.f:int [line 21]\n *&f:int =n$4 [line 21]\n REMOVE_TEMPS(n$3,n$4); [line 21]\n NULLIFY(&f,false); [line 21]\n " shape="box"] 11 -> 10 ; -10 [label="10: DeclStmt \n n$0=*&x:class X * [line 22]\n n$1=_fun_X_call(n$0:class X *) [line 22]\n *&c:int =n$1 [line 22]\n REMOVE_TEMPS(n$0,n$1); [line 22]\n NULLIFY(&c,false); [line 22]\n NULLIFY(&x,false); [line 22]\n APPLY_ABSTRACTION; [line 22]\n " shape="box"] +10 [label="10: DeclStmt \n n$0=*&x:class X * [line 22]\n n$1=*n$0:class X [line 22]\n n$2=_fun_X_call(n$0:class X *) [line 22]\n *&c:int =n$2 [line 22]\n REMOVE_TEMPS(n$0,n$1,n$2); [line 22]\n NULLIFY(&c,false); [line 22]\n NULLIFY(&x,false); [line 22]\n APPLY_ABSTRACTION; [line 22]\n " shape="box"] 10 -> 9 ; @@ -14,11 +14,11 @@ digraph iCFG { 8 -> 11 ; -7 [label="7: DeclStmt \n n$2=*&x:class X & [line 16]\n n$3=*n$2.f:int [line 16]\n *&f:int =n$3 [line 16]\n REMOVE_TEMPS(n$2,n$3); [line 16]\n NULLIFY(&f,false); [line 16]\n " shape="box"] +7 [label="7: DeclStmt \n n$3=*&x:class X & [line 16]\n n$4=*n$3.f:int [line 16]\n *&f:int =n$4 [line 16]\n REMOVE_TEMPS(n$3,n$4); [line 16]\n NULLIFY(&f,false); [line 16]\n " shape="box"] 7 -> 6 ; -6 [label="6: DeclStmt \n n$0=*&x:class X & [line 17]\n n$1=_fun_X_call(n$0:class X &) [line 17]\n *&c:int =n$1 [line 17]\n REMOVE_TEMPS(n$0,n$1); [line 17]\n NULLIFY(&c,false); [line 17]\n NULLIFY(&x,false); [line 17]\n APPLY_ABSTRACTION; [line 17]\n " shape="box"] +6 [label="6: DeclStmt \n n$0=*&x:class X & [line 17]\n n$1=*n$0:class X [line 17]\n n$2=_fun_X_call(n$0:class X &) [line 17]\n *&c:int =n$2 [line 17]\n REMOVE_TEMPS(n$0,n$1,n$2); [line 17]\n NULLIFY(&c,false); [line 17]\n NULLIFY(&x,false); [line 17]\n APPLY_ABSTRACTION; [line 17]\n " shape="box"] 6 -> 5 ; diff --git a/infer/tests/codetoanalyze/cpp/frontend/reference/member_access_from_return.cpp.dot b/infer/tests/codetoanalyze/cpp/frontend/reference/member_access_from_return.cpp.dot index c25e60581..da28c11e9 100644 --- a/infer/tests/codetoanalyze/cpp/frontend/reference/member_access_from_return.cpp.dot +++ b/infer/tests/codetoanalyze/cpp/frontend/reference/member_access_from_return.cpp.dot @@ -1,9 +1,9 @@ digraph iCFG { -19 [label="19: DeclStmt \n n$2=_fun_get_ptr() [line 25]\n n$3=*n$2.f:int [line 25]\n *&f:int =n$3 [line 25]\n REMOVE_TEMPS(n$2,n$3); [line 25]\n NULLIFY(&f,false); [line 25]\n " shape="box"] +19 [label="19: DeclStmt \n n$3=_fun_get_ptr() [line 25]\n n$4=*n$3.f:int [line 25]\n *&f:int =n$4 [line 25]\n REMOVE_TEMPS(n$3,n$4); [line 25]\n NULLIFY(&f,false); [line 25]\n " shape="box"] 19 -> 18 ; -18 [label="18: DeclStmt \n n$0=_fun_get_ptr() [line 26]\n n$1=_fun_X_call(n$0:class X *) [line 26]\n *&c:int =n$1 [line 26]\n REMOVE_TEMPS(n$0,n$1); [line 26]\n NULLIFY(&c,false); [line 26]\n APPLY_ABSTRACTION; [line 26]\n " shape="box"] +18 [label="18: DeclStmt \n n$0=_fun_get_ptr() [line 26]\n n$1=*n$0:class X [line 26]\n n$2=_fun_X_call(n$0:class X *) [line 26]\n *&c:int =n$2 [line 26]\n REMOVE_TEMPS(n$0,n$1,n$2); [line 26]\n NULLIFY(&c,false); [line 26]\n APPLY_ABSTRACTION; [line 26]\n " shape="box"] 18 -> 17 ; @@ -14,11 +14,11 @@ digraph iCFG { 16 -> 19 ; -15 [label="15: DeclStmt \n n$2=_fun_get_ref() [line 20]\n n$3=*n$2.f:int [line 20]\n *&f:int =n$3 [line 20]\n REMOVE_TEMPS(n$2,n$3); [line 20]\n NULLIFY(&f,false); [line 20]\n " shape="box"] +15 [label="15: DeclStmt \n n$3=_fun_get_ref() [line 20]\n n$4=*n$3.f:int [line 20]\n *&f:int =n$4 [line 20]\n REMOVE_TEMPS(n$3,n$4); [line 20]\n NULLIFY(&f,false); [line 20]\n " shape="box"] 15 -> 14 ; -14 [label="14: DeclStmt \n n$0=_fun_get_ref() [line 21]\n n$1=_fun_X_call(n$0:class X &) [line 21]\n *&c:int =n$1 [line 21]\n REMOVE_TEMPS(n$0,n$1); [line 21]\n NULLIFY(&c,false); [line 21]\n APPLY_ABSTRACTION; [line 21]\n " shape="box"] +14 [label="14: DeclStmt \n n$0=_fun_get_ref() [line 21]\n n$1=*n$0:class X [line 21]\n n$2=_fun_X_call(n$0:class X &) [line 21]\n *&c:int =n$2 [line 21]\n REMOVE_TEMPS(n$0,n$1,n$2); [line 21]\n NULLIFY(&c,false); [line 21]\n APPLY_ABSTRACTION; [line 21]\n " shape="box"] 14 -> 13 ; diff --git a/infer/tests/codetoanalyze/cpp/frontend/reference/reference_struct_e2e.cpp.dot b/infer/tests/codetoanalyze/cpp/frontend/reference/reference_struct_e2e.cpp.dot index 27d256383..f11b10940 100644 --- a/infer/tests/codetoanalyze/cpp/frontend/reference/reference_struct_e2e.cpp.dot +++ b/infer/tests/codetoanalyze/cpp/frontend/reference/reference_struct_e2e.cpp.dot @@ -1,13 +1,13 @@ digraph iCFG { -119 [label="119: Call _fun_X_zero \n n$3=_fun_get_global_ref() [line 124]\n _fun_X_zero(n$3:class X &) [line 124]\n REMOVE_TEMPS(n$3); [line 124]\n " shape="box"] +119 [label="119: Call _fun_X_zero \n n$4=_fun_get_global_ref() [line 124]\n n$5=*n$4:class X [line 124]\n _fun_X_zero(n$4:class X &) [line 124]\n REMOVE_TEMPS(n$4,n$5); [line 124]\n " shape="box"] 119 -> 118 ; -118 [label="118: BinaryOperatorStmt: Assign \n n$2=_fun_get_global_ref() [line 125]\n *n$2.f:int =1 [line 125]\n REMOVE_TEMPS(n$2); [line 125]\n " shape="box"] +118 [label="118: BinaryOperatorStmt: Assign \n n$3=_fun_get_global_ref() [line 125]\n *n$3.f:int =1 [line 125]\n REMOVE_TEMPS(n$3); [line 125]\n " shape="box"] 118 -> 117 ; -117 [label="117: Call _fun_X_div \n n$0=_fun_get_global_ref() [line 126]\n n$1=_fun_X_div(n$0:class X &) [line 126]\n REMOVE_TEMPS(n$0,n$1); [line 126]\n APPLY_ABSTRACTION; [line 126]\n " shape="box"] +117 [label="117: Call _fun_X_div \n n$0=_fun_get_global_ref() [line 126]\n n$1=*n$0:class X [line 126]\n n$2=_fun_X_div(n$0:class X &) [line 126]\n REMOVE_TEMPS(n$0,n$1,n$2); [line 126]\n APPLY_ABSTRACTION; [line 126]\n " shape="box"] 117 -> 116 ; @@ -18,15 +18,15 @@ digraph iCFG { 115 -> 119 ; -114 [label="114: Call _fun_X_nonzero \n n$3=_fun_get_global_ref() [line 118]\n _fun_X_nonzero(n$3:class X &) [line 118]\n REMOVE_TEMPS(n$3); [line 118]\n " shape="box"] +114 [label="114: Call _fun_X_nonzero \n n$4=_fun_get_global_ref() [line 118]\n n$5=*n$4:class X [line 118]\n _fun_X_nonzero(n$4:class X &) [line 118]\n REMOVE_TEMPS(n$4,n$5); [line 118]\n " shape="box"] 114 -> 113 ; -113 [label="113: BinaryOperatorStmt: Assign \n n$2=_fun_get_global_ref() [line 119]\n *n$2.f:int =0 [line 119]\n REMOVE_TEMPS(n$2); [line 119]\n " shape="box"] +113 [label="113: BinaryOperatorStmt: Assign \n n$3=_fun_get_global_ref() [line 119]\n *n$3.f:int =0 [line 119]\n REMOVE_TEMPS(n$3); [line 119]\n " shape="box"] 113 -> 112 ; -112 [label="112: Call _fun_X_div \n n$0=_fun_get_global_ref() [line 120]\n n$1=_fun_X_div(n$0:class X &) [line 120]\n REMOVE_TEMPS(n$0,n$1); [line 120]\n APPLY_ABSTRACTION; [line 120]\n " shape="box"] +112 [label="112: Call _fun_X_div \n n$0=_fun_get_global_ref() [line 120]\n n$1=*n$0:class X [line 120]\n n$2=_fun_X_div(n$0:class X &) [line 120]\n REMOVE_TEMPS(n$0,n$1,n$2); [line 120]\n APPLY_ABSTRACTION; [line 120]\n " shape="box"] 112 -> 111 ; @@ -37,15 +37,15 @@ digraph iCFG { 110 -> 114 ; -109 [label="109: BinaryOperatorStmt: Assign \n n$3=_fun_get_global_ref() [line 112]\n *n$3.f:int =0 [line 112]\n REMOVE_TEMPS(n$3); [line 112]\n " shape="box"] +109 [label="109: BinaryOperatorStmt: Assign \n n$5=_fun_get_global_ref() [line 112]\n *n$5.f:int =0 [line 112]\n REMOVE_TEMPS(n$5); [line 112]\n " shape="box"] 109 -> 108 ; -108 [label="108: Call _fun_X_nonzero \n n$2=_fun_get_global_ref() [line 113]\n _fun_X_nonzero(n$2:class X &) [line 113]\n REMOVE_TEMPS(n$2); [line 113]\n " shape="box"] +108 [label="108: Call _fun_X_nonzero \n n$3=_fun_get_global_ref() [line 113]\n n$4=*n$3:class X [line 113]\n _fun_X_nonzero(n$3:class X &) [line 113]\n REMOVE_TEMPS(n$3,n$4); [line 113]\n " shape="box"] 108 -> 107 ; -107 [label="107: Call _fun_X_div \n n$0=_fun_get_global_ref() [line 114]\n n$1=_fun_X_div(n$0:class X &) [line 114]\n REMOVE_TEMPS(n$0,n$1); [line 114]\n APPLY_ABSTRACTION; [line 114]\n " shape="box"] +107 [label="107: Call _fun_X_div \n n$0=_fun_get_global_ref() [line 114]\n n$1=*n$0:class X [line 114]\n n$2=_fun_X_div(n$0:class X &) [line 114]\n REMOVE_TEMPS(n$0,n$1,n$2); [line 114]\n APPLY_ABSTRACTION; [line 114]\n " shape="box"] 107 -> 106 ; @@ -56,15 +56,15 @@ digraph iCFG { 105 -> 109 ; -104 [label="104: BinaryOperatorStmt: Assign \n n$3=_fun_get_global_ref() [line 106]\n *n$3.f:int =1 [line 106]\n REMOVE_TEMPS(n$3); [line 106]\n " shape="box"] +104 [label="104: BinaryOperatorStmt: Assign \n n$5=_fun_get_global_ref() [line 106]\n *n$5.f:int =1 [line 106]\n REMOVE_TEMPS(n$5); [line 106]\n " shape="box"] 104 -> 103 ; -103 [label="103: Call _fun_X_zero \n n$2=_fun_get_global_ref() [line 107]\n _fun_X_zero(n$2:class X &) [line 107]\n REMOVE_TEMPS(n$2); [line 107]\n " shape="box"] +103 [label="103: Call _fun_X_zero \n n$3=_fun_get_global_ref() [line 107]\n n$4=*n$3:class X [line 107]\n _fun_X_zero(n$3:class X &) [line 107]\n REMOVE_TEMPS(n$3,n$4); [line 107]\n " shape="box"] 103 -> 102 ; -102 [label="102: Call _fun_X_div \n n$0=_fun_get_global_ref() [line 108]\n n$1=_fun_X_div(n$0:class X &) [line 108]\n REMOVE_TEMPS(n$0,n$1); [line 108]\n APPLY_ABSTRACTION; [line 108]\n " shape="box"] +102 [label="102: Call _fun_X_div \n n$0=_fun_get_global_ref() [line 108]\n n$1=*n$0:class X [line 108]\n n$2=_fun_X_div(n$0:class X &) [line 108]\n REMOVE_TEMPS(n$0,n$1,n$2); [line 108]\n APPLY_ABSTRACTION; [line 108]\n " shape="box"] 102 -> 101 ; @@ -75,11 +75,11 @@ digraph iCFG { 100 -> 104 ; -99 [label="99: Call _fun_set_field_ref \n n$2=*&x:class X & [line 101]\n _fun_set_field_ref(n$2:class X &,1:int ) [line 101]\n REMOVE_TEMPS(n$2); [line 101]\n " shape="box"] +99 [label="99: Call _fun_set_field_ref \n n$3=*&x:class X & [line 101]\n _fun_set_field_ref(n$3:class X &,1:int ) [line 101]\n REMOVE_TEMPS(n$3); [line 101]\n " shape="box"] 99 -> 98 ; -98 [label="98: Return Stmt \n n$0=*&x:class X & [line 102]\n n$1=_fun_X_div(n$0:class X &) [line 102]\n *&return:int =n$1 [line 102]\n REMOVE_TEMPS(n$0,n$1); [line 102]\n NULLIFY(&x,false); [line 102]\n APPLY_ABSTRACTION; [line 102]\n " shape="box"] +98 [label="98: Return Stmt \n n$0=*&x:class X & [line 102]\n n$1=*n$0:class X [line 102]\n n$2=_fun_X_div(n$0:class X &) [line 102]\n *&return:int =n$2 [line 102]\n REMOVE_TEMPS(n$0,n$1,n$2); [line 102]\n NULLIFY(&x,false); [line 102]\n APPLY_ABSTRACTION; [line 102]\n " shape="box"] 98 -> 97 ; @@ -90,11 +90,11 @@ digraph iCFG { 96 -> 99 ; -95 [label="95: Call _fun_set_field_ref \n n$2=*&x:class X & [line 96]\n _fun_set_field_ref(n$2:class X &,0:int ) [line 96]\n REMOVE_TEMPS(n$2); [line 96]\n " shape="box"] +95 [label="95: Call _fun_set_field_ref \n n$3=*&x:class X & [line 96]\n _fun_set_field_ref(n$3:class X &,0:int ) [line 96]\n REMOVE_TEMPS(n$3); [line 96]\n " shape="box"] 95 -> 94 ; -94 [label="94: Return Stmt \n n$0=*&x:class X & [line 97]\n n$1=_fun_X_div(n$0:class X &) [line 97]\n *&return:int =n$1 [line 97]\n REMOVE_TEMPS(n$0,n$1); [line 97]\n NULLIFY(&x,false); [line 97]\n APPLY_ABSTRACTION; [line 97]\n " shape="box"] +94 [label="94: Return Stmt \n n$0=*&x:class X & [line 97]\n n$1=*n$0:class X [line 97]\n n$2=_fun_X_div(n$0:class X &) [line 97]\n *&return:int =n$2 [line 97]\n REMOVE_TEMPS(n$0,n$1,n$2); [line 97]\n NULLIFY(&x,false); [line 97]\n APPLY_ABSTRACTION; [line 97]\n " shape="box"] 94 -> 93 ; @@ -105,11 +105,11 @@ digraph iCFG { 92 -> 95 ; -91 [label="91: Call _fun_nonzero_ref \n n$2=*&x:class X & [line 91]\n _fun_nonzero_ref(n$2:class X &) [line 91]\n REMOVE_TEMPS(n$2); [line 91]\n " shape="box"] +91 [label="91: Call _fun_nonzero_ref \n n$3=*&x:class X & [line 91]\n _fun_nonzero_ref(n$3:class X &) [line 91]\n REMOVE_TEMPS(n$3); [line 91]\n " shape="box"] 91 -> 90 ; -90 [label="90: Return Stmt \n n$0=*&x:class X & [line 92]\n n$1=_fun_X_div(n$0:class X &) [line 92]\n *&return:int =n$1 [line 92]\n REMOVE_TEMPS(n$0,n$1); [line 92]\n NULLIFY(&x,false); [line 92]\n APPLY_ABSTRACTION; [line 92]\n " shape="box"] +90 [label="90: Return Stmt \n n$0=*&x:class X & [line 92]\n n$1=*n$0:class X [line 92]\n n$2=_fun_X_div(n$0:class X &) [line 92]\n *&return:int =n$2 [line 92]\n REMOVE_TEMPS(n$0,n$1,n$2); [line 92]\n NULLIFY(&x,false); [line 92]\n APPLY_ABSTRACTION; [line 92]\n " shape="box"] 90 -> 89 ; @@ -120,11 +120,11 @@ digraph iCFG { 88 -> 91 ; -87 [label="87: Call _fun_zero_ref \n n$2=*&x:class X & [line 86]\n _fun_zero_ref(n$2:class X &) [line 86]\n REMOVE_TEMPS(n$2); [line 86]\n " shape="box"] +87 [label="87: Call _fun_zero_ref \n n$3=*&x:class X & [line 86]\n _fun_zero_ref(n$3:class X &) [line 86]\n REMOVE_TEMPS(n$3); [line 86]\n " shape="box"] 87 -> 86 ; -86 [label="86: Return Stmt \n n$0=*&x:class X & [line 87]\n n$1=_fun_X_div(n$0:class X &) [line 87]\n *&return:int =n$1 [line 87]\n REMOVE_TEMPS(n$0,n$1); [line 87]\n NULLIFY(&x,false); [line 87]\n APPLY_ABSTRACTION; [line 87]\n " shape="box"] +86 [label="86: Return Stmt \n n$0=*&x:class X & [line 87]\n n$1=*n$0:class X [line 87]\n n$2=_fun_X_div(n$0:class X &) [line 87]\n *&return:int =n$2 [line 87]\n REMOVE_TEMPS(n$0,n$1,n$2); [line 87]\n NULLIFY(&x,false); [line 87]\n APPLY_ABSTRACTION; [line 87]\n " shape="box"] 86 -> 85 ; @@ -135,15 +135,15 @@ digraph iCFG { 84 -> 87 ; -83 [label="83: Call _fun_X_zero \n n$3=_fun_get_global_ptr() [line 80]\n _fun_X_zero(n$3:class X *) [line 80]\n REMOVE_TEMPS(n$3); [line 80]\n " shape="box"] +83 [label="83: Call _fun_X_zero \n n$4=_fun_get_global_ptr() [line 80]\n n$5=*n$4:class X [line 80]\n _fun_X_zero(n$4:class X *) [line 80]\n REMOVE_TEMPS(n$4,n$5); [line 80]\n " shape="box"] 83 -> 82 ; -82 [label="82: BinaryOperatorStmt: Assign \n n$2=_fun_get_global_ptr() [line 81]\n *n$2.f:int =1 [line 81]\n REMOVE_TEMPS(n$2); [line 81]\n " shape="box"] +82 [label="82: BinaryOperatorStmt: Assign \n n$3=_fun_get_global_ptr() [line 81]\n *n$3.f:int =1 [line 81]\n REMOVE_TEMPS(n$3); [line 81]\n " shape="box"] 82 -> 81 ; -81 [label="81: Call _fun_X_div \n n$0=_fun_get_global_ptr() [line 82]\n n$1=_fun_X_div(n$0:class X *) [line 82]\n REMOVE_TEMPS(n$0,n$1); [line 82]\n APPLY_ABSTRACTION; [line 82]\n " shape="box"] +81 [label="81: Call _fun_X_div \n n$0=_fun_get_global_ptr() [line 82]\n n$1=*n$0:class X [line 82]\n n$2=_fun_X_div(n$0:class X *) [line 82]\n REMOVE_TEMPS(n$0,n$1,n$2); [line 82]\n APPLY_ABSTRACTION; [line 82]\n " shape="box"] 81 -> 80 ; @@ -154,15 +154,15 @@ digraph iCFG { 79 -> 83 ; -78 [label="78: Call _fun_X_nonzero \n n$3=_fun_get_global_ptr() [line 74]\n _fun_X_nonzero(n$3:class X *) [line 74]\n REMOVE_TEMPS(n$3); [line 74]\n " shape="box"] +78 [label="78: Call _fun_X_nonzero \n n$4=_fun_get_global_ptr() [line 74]\n n$5=*n$4:class X [line 74]\n _fun_X_nonzero(n$4:class X *) [line 74]\n REMOVE_TEMPS(n$4,n$5); [line 74]\n " shape="box"] 78 -> 77 ; -77 [label="77: BinaryOperatorStmt: Assign \n n$2=_fun_get_global_ptr() [line 75]\n *n$2.f:int =0 [line 75]\n REMOVE_TEMPS(n$2); [line 75]\n " shape="box"] +77 [label="77: BinaryOperatorStmt: Assign \n n$3=_fun_get_global_ptr() [line 75]\n *n$3.f:int =0 [line 75]\n REMOVE_TEMPS(n$3); [line 75]\n " shape="box"] 77 -> 76 ; -76 [label="76: Call _fun_X_div \n n$0=_fun_get_global_ptr() [line 76]\n n$1=_fun_X_div(n$0:class X *) [line 76]\n REMOVE_TEMPS(n$0,n$1); [line 76]\n APPLY_ABSTRACTION; [line 76]\n " shape="box"] +76 [label="76: Call _fun_X_div \n n$0=_fun_get_global_ptr() [line 76]\n n$1=*n$0:class X [line 76]\n n$2=_fun_X_div(n$0:class X *) [line 76]\n REMOVE_TEMPS(n$0,n$1,n$2); [line 76]\n APPLY_ABSTRACTION; [line 76]\n " shape="box"] 76 -> 75 ; @@ -173,15 +173,15 @@ digraph iCFG { 74 -> 78 ; -73 [label="73: BinaryOperatorStmt: Assign \n n$3=_fun_get_global_ptr() [line 68]\n *n$3.f:int =0 [line 68]\n REMOVE_TEMPS(n$3); [line 68]\n " shape="box"] +73 [label="73: BinaryOperatorStmt: Assign \n n$5=_fun_get_global_ptr() [line 68]\n *n$5.f:int =0 [line 68]\n REMOVE_TEMPS(n$5); [line 68]\n " shape="box"] 73 -> 72 ; -72 [label="72: Call _fun_X_nonzero \n n$2=_fun_get_global_ptr() [line 69]\n _fun_X_nonzero(n$2:class X *) [line 69]\n REMOVE_TEMPS(n$2); [line 69]\n " shape="box"] +72 [label="72: Call _fun_X_nonzero \n n$3=_fun_get_global_ptr() [line 69]\n n$4=*n$3:class X [line 69]\n _fun_X_nonzero(n$3:class X *) [line 69]\n REMOVE_TEMPS(n$3,n$4); [line 69]\n " shape="box"] 72 -> 71 ; -71 [label="71: Call _fun_X_div \n n$0=_fun_get_global_ptr() [line 70]\n n$1=_fun_X_div(n$0:class X *) [line 70]\n REMOVE_TEMPS(n$0,n$1); [line 70]\n APPLY_ABSTRACTION; [line 70]\n " shape="box"] +71 [label="71: Call _fun_X_div \n n$0=_fun_get_global_ptr() [line 70]\n n$1=*n$0:class X [line 70]\n n$2=_fun_X_div(n$0:class X *) [line 70]\n REMOVE_TEMPS(n$0,n$1,n$2); [line 70]\n APPLY_ABSTRACTION; [line 70]\n " shape="box"] 71 -> 70 ; @@ -192,15 +192,15 @@ digraph iCFG { 69 -> 73 ; -68 [label="68: BinaryOperatorStmt: Assign \n n$3=_fun_get_global_ptr() [line 62]\n *n$3.f:int =1 [line 62]\n REMOVE_TEMPS(n$3); [line 62]\n " shape="box"] +68 [label="68: BinaryOperatorStmt: Assign \n n$5=_fun_get_global_ptr() [line 62]\n *n$5.f:int =1 [line 62]\n REMOVE_TEMPS(n$5); [line 62]\n " shape="box"] 68 -> 67 ; -67 [label="67: Call _fun_X_zero \n n$2=_fun_get_global_ptr() [line 63]\n _fun_X_zero(n$2:class X *) [line 63]\n REMOVE_TEMPS(n$2); [line 63]\n " shape="box"] +67 [label="67: Call _fun_X_zero \n n$3=_fun_get_global_ptr() [line 63]\n n$4=*n$3:class X [line 63]\n _fun_X_zero(n$3:class X *) [line 63]\n REMOVE_TEMPS(n$3,n$4); [line 63]\n " shape="box"] 67 -> 66 ; -66 [label="66: Call _fun_X_div \n n$0=_fun_get_global_ptr() [line 64]\n n$1=_fun_X_div(n$0:class X *) [line 64]\n REMOVE_TEMPS(n$0,n$1); [line 64]\n APPLY_ABSTRACTION; [line 64]\n " shape="box"] +66 [label="66: Call _fun_X_div \n n$0=_fun_get_global_ptr() [line 64]\n n$1=*n$0:class X [line 64]\n n$2=_fun_X_div(n$0:class X *) [line 64]\n REMOVE_TEMPS(n$0,n$1,n$2); [line 64]\n APPLY_ABSTRACTION; [line 64]\n " shape="box"] 66 -> 65 ; @@ -211,11 +211,11 @@ digraph iCFG { 64 -> 68 ; -63 [label="63: Call _fun_set_field_ptr \n n$3=*&x:class X * [line 56]\n _fun_set_field_ptr(n$3:class X *,1:int ) [line 56]\n REMOVE_TEMPS(n$3); [line 56]\n " shape="box"] +63 [label="63: Call _fun_set_field_ptr \n n$4=*&x:class X * [line 56]\n _fun_set_field_ptr(n$4:class X *,1:int ) [line 56]\n REMOVE_TEMPS(n$4); [line 56]\n " shape="box"] 63 -> 62 ; -62 [label="62: Return Stmt \n n$1=*&x:class X * [line 57]\n n$2=_fun_X_div(n$1:class X *) [line 57]\n *&return:int =n$2 [line 57]\n REMOVE_TEMPS(n$1,n$2); [line 57]\n NULLIFY(&x,false); [line 57]\n APPLY_ABSTRACTION; [line 57]\n " shape="box"] +62 [label="62: Return Stmt \n n$1=*&x:class X * [line 57]\n n$2=*n$1:class X [line 57]\n n$3=_fun_X_div(n$1:class X *) [line 57]\n *&return:int =n$3 [line 57]\n REMOVE_TEMPS(n$1,n$2,n$3); [line 57]\n NULLIFY(&x,false); [line 57]\n APPLY_ABSTRACTION; [line 57]\n " shape="box"] 62 -> 58 ; @@ -239,11 +239,11 @@ digraph iCFG { 57 -> 60 ; 57 -> 61 ; -56 [label="56: Call _fun_set_field_ptr \n n$3=*&x:class X * [line 49]\n _fun_set_field_ptr(n$3:class X *,0:int ) [line 49]\n REMOVE_TEMPS(n$3); [line 49]\n " shape="box"] +56 [label="56: Call _fun_set_field_ptr \n n$4=*&x:class X * [line 49]\n _fun_set_field_ptr(n$4:class X *,0:int ) [line 49]\n REMOVE_TEMPS(n$4); [line 49]\n " shape="box"] 56 -> 55 ; -55 [label="55: Return Stmt \n n$1=*&x:class X * [line 50]\n n$2=_fun_X_div(n$1:class X *) [line 50]\n *&return:int =n$2 [line 50]\n REMOVE_TEMPS(n$1,n$2); [line 50]\n NULLIFY(&x,false); [line 50]\n APPLY_ABSTRACTION; [line 50]\n " shape="box"] +55 [label="55: Return Stmt \n n$1=*&x:class X * [line 50]\n n$2=*n$1:class X [line 50]\n n$3=_fun_X_div(n$1:class X *) [line 50]\n *&return:int =n$3 [line 50]\n REMOVE_TEMPS(n$1,n$2,n$3); [line 50]\n NULLIFY(&x,false); [line 50]\n APPLY_ABSTRACTION; [line 50]\n " shape="box"] 55 -> 51 ; @@ -267,11 +267,11 @@ digraph iCFG { 50 -> 53 ; 50 -> 54 ; -49 [label="49: Call _fun_nonzero_ptr \n n$3=*&x:class X * [line 42]\n _fun_nonzero_ptr(n$3:class X *) [line 42]\n REMOVE_TEMPS(n$3); [line 42]\n " shape="box"] +49 [label="49: Call _fun_nonzero_ptr \n n$4=*&x:class X * [line 42]\n _fun_nonzero_ptr(n$4:class X *) [line 42]\n REMOVE_TEMPS(n$4); [line 42]\n " shape="box"] 49 -> 48 ; -48 [label="48: Return Stmt \n n$1=*&x:class X * [line 43]\n n$2=_fun_X_div(n$1:class X *) [line 43]\n *&return:int =n$2 [line 43]\n REMOVE_TEMPS(n$1,n$2); [line 43]\n NULLIFY(&x,false); [line 43]\n APPLY_ABSTRACTION; [line 43]\n " shape="box"] +48 [label="48: Return Stmt \n n$1=*&x:class X * [line 43]\n n$2=*n$1:class X [line 43]\n n$3=_fun_X_div(n$1:class X *) [line 43]\n *&return:int =n$3 [line 43]\n REMOVE_TEMPS(n$1,n$2,n$3); [line 43]\n NULLIFY(&x,false); [line 43]\n APPLY_ABSTRACTION; [line 43]\n " shape="box"] 48 -> 44 ; @@ -295,11 +295,11 @@ digraph iCFG { 43 -> 46 ; 43 -> 47 ; -42 [label="42: Call _fun_zero_ptr \n n$3=*&x:class X * [line 35]\n _fun_zero_ptr(n$3:class X *) [line 35]\n REMOVE_TEMPS(n$3); [line 35]\n " shape="box"] +42 [label="42: Call _fun_zero_ptr \n n$4=*&x:class X * [line 35]\n _fun_zero_ptr(n$4:class X *) [line 35]\n REMOVE_TEMPS(n$4); [line 35]\n " shape="box"] 42 -> 41 ; -41 [label="41: Return Stmt \n n$1=*&x:class X * [line 36]\n n$2=_fun_X_div(n$1:class X *) [line 36]\n *&return:int =n$2 [line 36]\n REMOVE_TEMPS(n$1,n$2); [line 36]\n NULLIFY(&x,false); [line 36]\n APPLY_ABSTRACTION; [line 36]\n " shape="box"] +41 [label="41: Return Stmt \n n$1=*&x:class X * [line 36]\n n$2=*n$1:class X [line 36]\n n$3=_fun_X_div(n$1:class X *) [line 36]\n *&return:int =n$3 [line 36]\n REMOVE_TEMPS(n$1,n$2,n$3); [line 36]\n NULLIFY(&x,false); [line 36]\n APPLY_ABSTRACTION; [line 36]\n " shape="box"] 41 -> 37 ; @@ -356,7 +356,7 @@ digraph iCFG { 27 -> 29 ; -26 [label="26: Call _fun_X_nonzero \n n$0=*&x:class X & [line 25]\n _fun_X_nonzero(n$0:class X &) [line 25]\n REMOVE_TEMPS(n$0); [line 25]\n NULLIFY(&x,false); [line 25]\n APPLY_ABSTRACTION; [line 25]\n " shape="box"] +26 [label="26: Call _fun_X_nonzero \n n$0=*&x:class X & [line 25]\n n$1=*n$0:class X [line 25]\n _fun_X_nonzero(n$0:class X &) [line 25]\n REMOVE_TEMPS(n$0,n$1); [line 25]\n NULLIFY(&x,false); [line 25]\n APPLY_ABSTRACTION; [line 25]\n " shape="box"] 26 -> 25 ; @@ -367,7 +367,7 @@ digraph iCFG { 24 -> 26 ; -23 [label="23: Call _fun_X_zero \n n$0=*&x:class X & [line 23]\n _fun_X_zero(n$0:class X &) [line 23]\n REMOVE_TEMPS(n$0); [line 23]\n NULLIFY(&x,false); [line 23]\n APPLY_ABSTRACTION; [line 23]\n " shape="box"] +23 [label="23: Call _fun_X_zero \n n$0=*&x:class X & [line 23]\n n$1=*n$0:class X [line 23]\n _fun_X_zero(n$0:class X &) [line 23]\n REMOVE_TEMPS(n$0,n$1); [line 23]\n NULLIFY(&x,false); [line 23]\n APPLY_ABSTRACTION; [line 23]\n " shape="box"] 23 -> 22 ; @@ -389,7 +389,7 @@ digraph iCFG { 18 -> 20 ; -17 [label="17: Call _fun_X_nonzero \n n$0=*&x:class X * [line 19]\n _fun_X_nonzero(n$0:class X *) [line 19]\n REMOVE_TEMPS(n$0); [line 19]\n NULLIFY(&x,false); [line 19]\n APPLY_ABSTRACTION; [line 19]\n " shape="box"] +17 [label="17: Call _fun_X_nonzero \n n$0=*&x:class X * [line 19]\n n$1=*n$0:class X [line 19]\n _fun_X_nonzero(n$0:class X *) [line 19]\n REMOVE_TEMPS(n$0,n$1); [line 19]\n NULLIFY(&x,false); [line 19]\n APPLY_ABSTRACTION; [line 19]\n " shape="box"] 17 -> 16 ; @@ -400,7 +400,7 @@ digraph iCFG { 15 -> 17 ; -14 [label="14: Call _fun_X_zero \n n$0=*&x:class X * [line 17]\n _fun_X_zero(n$0:class X *) [line 17]\n REMOVE_TEMPS(n$0); [line 17]\n NULLIFY(&x,false); [line 17]\n APPLY_ABSTRACTION; [line 17]\n " shape="box"] +14 [label="14: Call _fun_X_zero \n n$0=*&x:class X * [line 17]\n n$1=*n$0:class X [line 17]\n _fun_X_zero(n$0:class X *) [line 17]\n REMOVE_TEMPS(n$0,n$1); [line 17]\n NULLIFY(&x,false); [line 17]\n APPLY_ABSTRACTION; [line 17]\n " shape="box"] 14 -> 13 ; diff --git a/infer/tests/codetoanalyze/cpp/frontend/templates/class_template_instantiate.cpp.dot b/infer/tests/codetoanalyze/cpp/frontend/templates/class_template_instantiate.cpp.dot index c49a9b5ee..8de0378a2 100644 --- a/infer/tests/codetoanalyze/cpp/frontend/templates/class_template_instantiate.cpp.dot +++ b/infer/tests/codetoanalyze/cpp/frontend/templates/class_template_instantiate.cpp.dot @@ -1,5 +1,5 @@ digraph iCFG { -30 [label="30: Return Stmt \n n$0=*&s:class ExecStore & [line 41]\n n$1=_fun_Choose2_extra(n$0.f:class Choose2 &,1:int ) [line 41]\n *&return:int =n$1 [line 41]\n REMOVE_TEMPS(n$0,n$1); [line 41]\n NULLIFY(&s,false); [line 41]\n APPLY_ABSTRACTION; [line 41]\n " shape="box"] +30 [label="30: Return Stmt \n n$0=*&s:class ExecStore & [line 41]\n n$1=*n$0.f:class Choose2 [line 41]\n n$2=_fun_Choose2_extra(n$0.f:class Choose2 &,1:int ) [line 41]\n *&return:int =n$2 [line 41]\n REMOVE_TEMPS(n$0,n$1,n$2); [line 41]\n NULLIFY(&s,false); [line 41]\n APPLY_ABSTRACTION; [line 41]\n " shape="box"] 30 -> 29 ; @@ -10,7 +10,7 @@ digraph iCFG { 28 -> 30 ; -27 [label="27: Return Stmt \n n$0=*&s:class ExecStore & [line 39]\n n$1=_fun_Choose2_extra(n$0.f:class Choose2 &,0:int ) [line 39]\n *&return:int =n$1 [line 39]\n REMOVE_TEMPS(n$0,n$1); [line 39]\n NULLIFY(&s,false); [line 39]\n APPLY_ABSTRACTION; [line 39]\n " shape="box"] +27 [label="27: Return Stmt \n n$0=*&s:class ExecStore & [line 39]\n n$1=*n$0.f:class Choose2 [line 39]\n n$2=_fun_Choose2_extra(n$0.f:class Choose2 &,0:int ) [line 39]\n *&return:int =n$2 [line 39]\n REMOVE_TEMPS(n$0,n$1,n$2); [line 39]\n NULLIFY(&s,false); [line 39]\n APPLY_ABSTRACTION; [line 39]\n " shape="box"] 27 -> 26 ; @@ -21,7 +21,7 @@ digraph iCFG { 25 -> 27 ; -24 [label="24: Return Stmt \n n$0=*&s:class ExecStore & [line 36]\n n$1=_fun_ExecStore_call_div(n$0:class ExecStore &,1:int ) [line 36]\n *&return:int =n$1 [line 36]\n REMOVE_TEMPS(n$0,n$1); [line 36]\n NULLIFY(&s,false); [line 36]\n APPLY_ABSTRACTION; [line 36]\n " shape="box"] +24 [label="24: Return Stmt \n n$0=*&s:class ExecStore & [line 36]\n n$1=*n$0:class ExecStore [line 36]\n n$2=_fun_ExecStore_call_div(n$0:class ExecStore &,1:int ) [line 36]\n *&return:int =n$2 [line 36]\n REMOVE_TEMPS(n$0,n$1,n$2); [line 36]\n NULLIFY(&s,false); [line 36]\n APPLY_ABSTRACTION; [line 36]\n " shape="box"] 24 -> 23 ; @@ -32,7 +32,7 @@ digraph iCFG { 22 -> 24 ; -21 [label="21: Return Stmt \n n$0=*&s:class ExecStore & [line 32]\n n$1=_fun_ExecStore_call_div(n$0:class ExecStore &,1:int ) [line 32]\n *&return:int =n$1 [line 32]\n REMOVE_TEMPS(n$0,n$1); [line 32]\n NULLIFY(&s,false); [line 32]\n APPLY_ABSTRACTION; [line 32]\n " shape="box"] +21 [label="21: Return Stmt \n n$0=*&s:class ExecStore & [line 32]\n n$1=*n$0:class ExecStore [line 32]\n n$2=_fun_ExecStore_call_div(n$0:class ExecStore &,1:int ) [line 32]\n *&return:int =n$2 [line 32]\n REMOVE_TEMPS(n$0,n$1,n$2); [line 32]\n NULLIFY(&s,false); [line 32]\n APPLY_ABSTRACTION; [line 32]\n " shape="box"] 21 -> 20 ; @@ -43,7 +43,7 @@ digraph iCFG { 19 -> 21 ; -18 [label="18: Return Stmt \n n$0=*&s:class ExecStore & [line 30]\n n$1=_fun_ExecStore_call_div(n$0:class ExecStore &,0:int ) [line 30]\n *&return:int =n$1 [line 30]\n REMOVE_TEMPS(n$0,n$1); [line 30]\n NULLIFY(&s,false); [line 30]\n APPLY_ABSTRACTION; [line 30]\n " shape="box"] +18 [label="18: Return Stmt \n n$0=*&s:class ExecStore & [line 30]\n n$1=*n$0:class ExecStore [line 30]\n n$2=_fun_ExecStore_call_div(n$0:class ExecStore &,0:int ) [line 30]\n *&return:int =n$2 [line 30]\n REMOVE_TEMPS(n$0,n$1,n$2); [line 30]\n NULLIFY(&s,false); [line 30]\n APPLY_ABSTRACTION; [line 30]\n " shape="box"] 18 -> 17 ; @@ -54,7 +54,7 @@ digraph iCFG { 16 -> 18 ; -15 [label="15: Return Stmt \n n$0=*&this:class ExecStore * [line 26]\n n$1=*&a:int [line 26]\n n$2=_fun_Choose2_div(n$0.f:class Choose2 &,n$1:int ,0:int ) [line 26]\n *&return:int =n$2 [line 26]\n REMOVE_TEMPS(n$0,n$1,n$2); [line 26]\n NULLIFY(&a,false); [line 26]\n NULLIFY(&this,false); [line 26]\n APPLY_ABSTRACTION; [line 26]\n " shape="box"] +15 [label="15: Return Stmt \n n$0=*&this:class ExecStore * [line 26]\n n$1=*n$0.f:class Choose2 [line 26]\n n$2=*&a:int [line 26]\n n$3=_fun_Choose2_div(n$0.f:class Choose2 &,n$2:int ,0:int ) [line 26]\n *&return:int =n$3 [line 26]\n REMOVE_TEMPS(n$0,n$1,n$2,n$3); [line 26]\n NULLIFY(&a,false); [line 26]\n NULLIFY(&this,false); [line 26]\n APPLY_ABSTRACTION; [line 26]\n " shape="box"] 15 -> 14 ; @@ -65,7 +65,7 @@ digraph iCFG { 13 -> 15 ; -12 [label="12: Return Stmt \n n$0=*&this:class ExecStore * [line 26]\n n$1=*&a:int [line 26]\n n$2=_fun_Choose1_div(n$0.f:class Choose1 &,n$1:int ,0:int ) [line 26]\n *&return:int =n$2 [line 26]\n REMOVE_TEMPS(n$0,n$1,n$2); [line 26]\n NULLIFY(&a,false); [line 26]\n NULLIFY(&this,false); [line 26]\n APPLY_ABSTRACTION; [line 26]\n " shape="box"] +12 [label="12: Return Stmt \n n$0=*&this:class ExecStore * [line 26]\n n$1=*n$0.f:class Choose1 [line 26]\n n$2=*&a:int [line 26]\n n$3=_fun_Choose1_div(n$0.f:class Choose1 &,n$2:int ,0:int ) [line 26]\n *&return:int =n$3 [line 26]\n REMOVE_TEMPS(n$0,n$1,n$2,n$3); [line 26]\n NULLIFY(&a,false); [line 26]\n NULLIFY(&this,false); [line 26]\n APPLY_ABSTRACTION; [line 26]\n " shape="box"] 12 -> 11 ; diff --git a/infer/tests/codetoanalyze/cpp/frontend/templates/function.cpp.dot b/infer/tests/codetoanalyze/cpp/frontend/templates/function.cpp.dot index 5a4cfa9c0..ace846a4d 100644 --- a/infer/tests/codetoanalyze/cpp/frontend/templates/function.cpp.dot +++ b/infer/tests/codetoanalyze/cpp/frontend/templates/function.cpp.dot @@ -111,7 +111,7 @@ digraph iCFG { 20 -> 23 ; -19 [label="19: Return Stmt \n n$0=*&x:class X3 & [line 30]\n n$1=_fun_X3_get(n$0:class X3 &) [line 30]\n *&return:int =n$1 [line 30]\n REMOVE_TEMPS(n$0,n$1); [line 30]\n NULLIFY(&x,false); [line 30]\n APPLY_ABSTRACTION; [line 30]\n " shape="box"] +19 [label="19: Return Stmt \n n$0=*&x:class X3 & [line 30]\n n$1=*n$0:class X3 [line 30]\n n$2=_fun_X3_get(n$0:class X3 &) [line 30]\n *&return:int =n$2 [line 30]\n REMOVE_TEMPS(n$0,n$1,n$2); [line 30]\n NULLIFY(&x,false); [line 30]\n APPLY_ABSTRACTION; [line 30]\n " shape="box"] 19 -> 18 ; @@ -122,7 +122,7 @@ digraph iCFG { 17 -> 19 ; -16 [label="16: Return Stmt \n n$0=*&x:class X1 & [line 24]\n n$1=_fun_X1_getVal(n$0:class X1 &) [line 24]\n *&return:int =n$1 [line 24]\n REMOVE_TEMPS(n$0,n$1); [line 24]\n NULLIFY(&x,false); [line 24]\n APPLY_ABSTRACTION; [line 24]\n " shape="box"] +16 [label="16: Return Stmt \n n$0=*&x:class X1 & [line 24]\n n$1=*n$0:class X1 [line 24]\n n$2=_fun_X1_getVal(n$0:class X1 &) [line 24]\n *&return:int =n$2 [line 24]\n REMOVE_TEMPS(n$0,n$1,n$2); [line 24]\n NULLIFY(&x,false); [line 24]\n APPLY_ABSTRACTION; [line 24]\n " shape="box"] 16 -> 15 ; diff --git a/infer/tests/codetoanalyze/cpp/frontend/templates/method.cpp b/infer/tests/codetoanalyze/cpp/frontend/templates/method.cpp index 2ad343adf..545234aa3 100644 --- a/infer/tests/codetoanalyze/cpp/frontend/templates/method.cpp +++ b/infer/tests/codetoanalyze/cpp/frontend/templates/method.cpp @@ -54,9 +54,10 @@ int div0_getter_templ() { } int div0_getter_templ2() { - X2 x2; + X2 x2_1; + X2 x2_2; GetterTempl g; - return 1 / g.get(x2, x2); + return 1 / g.get(x2_1, x2_2); } int div1_getter_templ() { @@ -67,7 +68,8 @@ int div1_getter_templ() { } int div1_getter_templ2() { - X1 x1; + X1 x1_1; + X1 x1_2; GetterTempl g; - return 1 / g.get(x1, x1); + return 1 / g.get(x1_1, x1_2); } diff --git a/infer/tests/codetoanalyze/cpp/frontend/templates/method.cpp.dot b/infer/tests/codetoanalyze/cpp/frontend/templates/method.cpp.dot index b049327c2..6f36cb15d 100644 --- a/infer/tests/codetoanalyze/cpp/frontend/templates/method.cpp.dot +++ b/infer/tests/codetoanalyze/cpp/frontend/templates/method.cpp.dot @@ -1,65 +1,73 @@ digraph iCFG { -73 [label="73: DeclStmt \n _fun_X1_X1(&x1:class X1 *) [line 70]\n " shape="box"] +75 [label="75: DeclStmt \n _fun_X1_X1(&x1_1:class X1 *) [line 71]\n " shape="box"] + + + 75 -> 74 ; +74 [label="74: DeclStmt \n _fun_X1_X1(&x1_2:class X1 *) [line 72]\n " shape="box"] + + + 74 -> 73 ; +73 [label="73: DeclStmt \n _fun_GetterTempl_GetterTempl(&g:class GetterTempl *) [line 73]\n " shape="box"] 73 -> 72 ; -72 [label="72: DeclStmt \n _fun_GetterTempl_GetterTempl(&g:class GetterTempl *) [line 71]\n " shape="box"] +72 [label="72: Return Stmt \n n$0=*&g:class GetterTempl [line 74]\n n$1=_fun_GetterTempl_get(&g:class GetterTempl &,&x1_1:class X1 &,&x1_2:class X1 &) [line 74]\n *&return:int =(1 / n$1) [line 74]\n REMOVE_TEMPS(n$0,n$1); [line 74]\n NULLIFY(&g,false); [line 74]\n NULLIFY(&x1_1,false); [line 74]\n NULLIFY(&x1_2,false); [line 74]\n APPLY_ABSTRACTION; [line 74]\n " shape="box"] 72 -> 71 ; -71 [label="71: Return Stmt \n n$0=_fun_GetterTempl_get(&g:class GetterTempl &,&x1:class X1 &,&x1:class X1 &) [line 72]\n *&return:int =(1 / n$0) [line 72]\n REMOVE_TEMPS(n$0); [line 72]\n NULLIFY(&g,false); [line 72]\n NULLIFY(&x1,false); [line 72]\n APPLY_ABSTRACTION; [line 72]\n " shape="box"] +71 [label="71: Exit div1_getter_templ2 \n " color=yellow style=filled] - 71 -> 70 ; -70 [label="70: Exit div1_getter_templ2 \n " color=yellow style=filled] +70 [label="70: Start div1_getter_templ2\nFormals: \nLocals: g:class GetterTempl x1_2:class X1 x1_1:class X1 \n DECLARE_LOCALS(&return,&g,&x1_2,&x1_1); [line 70]\n " color=yellow style=filled] -69 [label="69: Start div1_getter_templ2\nFormals: \nLocals: g:class GetterTempl x1:class X1 \n DECLARE_LOCALS(&return,&g,&x1); [line 69]\n " color=yellow style=filled] + 70 -> 75 ; +69 [label="69: DeclStmt \n _fun_X1_X1(&x1:class X1 *) [line 64]\n " shape="box"] - 69 -> 73 ; -68 [label="68: DeclStmt \n _fun_X1_X1(&x1:class X1 *) [line 63]\n " shape="box"] + 69 -> 68 ; +68 [label="68: DeclStmt \n _fun_X2_X2(&x2:class X2 *) [line 65]\n " shape="box"] 68 -> 67 ; -67 [label="67: DeclStmt \n _fun_X2_X2(&x2:class X2 *) [line 64]\n " shape="box"] +67 [label="67: DeclStmt \n _fun_GetterTempl_GetterTempl(&g:class GetterTempl *) [line 66]\n " shape="box"] 67 -> 66 ; -66 [label="66: DeclStmt \n _fun_GetterTempl_GetterTempl(&g:class GetterTempl *) [line 65]\n " shape="box"] +66 [label="66: Return Stmt \n n$0=*&g:class GetterTempl [line 67]\n n$1=_fun_GetterTempl_get(&g:class GetterTempl &,&x2:class X2 &,&x1:class X1 &) [line 67]\n *&return:int =(1 / n$1) [line 67]\n REMOVE_TEMPS(n$0,n$1); [line 67]\n NULLIFY(&g,false); [line 67]\n NULLIFY(&x1,false); [line 67]\n NULLIFY(&x2,false); [line 67]\n APPLY_ABSTRACTION; [line 67]\n " shape="box"] 66 -> 65 ; -65 [label="65: Return Stmt \n n$0=_fun_GetterTempl_get(&g:class GetterTempl &,&x2:class X2 &,&x1:class X1 &) [line 66]\n *&return:int =(1 / n$0) [line 66]\n REMOVE_TEMPS(n$0); [line 66]\n NULLIFY(&g,false); [line 66]\n NULLIFY(&x1,false); [line 66]\n NULLIFY(&x2,false); [line 66]\n APPLY_ABSTRACTION; [line 66]\n " shape="box"] +65 [label="65: Exit div1_getter_templ \n " color=yellow style=filled] - 65 -> 64 ; -64 [label="64: Exit div1_getter_templ \n " color=yellow style=filled] +64 [label="64: Start div1_getter_templ\nFormals: \nLocals: g:class GetterTempl x2:class X2 x1:class X1 \n DECLARE_LOCALS(&return,&g,&x2,&x1); [line 63]\n " color=yellow style=filled] -63 [label="63: Start div1_getter_templ\nFormals: \nLocals: g:class GetterTempl x2:class X2 x1:class X1 \n DECLARE_LOCALS(&return,&g,&x2,&x1); [line 62]\n " color=yellow style=filled] + 64 -> 69 ; +63 [label="63: DeclStmt \n _fun_X2_X2(&x2_1:class X2 *) [line 57]\n " shape="box"] - 63 -> 68 ; -62 [label="62: DeclStmt \n _fun_X2_X2(&x2:class X2 *) [line 57]\n " shape="box"] + 63 -> 62 ; +62 [label="62: DeclStmt \n _fun_X2_X2(&x2_2:class X2 *) [line 58]\n " shape="box"] 62 -> 61 ; -61 [label="61: DeclStmt \n _fun_GetterTempl_GetterTempl(&g:class GetterTempl *) [line 58]\n " shape="box"] +61 [label="61: DeclStmt \n _fun_GetterTempl_GetterTempl(&g:class GetterTempl *) [line 59]\n " shape="box"] 61 -> 60 ; -60 [label="60: Return Stmt \n n$0=_fun_GetterTempl_get(&g:class GetterTempl &,&x2:class X2 &,&x2:class X2 &) [line 59]\n *&return:int =(1 / n$0) [line 59]\n REMOVE_TEMPS(n$0); [line 59]\n NULLIFY(&g,false); [line 59]\n NULLIFY(&x2,false); [line 59]\n APPLY_ABSTRACTION; [line 59]\n " shape="box"] +60 [label="60: Return Stmt \n n$0=*&g:class GetterTempl [line 60]\n n$1=_fun_GetterTempl_get(&g:class GetterTempl &,&x2_1:class X2 &,&x2_2:class X2 &) [line 60]\n *&return:int =(1 / n$1) [line 60]\n REMOVE_TEMPS(n$0,n$1); [line 60]\n NULLIFY(&g,false); [line 60]\n NULLIFY(&x2_1,false); [line 60]\n NULLIFY(&x2_2,false); [line 60]\n APPLY_ABSTRACTION; [line 60]\n " shape="box"] 60 -> 59 ; 59 [label="59: Exit div0_getter_templ2 \n " color=yellow style=filled] -58 [label="58: Start div0_getter_templ2\nFormals: \nLocals: g:class GetterTempl x2:class X2 \n DECLARE_LOCALS(&return,&g,&x2); [line 56]\n " color=yellow style=filled] +58 [label="58: Start div0_getter_templ2\nFormals: \nLocals: g:class GetterTempl x2_2:class X2 x2_1:class X2 \n DECLARE_LOCALS(&return,&g,&x2_2,&x2_1); [line 56]\n " color=yellow style=filled] - 58 -> 62 ; + 58 -> 63 ; 57 [label="57: DeclStmt \n _fun_X2_X2(&x2:class X2 *) [line 50]\n " shape="box"] @@ -72,7 +80,7 @@ digraph iCFG { 55 -> 54 ; -54 [label="54: Return Stmt \n n$0=_fun_GetterTempl_get(&g:class GetterTempl &,&x3:class X3 &,&x2:class X2 &) [line 53]\n *&return:int =(1 / n$0) [line 53]\n REMOVE_TEMPS(n$0); [line 53]\n NULLIFY(&g,false); [line 53]\n NULLIFY(&x2,false); [line 53]\n NULLIFY(&x3,false); [line 53]\n APPLY_ABSTRACTION; [line 53]\n " shape="box"] +54 [label="54: Return Stmt \n n$0=*&g:class GetterTempl [line 53]\n n$1=_fun_GetterTempl_get(&g:class GetterTempl &,&x3:class X3 &,&x2:class X2 &) [line 53]\n *&return:int =(1 / n$1) [line 53]\n REMOVE_TEMPS(n$0,n$1); [line 53]\n NULLIFY(&g,false); [line 53]\n NULLIFY(&x2,false); [line 53]\n NULLIFY(&x3,false); [line 53]\n APPLY_ABSTRACTION; [line 53]\n " shape="box"] 54 -> 53 ; @@ -91,7 +99,7 @@ digraph iCFG { 50 -> 49 ; -49 [label="49: Return Stmt \n n$0=_fun_Getter_get(&g:class Getter &,&x1:class X1 &) [line 46]\n *&return:int =(1 / n$0) [line 46]\n REMOVE_TEMPS(n$0); [line 46]\n NULLIFY(&g,false); [line 46]\n NULLIFY(&x1,false); [line 46]\n APPLY_ABSTRACTION; [line 46]\n " shape="box"] +49 [label="49: Return Stmt \n n$0=*&g:class Getter [line 46]\n n$1=_fun_Getter_get(&g:class Getter &,&x1:class X1 &) [line 46]\n *&return:int =(1 / n$1) [line 46]\n REMOVE_TEMPS(n$0,n$1); [line 46]\n NULLIFY(&g,false); [line 46]\n NULLIFY(&x1,false); [line 46]\n APPLY_ABSTRACTION; [line 46]\n " shape="box"] 49 -> 48 ; @@ -110,7 +118,7 @@ digraph iCFG { 45 -> 44 ; -44 [label="44: Return Stmt \n n$0=_fun_Getter_get(&g:class Getter &,&x2:class X2 &) [line 40]\n *&return:int =(1 / n$0) [line 40]\n REMOVE_TEMPS(n$0); [line 40]\n NULLIFY(&g,false); [line 40]\n NULLIFY(&x2,false); [line 40]\n APPLY_ABSTRACTION; [line 40]\n " shape="box"] +44 [label="44: Return Stmt \n n$0=*&g:class Getter [line 40]\n n$1=_fun_Getter_get(&g:class Getter &,&x2:class X2 &) [line 40]\n *&return:int =(1 / n$1) [line 40]\n REMOVE_TEMPS(n$0,n$1); [line 40]\n NULLIFY(&g,false); [line 40]\n NULLIFY(&x2,false); [line 40]\n APPLY_ABSTRACTION; [line 40]\n " shape="box"] 44 -> 43 ; @@ -128,7 +136,7 @@ digraph iCFG { 40 -> 41 ; -39 [label="39: Return Stmt \n n$0=*&t:class X1 & [line 33]\n n$1=_fun_X1_get(n$0:class X1 &) [line 33]\n n$2=*&s:class X1 & [line 33]\n n$3=_fun_X1_get(n$2:class X1 &) [line 33]\n *&return:int =(n$1 + n$3) [line 33]\n REMOVE_TEMPS(n$0,n$1,n$2,n$3); [line 33]\n NULLIFY(&s,false); [line 33]\n NULLIFY(&t,false); [line 33]\n APPLY_ABSTRACTION; [line 33]\n " shape="box"] +39 [label="39: Return Stmt \n n$0=*&t:class X1 & [line 33]\n n$1=*n$0:class X1 [line 33]\n n$2=_fun_X1_get(n$0:class X1 &) [line 33]\n n$3=*&s:class X1 & [line 33]\n n$4=*n$3:class X1 [line 33]\n n$5=_fun_X1_get(n$3:class X1 &) [line 33]\n *&return:int =(n$2 + n$5) [line 33]\n REMOVE_TEMPS(n$0,n$1,n$2,n$3,n$4,n$5); [line 33]\n NULLIFY(&s,false); [line 33]\n NULLIFY(&t,false); [line 33]\n APPLY_ABSTRACTION; [line 33]\n " shape="box"] 39 -> 38 ; @@ -146,7 +154,7 @@ digraph iCFG { 35 -> 36 ; -34 [label="34: Return Stmt \n n$0=*&t:class X2 & [line 33]\n n$1=_fun_X2_get(n$0:class X2 &) [line 33]\n n$2=*&s:class X1 & [line 33]\n n$3=_fun_X1_get(n$2:class X1 &) [line 33]\n *&return:int =(n$1 + n$3) [line 33]\n REMOVE_TEMPS(n$0,n$1,n$2,n$3); [line 33]\n NULLIFY(&s,false); [line 33]\n NULLIFY(&t,false); [line 33]\n APPLY_ABSTRACTION; [line 33]\n " shape="box"] +34 [label="34: Return Stmt \n n$0=*&t:class X2 & [line 33]\n n$1=*n$0:class X2 [line 33]\n n$2=_fun_X2_get(n$0:class X2 &) [line 33]\n n$3=*&s:class X1 & [line 33]\n n$4=*n$3:class X1 [line 33]\n n$5=_fun_X1_get(n$3:class X1 &) [line 33]\n *&return:int =(n$2 + n$5) [line 33]\n REMOVE_TEMPS(n$0,n$1,n$2,n$3,n$4,n$5); [line 33]\n NULLIFY(&s,false); [line 33]\n NULLIFY(&t,false); [line 33]\n APPLY_ABSTRACTION; [line 33]\n " shape="box"] 34 -> 33 ; @@ -157,7 +165,7 @@ digraph iCFG { 32 -> 34 ; -31 [label="31: Return Stmt \n n$0=*&t:class X2 & [line 33]\n n$1=_fun_X2_get(n$0:class X2 &) [line 33]\n n$2=*&s:class X2 & [line 33]\n n$3=_fun_X2_get(n$2:class X2 &) [line 33]\n *&return:int =(n$1 + n$3) [line 33]\n REMOVE_TEMPS(n$0,n$1,n$2,n$3); [line 33]\n NULLIFY(&s,false); [line 33]\n NULLIFY(&t,false); [line 33]\n APPLY_ABSTRACTION; [line 33]\n " shape="box"] +31 [label="31: Return Stmt \n n$0=*&t:class X2 & [line 33]\n n$1=*n$0:class X2 [line 33]\n n$2=_fun_X2_get(n$0:class X2 &) [line 33]\n n$3=*&s:class X2 & [line 33]\n n$4=*n$3:class X2 [line 33]\n n$5=_fun_X2_get(n$3:class X2 &) [line 33]\n *&return:int =(n$2 + n$5) [line 33]\n REMOVE_TEMPS(n$0,n$1,n$2,n$3,n$4,n$5); [line 33]\n NULLIFY(&s,false); [line 33]\n NULLIFY(&t,false); [line 33]\n APPLY_ABSTRACTION; [line 33]\n " shape="box"] 31 -> 30 ; @@ -175,7 +183,7 @@ digraph iCFG { 27 -> 28 ; -26 [label="26: Return Stmt \n n$0=*&t:class X3 & [line 33]\n n$1=_fun_X3_get(n$0:class X3 &) [line 33]\n n$2=*&s:class X2 & [line 33]\n n$3=_fun_X2_get(n$2:class X2 &) [line 33]\n *&return:int =(n$1 + n$3) [line 33]\n REMOVE_TEMPS(n$0,n$1,n$2,n$3); [line 33]\n NULLIFY(&s,false); [line 33]\n NULLIFY(&t,false); [line 33]\n APPLY_ABSTRACTION; [line 33]\n " shape="box"] +26 [label="26: Return Stmt \n n$0=*&t:class X3 & [line 33]\n n$1=*n$0:class X3 [line 33]\n n$2=_fun_X3_get(n$0:class X3 &) [line 33]\n n$3=*&s:class X2 & [line 33]\n n$4=*n$3:class X2 [line 33]\n n$5=_fun_X2_get(n$3:class X2 &) [line 33]\n *&return:int =(n$2 + n$5) [line 33]\n REMOVE_TEMPS(n$0,n$1,n$2,n$3,n$4,n$5); [line 33]\n NULLIFY(&s,false); [line 33]\n NULLIFY(&t,false); [line 33]\n APPLY_ABSTRACTION; [line 33]\n " shape="box"] 26 -> 25 ; @@ -193,7 +201,7 @@ digraph iCFG { 22 -> 23 ; -21 [label="21: Return Stmt \n n$0=*&s:class X1 & [line 25]\n n$1=_fun_X1_get(n$0:class X1 &) [line 25]\n *&return:int =n$1 [line 25]\n REMOVE_TEMPS(n$0,n$1); [line 25]\n NULLIFY(&s,false); [line 25]\n APPLY_ABSTRACTION; [line 25]\n " shape="box"] +21 [label="21: Return Stmt \n n$0=*&s:class X1 & [line 25]\n n$1=*n$0:class X1 [line 25]\n n$2=_fun_X1_get(n$0:class X1 &) [line 25]\n *&return:int =n$2 [line 25]\n REMOVE_TEMPS(n$0,n$1,n$2); [line 25]\n NULLIFY(&s,false); [line 25]\n APPLY_ABSTRACTION; [line 25]\n " shape="box"] 21 -> 20 ; @@ -204,7 +212,7 @@ digraph iCFG { 19 -> 21 ; -18 [label="18: Return Stmt \n n$0=*&s:class X2 & [line 25]\n n$1=_fun_X2_get(n$0:class X2 &) [line 25]\n *&return:int =n$1 [line 25]\n REMOVE_TEMPS(n$0,n$1); [line 25]\n NULLIFY(&s,false); [line 25]\n APPLY_ABSTRACTION; [line 25]\n " shape="box"] +18 [label="18: Return Stmt \n n$0=*&s:class X2 & [line 25]\n n$1=*n$0:class X2 [line 25]\n n$2=_fun_X2_get(n$0:class X2 &) [line 25]\n *&return:int =n$2 [line 25]\n REMOVE_TEMPS(n$0,n$1,n$2); [line 25]\n NULLIFY(&s,false); [line 25]\n APPLY_ABSTRACTION; [line 25]\n " shape="box"] 18 -> 17 ; diff --git a/infer/tests/codetoanalyze/cpp/frontend/types/inheritance.cpp.dot b/infer/tests/codetoanalyze/cpp/frontend/types/inheritance.cpp.dot index f55e2edfd..0680dcfec 100644 --- a/infer/tests/codetoanalyze/cpp/frontend/types/inheritance.cpp.dot +++ b/infer/tests/codetoanalyze/cpp/frontend/types/inheritance.cpp.dot @@ -1,37 +1,37 @@ digraph iCFG { -25 [label="25: DeclStmt \n n$14=_fun___new(sizeof(class Base ):unsigned long ) [line 22]\n *&b:class Base *=n$14 [line 22]\n REMOVE_TEMPS(n$14); [line 22]\n " shape="box"] +25 [label="25: DeclStmt \n n$20=_fun___new(sizeof(class Base ):unsigned long ) [line 22]\n *&b:class Base *=n$20 [line 22]\n REMOVE_TEMPS(n$20); [line 22]\n " shape="box"] 25 -> 24 ; -24 [label="24: DeclStmt \n n$13=_fun___new(sizeof(class Sub ):unsigned long ) [line 23]\n *&s1:class Sub *=n$13 [line 23]\n REMOVE_TEMPS(n$13); [line 23]\n " shape="box"] +24 [label="24: DeclStmt \n n$19=_fun___new(sizeof(class Sub ):unsigned long ) [line 23]\n *&s1:class Sub *=n$19 [line 23]\n REMOVE_TEMPS(n$19); [line 23]\n " shape="box"] 24 -> 23 ; -23 [label="23: DeclStmt \n n$12=_fun___new(sizeof(class Sub ):unsigned long ) [line 24]\n *&s2:class Sub *=n$12 [line 24]\n REMOVE_TEMPS(n$12); [line 24]\n " shape="box"] +23 [label="23: DeclStmt \n n$18=_fun___new(sizeof(class Sub ):unsigned long ) [line 24]\n *&s2:class Sub *=n$18 [line 24]\n REMOVE_TEMPS(n$18); [line 24]\n " shape="box"] 23 -> 22 ; -22 [label="22: Call _fun_Base_fun \n n$10=*&b:class Base * [line 26]\n n$11=_fun_Base_fun(n$10:class Base *) [line 26]\n REMOVE_TEMPS(n$10,n$11); [line 26]\n " shape="box"] +22 [label="22: Call _fun_Base_fun \n n$15=*&b:class Base * [line 26]\n n$16=*n$15:class Base [line 26]\n n$17=_fun_Base_fun(n$15:class Base *) [line 26]\n REMOVE_TEMPS(n$15,n$16,n$17); [line 26]\n " shape="box"] 22 -> 21 ; -21 [label="21: Call _fun_Base_fun \n n$8=*&s1:class Base * [line 27]\n n$9=_fun_Base_fun(n$8:class Base *) [line 27]\n REMOVE_TEMPS(n$8,n$9); [line 27]\n " shape="box"] +21 [label="21: Call _fun_Base_fun \n n$12=*&s1:class Base * [line 27]\n n$13=*n$12:class Base [line 27]\n n$14=_fun_Base_fun(n$12:class Base *) [line 27]\n REMOVE_TEMPS(n$12,n$13,n$14); [line 27]\n " shape="box"] 21 -> 20 ; -20 [label="20: Call _fun_Base_fun \n n$6=*&s2:class Sub * [line 28]\n n$7=_fun_Base_fun(n$6:class Sub *) [line 28]\n REMOVE_TEMPS(n$6,n$7); [line 28]\n " shape="box"] +20 [label="20: Call _fun_Base_fun \n n$9=*&s2:class Sub * [line 28]\n n$10=*n$9:class Sub [line 28]\n n$11=_fun_Base_fun(n$9:class Sub *) [line 28]\n REMOVE_TEMPS(n$9,n$10,n$11); [line 28]\n " shape="box"] 20 -> 19 ; -19 [label="19: Call _fun_Base_fun_redefine \n n$4=*&b:class Base * [line 30]\n n$5=_fun_Base_fun_redefine(n$4:class Base *) [line 30]\n REMOVE_TEMPS(n$4,n$5); [line 30]\n NULLIFY(&b,false); [line 30]\n " shape="box"] +19 [label="19: Call _fun_Base_fun_redefine \n n$6=*&b:class Base * [line 30]\n n$7=*n$6:class Base [line 30]\n n$8=_fun_Base_fun_redefine(n$6:class Base *) [line 30]\n REMOVE_TEMPS(n$6,n$7,n$8); [line 30]\n NULLIFY(&b,false); [line 30]\n " shape="box"] 19 -> 18 ; -18 [label="18: Call _fun_Base_fun_redefine \n n$2=*&s1:class Base * [line 31]\n n$3=_fun_Base_fun_redefine(n$2:class Base *) [line 31]\n REMOVE_TEMPS(n$2,n$3); [line 31]\n NULLIFY(&s1,false); [line 31]\n " shape="box"] +18 [label="18: Call _fun_Base_fun_redefine \n n$3=*&s1:class Base * [line 31]\n n$4=*n$3:class Base [line 31]\n n$5=_fun_Base_fun_redefine(n$3:class Base *) [line 31]\n REMOVE_TEMPS(n$3,n$4,n$5); [line 31]\n NULLIFY(&s1,false); [line 31]\n " shape="box"] 18 -> 17 ; -17 [label="17: Call _fun_Sub_fun_redefine \n n$0=*&s2:class Sub * [line 32]\n n$1=_fun_Sub_fun_redefine(n$0:class Sub *) [line 32]\n REMOVE_TEMPS(n$0,n$1); [line 32]\n NULLIFY(&s2,false); [line 32]\n APPLY_ABSTRACTION; [line 32]\n " shape="box"] +17 [label="17: Call _fun_Sub_fun_redefine \n n$0=*&s2:class Sub * [line 32]\n n$1=*n$0:class Sub [line 32]\n n$2=_fun_Sub_fun_redefine(n$0:class Sub *) [line 32]\n REMOVE_TEMPS(n$0,n$1,n$2); [line 32]\n NULLIFY(&s2,false); [line 32]\n APPLY_ABSTRACTION; [line 32]\n " shape="box"] 17 -> 16 ; diff --git a/infer/tests/codetoanalyze/cpp/frontend/types/operator_overload.cpp.dot b/infer/tests/codetoanalyze/cpp/frontend/types/operator_overload.cpp.dot index fde6fa884..a0a26cd56 100644 --- a/infer/tests/codetoanalyze/cpp/frontend/types/operator_overload.cpp.dot +++ b/infer/tests/codetoanalyze/cpp/frontend/types/operator_overload.cpp.dot @@ -21,7 +21,7 @@ digraph iCFG { 22 -> 24 ; -21 [label="21: DeclStmt \n n$1=*&x:class X & [line 36]\n n$2=_fun_X_operator[](n$1:class X &,0:int ) [line 36]\n *&v:int =n$2 [line 36]\n REMOVE_TEMPS(n$1,n$2); [line 36]\n NULLIFY(&x,false); [line 36]\n " shape="box"] +21 [label="21: DeclStmt \n n$1=*&x:class X & [line 36]\n n$2=*n$1:class X [line 36]\n n$3=_fun_X_operator[](n$1:class X &,0:int ) [line 36]\n *&v:int =n$3 [line 36]\n REMOVE_TEMPS(n$1,n$2,n$3); [line 36]\n NULLIFY(&x,false); [line 36]\n " shape="box"] 21 -> 20 ; diff --git a/infer/tests/codetoanalyze/cpp/frontend/types/struct_forward_declare.cpp.dot b/infer/tests/codetoanalyze/cpp/frontend/types/struct_forward_declare.cpp.dot index 78311e532..305d46ad4 100644 --- a/infer/tests/codetoanalyze/cpp/frontend/types/struct_forward_declare.cpp.dot +++ b/infer/tests/codetoanalyze/cpp/frontend/types/struct_forward_declare.cpp.dot @@ -1,9 +1,9 @@ digraph iCFG { -41 [label="41: BinaryOperatorStmt: Assign \n n$2=*&z:class Z * [line 65]\n *n$2.f:int =0 [line 65]\n REMOVE_TEMPS(n$2); [line 65]\n " shape="box"] +41 [label="41: BinaryOperatorStmt: Assign \n n$3=*&z:class Z * [line 65]\n *n$3.f:int =0 [line 65]\n REMOVE_TEMPS(n$3); [line 65]\n " shape="box"] 41 -> 40 ; -40 [label="40: Return Stmt \n n$0=*&z:class Z * [line 66]\n n$1=_fun_Z_getF(n$0:class Z *) [line 66]\n *&return:int =(1 / n$1) [line 66]\n REMOVE_TEMPS(n$0,n$1); [line 66]\n NULLIFY(&z,false); [line 66]\n APPLY_ABSTRACTION; [line 66]\n " shape="box"] +40 [label="40: Return Stmt \n n$0=*&z:class Z * [line 66]\n n$1=*n$0:class Z [line 66]\n n$2=_fun_Z_getF(n$0:class Z *) [line 66]\n *&return:int =(1 / n$2) [line 66]\n REMOVE_TEMPS(n$0,n$1,n$2); [line 66]\n NULLIFY(&z,false); [line 66]\n APPLY_ABSTRACTION; [line 66]\n " shape="box"] 40 -> 39 ; @@ -22,7 +22,7 @@ digraph iCFG { 36 -> 35 ; -35 [label="35: Return Stmt \n n$0=_fun_Z_getF(&z:class Z &) [line 58]\n *&return:int =(1 / n$0) [line 58]\n REMOVE_TEMPS(n$0); [line 58]\n NULLIFY(&z,false); [line 58]\n APPLY_ABSTRACTION; [line 58]\n " shape="box"] +35 [label="35: Return Stmt \n n$0=*&z:class Z [line 58]\n n$1=_fun_Z_getF(&z:class Z &) [line 58]\n *&return:int =(1 / n$1) [line 58]\n REMOVE_TEMPS(n$0,n$1); [line 58]\n NULLIFY(&z,false); [line 58]\n APPLY_ABSTRACTION; [line 58]\n " shape="box"] 35 -> 34 ; @@ -50,11 +50,11 @@ digraph iCFG { 29 -> 24 ; -28 [label="28: Prune (false branch) \n n$1=*&x.y:class Y * [line 49]\n PRUNE((n$1 == 0), false); [line 49]\n REMOVE_TEMPS(n$1); [line 49]\n " shape="invhouse"] +28 [label="28: Prune (false branch) \n n$2=*&x.y:class Y * [line 49]\n PRUNE((n$2 == 0), false); [line 49]\n REMOVE_TEMPS(n$2); [line 49]\n " shape="invhouse"] 28 -> 26 ; -27 [label="27: Prune (true branch) \n n$1=*&x.y:class Y * [line 49]\n PRUNE((n$1 != 0), true); [line 49]\n REMOVE_TEMPS(n$1); [line 49]\n " shape="invhouse"] +27 [label="27: Prune (true branch) \n n$2=*&x.y:class Y * [line 49]\n PRUNE((n$2 != 0), true); [line 49]\n REMOVE_TEMPS(n$2); [line 49]\n " shape="invhouse"] 27 -> 29 ; @@ -62,7 +62,7 @@ digraph iCFG { 26 -> 25 ; -25 [label="25: Return Stmt \n n$0=_fun_X_getF(&x:class X &) [line 52]\n *&return:int =(1 / n$0) [line 52]\n REMOVE_TEMPS(n$0); [line 52]\n NULLIFY(&x,false); [line 52]\n APPLY_ABSTRACTION; [line 52]\n " shape="box"] +25 [label="25: Return Stmt \n n$0=*&x:class X [line 52]\n n$1=_fun_X_getF(&x:class X &) [line 52]\n *&return:int =(1 / n$1) [line 52]\n REMOVE_TEMPS(n$0,n$1); [line 52]\n NULLIFY(&x,false); [line 52]\n APPLY_ABSTRACTION; [line 52]\n " shape="box"] 25 -> 24 ; @@ -73,11 +73,11 @@ digraph iCFG { 23 -> 32 ; -22 [label="22: BinaryOperatorStmt: Assign \n n$2=*&x:class X * [line 41]\n *n$2.f:int =0 [line 41]\n REMOVE_TEMPS(n$2); [line 41]\n " shape="box"] +22 [label="22: BinaryOperatorStmt: Assign \n n$3=*&x:class X * [line 41]\n *n$3.f:int =0 [line 41]\n REMOVE_TEMPS(n$3); [line 41]\n " shape="box"] 22 -> 21 ; -21 [label="21: Return Stmt \n n$0=*&x:class X * [line 42]\n n$1=_fun_X_getF(n$0:class X *) [line 42]\n *&return:int =(1 / n$1) [line 42]\n REMOVE_TEMPS(n$0,n$1); [line 42]\n NULLIFY(&x,false); [line 42]\n APPLY_ABSTRACTION; [line 42]\n " shape="box"] +21 [label="21: Return Stmt \n n$0=*&x:class X * [line 42]\n n$1=*n$0:class X [line 42]\n n$2=_fun_X_getF(n$0:class X *) [line 42]\n *&return:int =(1 / n$2) [line 42]\n REMOVE_TEMPS(n$0,n$1,n$2); [line 42]\n NULLIFY(&x,false); [line 42]\n APPLY_ABSTRACTION; [line 42]\n " shape="box"] 21 -> 20 ; @@ -96,7 +96,7 @@ digraph iCFG { 17 -> 16 ; -16 [label="16: Return Stmt \n n$0=_fun_X_getF(&x:class X &) [line 37]\n *&return:int =(1 / n$0) [line 37]\n REMOVE_TEMPS(n$0); [line 37]\n NULLIFY(&x,false); [line 37]\n APPLY_ABSTRACTION; [line 37]\n " shape="box"] +16 [label="16: Return Stmt \n n$0=*&x:class X [line 37]\n n$1=_fun_X_getF(&x:class X &) [line 37]\n *&return:int =(1 / n$1) [line 37]\n REMOVE_TEMPS(n$0,n$1); [line 37]\n NULLIFY(&x,false); [line 37]\n APPLY_ABSTRACTION; [line 37]\n " shape="box"] 16 -> 15 ; diff --git a/infer/tests/endtoend/cpp/NPEWhenMethodCallTest.java b/infer/tests/endtoend/cpp/NPEWhenMethodCallTest.java new file mode 100644 index 000000000..9c4210e3e --- /dev/null +++ b/infer/tests/endtoend/cpp/NPEWhenMethodCallTest.java @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2015 - present Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +package endtoend.cpp; + +import static org.hamcrest.MatcherAssert.assertThat; +import static utils.matchers.ResultContainsErrorInMethod.contains; +import static utils.matchers.ResultContainsExactly.containsExactly; +import static utils.matchers.ResultContainsNoErrorInMethod.doesNotContain; + +import com.google.common.collect.ImmutableList; + +import org.junit.BeforeClass; +import org.junit.ClassRule; +import org.junit.Test; + +import java.io.IOException; + +import utils.DebuggableTemporaryFolder; +import utils.InferException; +import utils.InferResults; +import utils.InferRunner; + +public class NPEWhenMethodCallTest { + + public static final String FILE = + "infer/tests/codetoanalyze/cpp/errors/npe/method_call.cpp"; + + private static ImmutableList inferCmd; + + public static final String NULL_DEREFERENCE = "NULL_DEREFERENCE"; + + @ClassRule + public static DebuggableTemporaryFolder folder = + new DebuggableTemporaryFolder(); + + @BeforeClass + public static void runInfer() throws InterruptedException, IOException { + inferCmd = InferRunner.createCPPInferCommand(folder, FILE); + } + + @Test + public void whenInferRunsOnMethodCallThenNoNPEFound() + throws InterruptedException, IOException, InferException { + InferResults inferResults = InferRunner.runInferCPP(inferCmd); + String[] procedures = {"npe_call", "npe_call_after_call", "npe_call_with_forward_declaration"}; + assertThat( + "Results should contain " + NULL_DEREFERENCE, + inferResults, + containsExactly( + NULL_DEREFERENCE, + FILE, + procedures + ) + ); + } +} diff --git a/infer/tests/frontend/cpp/NPETest.java b/infer/tests/frontend/cpp/NPETest.java new file mode 100644 index 000000000..1518d6592 --- /dev/null +++ b/infer/tests/frontend/cpp/NPETest.java @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2016 - present Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +package frontend.cpp; + +import org.junit.Rule; +import org.junit.Test; + +import java.io.IOException; + +import utils.ClangFrontendUtils; +import utils.DebuggableTemporaryFolder; +import utils.InferException; + +public class NPETest { + + + String methodBasePath = "infer/tests/codetoanalyze/cpp/errors/npe/"; + + @Rule + public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder(); + + void frontendTest(String fileRelative) throws InterruptedException, IOException, InferException { + ClangFrontendUtils.createAndCompareCppDotFiles(folder, methodBasePath + fileRelative); + } + + @Test + public void testInlineMethodDotFilesMatch() + throws InterruptedException, IOException, InferException { + frontendTest("method_call.cpp"); + } + + + +}