From 088293b6c2a9ca7af8b9eb1ce4f3d30070174359 Mon Sep 17 00:00:00 2001 From: Andrzej Kotulski Date: Wed, 4 Nov 2015 08:04:59 -0800 Subject: [PATCH] Add pointer type to argument of method call Summary: public Type of `this` argument to c++ method call has pointer type. It's either raw pointer (for `->`) or reference (for `.`). It was already correct in method declaration and method parameters, but it wasn't correct in method calls. Same thing will apply to constructor expressions. As a result of this change, we won't expand type when calling methods. Change to ast_expressions.ml fixes problem with autogenerating getters/setters that produced lvalue types after LValueToRValue cast. Reviewed By: dulmarod Differential Revision: D2605756 fb-gh-sync-id: 1027600 --- infer/src/clang/ast_expressions.ml | 4 +- infer/src/clang/cTrans.ml | 9 +-- .../frontend/keywords/self_parameter.cpp.dot | 2 +- .../methods/default_parameters.cpp.dot | 6 +- .../frontend/methods/dereference_this.cpp.dot | 2 +- .../frontend/methods/inline_method.cpp.dot | 4 +- .../cpp/frontend/methods/overloading.cpp.dot | 4 +- .../frontend/reference/member_access.cpp.dot | 4 +- .../member_access_from_return.cpp.dot | 4 +- .../reference/reference_struct_e2e.cpp.dot | 56 +++++++++---------- .../cpp/frontend/types/inheritance.cpp.dot | 12 ++-- 11 files changed, 52 insertions(+), 55 deletions(-) diff --git a/infer/src/clang/ast_expressions.ml b/infer/src/clang/ast_expressions.ml index dc807a253..8d684efa0 100644 --- a/infer/src/clang/ast_expressions.ml +++ b/infer/src/clang/ast_expressions.ml @@ -259,7 +259,7 @@ let make_obj_c_ivar_ref_expr_info k ptr n tp = { (* Build an AST cast expression of a decl_ref_expr *) let make_cast_expr tp di decl_ref_expr_info objc_kind = - let expr_info = make_expr_info_with_objc_kind tp objc_kind in + let expr_info = make_expr_info tp `RValue objc_kind in let stmt_info = make_stmt_info di in let decl_ref_exp = make_decl_ref_exp stmt_info expr_info decl_ref_expr_info in let cast_expr = { @@ -285,7 +285,7 @@ let make_self_field class_type di tp field_name = let make_deref_self_field class_decl_opt di tp field_name = let stmt_info = make_stmt_info di in let ivar_ref_exp = make_self_field class_decl_opt di tp field_name in - let expr_info' = make_expr_info_with_objc_kind tp `ObjCProperty in + let expr_info' = make_expr_info tp `RValue `ObjCProperty in let cast_exp_info = { Clang_ast_t.cei_cast_kind = `LValueToRValue; cei_base_path = []; diff --git a/infer/src/clang/cTrans.ml b/infer/src/clang/cTrans.ml index 903735e1c..b5290af85 100644 --- a/infer/src/clang/cTrans.ml +++ b/infer/src/clang/cTrans.ml @@ -403,12 +403,9 @@ struct assert (IList.length pre_trans_result.exps = 1); let (obj_sil, class_typ) = extract_exp_from_list pre_trans_result.exps "WARNING: in Method call we expect to know the object\n" in - let class_typ = - match class_typ with - | Sil.Tptr (t, _) -> CTypes.expand_structured_type context.CContext.tenv t - | t -> t in (* consider using context.CContext.is_callee_expression to deal with pointers to methods? *) - let class_name = CTypes.classname_of_type class_typ in + (* unlike field access, for method calls there is no need to expand class type *) + let class_name = match class_typ with Sil.Tptr (t, _) | t -> CTypes.classname_of_type t in let pname = CMethod_trans.create_procdesc_with_pointer context decl_ptr (Some class_name) method_name type_ptr in let method_exp = (Sil.Const (Sil.Cfun pname), method_typ) in @@ -1637,7 +1634,7 @@ struct and do_memb_ivar_ref_exp trans_state expr_info stmt_info stmt_list decl_ref = let exp_stmt = extract_stmt_from_singleton stmt_list "WARNING: in MemberExpr there must be only one stmt defining its expression.\n" in - let result_trans_exp_stmt = instruction trans_state exp_stmt in + let result_trans_exp_stmt = exec_with_lvalue_as_reference instruction trans_state exp_stmt in decl_ref_trans trans_state result_trans_exp_stmt stmt_info expr_info decl_ref and objCIvarRefExpr_trans trans_state stmt_info expr_info stmt_list obj_c_ivar_ref_expr_info = 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 4caf8c0c3..1727fd0fe 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 22]\n n$1=_fun_A_meth_with_self(n$0:class A ,1:int ,2:int ) [line 22]\n n$2=_fun_fun_with_self(10:int ) [line 22]\n *&return:int =(n$1 + n$2) [line 22]\n REMOVE_TEMPS(n$0,n$1,n$2); [line 22]\n NULLIFY(&a,false); [line 22]\n APPLY_ABSTRACTION; [line 22]\n " shape="box"] +9 [label="9: Return Stmt \n n$0=*&a:class A * [line 22]\n n$1=_fun_A_meth_with_self(n$0:class A *,1:int ,2:int ) [line 22]\n n$2=_fun_fun_with_self(10:int ) [line 22]\n *&return:int =(n$1 + n$2) [line 22]\n REMOVE_TEMPS(n$0,n$1,n$2); [line 22]\n NULLIFY(&a,false); [line 22]\n APPLY_ABSTRACTION; [line 22]\n " shape="box"] 9 -> 8 ; 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 d8393ce52..b869fe59f 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$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 -> 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$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 -> 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=_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 -> 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 a0c0ac461..8a62154b0 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 24]\n n$1=_fun_A_method(n$0:class A ) [line 24]\n REMOVE_TEMPS(n$0,n$1); [line 24]\n NULLIFY(&a_ptr,false); [line 24]\n APPLY_ABSTRACTION; [line 24]\n " shape="box"] +10 [label="10: Call _fun_A_method \n n$0=*&a_ptr:class A * [line 24]\n n$1=_fun_A_method(n$0:class A *) [line 24]\n REMOVE_TEMPS(n$0,n$1); [line 24]\n NULLIFY(&a_ptr,false); [line 24]\n APPLY_ABSTRACTION; [line 24]\n " shape="box"] 10 -> 9 ; 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 939d625c7..16a91a45f 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 21]\n n$4=_fun_A_fun(n$3:class A ) [line 21]\n REMOVE_TEMPS(n$3,n$4); [line 21]\n " shape="box"] +11 [label="11: Call _fun_A_fun \n n$3=*&a_ptr:class A * [line 21]\n n$4=_fun_A_fun(n$3:class A *) [line 21]\n REMOVE_TEMPS(n$3,n$4); [line 21]\n " shape="box"] 11 -> 10 ; -10 [label="10: Call _fun_A::AIn_fun \n n$0=*&a_ptr:class A * [line 22]\n n$1=*n$0.in:class A::AIn * [line 22]\n n$2=_fun_A::AIn_fun(n$1:class A::AIn ) [line 22]\n REMOVE_TEMPS(n$0,n$1,n$2); [line 22]\n NULLIFY(&a_ptr,false); [line 22]\n APPLY_ABSTRACTION; [line 22]\n " shape="box"] +10 [label="10: Call _fun_A::AIn_fun \n n$0=*&a_ptr:class A * [line 22]\n n$1=*n$0.in:class A::AIn * [line 22]\n n$2=_fun_A::AIn_fun(n$1:class A::AIn *) [line 22]\n REMOVE_TEMPS(n$0,n$1,n$2); [line 22]\n NULLIFY(&a_ptr,false); [line 22]\n APPLY_ABSTRACTION; [line 22]\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 78065c4e5..c6e87bd13 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 26]\n n$3=_fun_A_fun(n$2:class A ,1:int ,2:int ) [line 26]\n REMOVE_TEMPS(n$2,n$3); [line 26]\n " shape="box"] +10 [label="10: Call _fun_A_fun \n n$2=*&a_ptr:class A * [line 26]\n n$3=_fun_A_fun(n$2:class A *,1:int ,2:int ) [line 26]\n REMOVE_TEMPS(n$2,n$3); [line 26]\n " shape="box"] 10 -> 9 ; -9 [label="9: Call _fun_A_fun \n n$0=*&a_ptr:class A * [line 27]\n n$1=_fun_A_fun(n$0:class A ,1:int ,2:int ,3:int ) [line 27]\n REMOVE_TEMPS(n$0,n$1); [line 27]\n NULLIFY(&a_ptr,false); [line 27]\n APPLY_ABSTRACTION; [line 27]\n " shape="box"] +9 [label="9: Call _fun_A_fun \n n$0=*&a_ptr:class A * [line 27]\n n$1=_fun_A_fun(n$0:class A *,1:int ,2:int ,3:int ) [line 27]\n REMOVE_TEMPS(n$0,n$1); [line 27]\n NULLIFY(&a_ptr,false); [line 27]\n APPLY_ABSTRACTION; [line 27]\n " shape="box"] 9 -> 8 ; 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 f1a2f797e..88099fceb 100644 --- a/infer/tests/codetoanalyze/cpp/frontend/reference/member_access.cpp.dot +++ b/infer/tests/codetoanalyze/cpp/frontend/reference/member_access.cpp.dot @@ -3,7 +3,7 @@ digraph iCFG { 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=_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 -> 9 ; @@ -18,7 +18,7 @@ digraph iCFG { 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=_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 -> 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 121a65cea..c25e60581 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 @@ -3,7 +3,7 @@ digraph iCFG { 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=_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 -> 17 ; @@ -18,7 +18,7 @@ digraph iCFG { 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=_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 -> 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 bbe8a5b8a..2a5ca16d6 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,5 +1,5 @@ digraph iCFG { -119 [label="119: Call _fun_X_zero \n n$3=_fun_get_global_ref() [line 136]\n _fun_X_zero(n$3:class X ) [line 136]\n REMOVE_TEMPS(n$3); [line 136]\n " shape="box"] +119 [label="119: Call _fun_X_zero \n n$3=_fun_get_global_ref() [line 136]\n _fun_X_zero(n$3:class X &) [line 136]\n REMOVE_TEMPS(n$3); [line 136]\n " shape="box"] 119 -> 118 ; @@ -7,7 +7,7 @@ digraph iCFG { 118 -> 117 ; -117 [label="117: Call _fun_X_div \n n$0=_fun_get_global_ref() [line 138]\n n$1=_fun_X_div(n$0:class X ) [line 138]\n REMOVE_TEMPS(n$0,n$1); [line 138]\n APPLY_ABSTRACTION; [line 138]\n " shape="box"] +117 [label="117: Call _fun_X_div \n n$0=_fun_get_global_ref() [line 138]\n n$1=_fun_X_div(n$0:class X &) [line 138]\n REMOVE_TEMPS(n$0,n$1); [line 138]\n APPLY_ABSTRACTION; [line 138]\n " shape="box"] 117 -> 116 ; @@ -18,7 +18,7 @@ digraph iCFG { 115 -> 119 ; -114 [label="114: Call _fun_X_nonzero \n n$3=_fun_get_global_ref() [line 130]\n _fun_X_nonzero(n$3:class X ) [line 130]\n REMOVE_TEMPS(n$3); [line 130]\n " shape="box"] +114 [label="114: Call _fun_X_nonzero \n n$3=_fun_get_global_ref() [line 130]\n _fun_X_nonzero(n$3:class X &) [line 130]\n REMOVE_TEMPS(n$3); [line 130]\n " shape="box"] 114 -> 113 ; @@ -26,7 +26,7 @@ digraph iCFG { 113 -> 112 ; -112 [label="112: Call _fun_X_div \n n$0=_fun_get_global_ref() [line 132]\n n$1=_fun_X_div(n$0:class X ) [line 132]\n REMOVE_TEMPS(n$0,n$1); [line 132]\n APPLY_ABSTRACTION; [line 132]\n " shape="box"] +112 [label="112: Call _fun_X_div \n n$0=_fun_get_global_ref() [line 132]\n n$1=_fun_X_div(n$0:class X &) [line 132]\n REMOVE_TEMPS(n$0,n$1); [line 132]\n APPLY_ABSTRACTION; [line 132]\n " shape="box"] 112 -> 111 ; @@ -41,11 +41,11 @@ digraph iCFG { 109 -> 108 ; -108 [label="108: Call _fun_X_nonzero \n n$2=_fun_get_global_ref() [line 125]\n _fun_X_nonzero(n$2:class X ) [line 125]\n REMOVE_TEMPS(n$2); [line 125]\n " shape="box"] +108 [label="108: Call _fun_X_nonzero \n n$2=_fun_get_global_ref() [line 125]\n _fun_X_nonzero(n$2:class X &) [line 125]\n REMOVE_TEMPS(n$2); [line 125]\n " shape="box"] 108 -> 107 ; -107 [label="107: 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"] +107 [label="107: 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"] 107 -> 106 ; @@ -60,11 +60,11 @@ digraph iCFG { 104 -> 103 ; -103 [label="103: Call _fun_X_zero \n n$2=_fun_get_global_ref() [line 119]\n _fun_X_zero(n$2:class X ) [line 119]\n REMOVE_TEMPS(n$2); [line 119]\n " shape="box"] +103 [label="103: Call _fun_X_zero \n n$2=_fun_get_global_ref() [line 119]\n _fun_X_zero(n$2:class X &) [line 119]\n REMOVE_TEMPS(n$2); [line 119]\n " shape="box"] 103 -> 102 ; -102 [label="102: 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"] +102 [label="102: 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"] 102 -> 101 ; @@ -79,7 +79,7 @@ digraph iCFG { 99 -> 98 ; -98 [label="98: Return Stmt \n n$0=*&x:class X & [line 114]\n n$1=_fun_X_div(n$0:class X ) [line 114]\n *&return:int =n$1 [line 114]\n REMOVE_TEMPS(n$0,n$1); [line 114]\n NULLIFY(&x,false); [line 114]\n APPLY_ABSTRACTION; [line 114]\n " shape="box"] +98 [label="98: Return Stmt \n n$0=*&x:class X & [line 114]\n n$1=_fun_X_div(n$0:class X &) [line 114]\n *&return:int =n$1 [line 114]\n REMOVE_TEMPS(n$0,n$1); [line 114]\n NULLIFY(&x,false); [line 114]\n APPLY_ABSTRACTION; [line 114]\n " shape="box"] 98 -> 97 ; @@ -94,7 +94,7 @@ digraph iCFG { 95 -> 94 ; -94 [label="94: Return Stmt \n n$0=*&x:class X & [line 109]\n n$1=_fun_X_div(n$0:class X ) [line 109]\n *&return:int =n$1 [line 109]\n REMOVE_TEMPS(n$0,n$1); [line 109]\n NULLIFY(&x,false); [line 109]\n APPLY_ABSTRACTION; [line 109]\n " shape="box"] +94 [label="94: Return Stmt \n n$0=*&x:class X & [line 109]\n n$1=_fun_X_div(n$0:class X &) [line 109]\n *&return:int =n$1 [line 109]\n REMOVE_TEMPS(n$0,n$1); [line 109]\n NULLIFY(&x,false); [line 109]\n APPLY_ABSTRACTION; [line 109]\n " shape="box"] 94 -> 93 ; @@ -109,7 +109,7 @@ digraph iCFG { 91 -> 90 ; -90 [label="90: Return Stmt \n n$0=*&x:class X & [line 104]\n n$1=_fun_X_div(n$0:class X ) [line 104]\n *&return:int =n$1 [line 104]\n REMOVE_TEMPS(n$0,n$1); [line 104]\n NULLIFY(&x,false); [line 104]\n APPLY_ABSTRACTION; [line 104]\n " shape="box"] +90 [label="90: Return Stmt \n n$0=*&x:class X & [line 104]\n n$1=_fun_X_div(n$0:class X &) [line 104]\n *&return:int =n$1 [line 104]\n REMOVE_TEMPS(n$0,n$1); [line 104]\n NULLIFY(&x,false); [line 104]\n APPLY_ABSTRACTION; [line 104]\n " shape="box"] 90 -> 89 ; @@ -124,7 +124,7 @@ digraph iCFG { 87 -> 86 ; -86 [label="86: Return Stmt \n n$0=*&x:class X & [line 99]\n n$1=_fun_X_div(n$0:class X ) [line 99]\n *&return:int =n$1 [line 99]\n REMOVE_TEMPS(n$0,n$1); [line 99]\n NULLIFY(&x,false); [line 99]\n APPLY_ABSTRACTION; [line 99]\n " shape="box"] +86 [label="86: Return Stmt \n n$0=*&x:class X & [line 99]\n n$1=_fun_X_div(n$0:class X &) [line 99]\n *&return:int =n$1 [line 99]\n REMOVE_TEMPS(n$0,n$1); [line 99]\n NULLIFY(&x,false); [line 99]\n APPLY_ABSTRACTION; [line 99]\n " shape="box"] 86 -> 85 ; @@ -135,7 +135,7 @@ digraph iCFG { 84 -> 87 ; -83 [label="83: Call _fun_X_zero \n n$3=_fun_get_global_ptr() [line 92]\n _fun_X_zero(n$3:class X ) [line 92]\n REMOVE_TEMPS(n$3); [line 92]\n " shape="box"] +83 [label="83: Call _fun_X_zero \n n$3=_fun_get_global_ptr() [line 92]\n _fun_X_zero(n$3:class X *) [line 92]\n REMOVE_TEMPS(n$3); [line 92]\n " shape="box"] 83 -> 82 ; @@ -143,7 +143,7 @@ digraph iCFG { 82 -> 81 ; -81 [label="81: Call _fun_X_div \n n$0=_fun_get_global_ptr() [line 94]\n n$1=_fun_X_div(n$0:class X ) [line 94]\n REMOVE_TEMPS(n$0,n$1); [line 94]\n APPLY_ABSTRACTION; [line 94]\n " shape="box"] +81 [label="81: Call _fun_X_div \n n$0=_fun_get_global_ptr() [line 94]\n n$1=_fun_X_div(n$0:class X *) [line 94]\n REMOVE_TEMPS(n$0,n$1); [line 94]\n APPLY_ABSTRACTION; [line 94]\n " shape="box"] 81 -> 80 ; @@ -154,7 +154,7 @@ digraph iCFG { 79 -> 83 ; -78 [label="78: Call _fun_X_nonzero \n n$3=_fun_get_global_ptr() [line 86]\n _fun_X_nonzero(n$3:class X ) [line 86]\n REMOVE_TEMPS(n$3); [line 86]\n " shape="box"] +78 [label="78: Call _fun_X_nonzero \n n$3=_fun_get_global_ptr() [line 86]\n _fun_X_nonzero(n$3:class X *) [line 86]\n REMOVE_TEMPS(n$3); [line 86]\n " shape="box"] 78 -> 77 ; @@ -162,7 +162,7 @@ digraph iCFG { 77 -> 76 ; -76 [label="76: Call _fun_X_div \n n$0=_fun_get_global_ptr() [line 88]\n n$1=_fun_X_div(n$0:class X ) [line 88]\n REMOVE_TEMPS(n$0,n$1); [line 88]\n APPLY_ABSTRACTION; [line 88]\n " shape="box"] +76 [label="76: Call _fun_X_div \n n$0=_fun_get_global_ptr() [line 88]\n n$1=_fun_X_div(n$0:class X *) [line 88]\n REMOVE_TEMPS(n$0,n$1); [line 88]\n APPLY_ABSTRACTION; [line 88]\n " shape="box"] 76 -> 75 ; @@ -177,11 +177,11 @@ digraph iCFG { 73 -> 72 ; -72 [label="72: Call _fun_X_nonzero \n n$2=_fun_get_global_ptr() [line 81]\n _fun_X_nonzero(n$2:class X ) [line 81]\n REMOVE_TEMPS(n$2); [line 81]\n " shape="box"] +72 [label="72: Call _fun_X_nonzero \n n$2=_fun_get_global_ptr() [line 81]\n _fun_X_nonzero(n$2:class X *) [line 81]\n REMOVE_TEMPS(n$2); [line 81]\n " shape="box"] 72 -> 71 ; -71 [label="71: 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"] +71 [label="71: 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"] 71 -> 70 ; @@ -196,11 +196,11 @@ digraph iCFG { 68 -> 67 ; -67 [label="67: Call _fun_X_zero \n n$2=_fun_get_global_ptr() [line 75]\n _fun_X_zero(n$2:class X ) [line 75]\n REMOVE_TEMPS(n$2); [line 75]\n " shape="box"] +67 [label="67: Call _fun_X_zero \n n$2=_fun_get_global_ptr() [line 75]\n _fun_X_zero(n$2:class X *) [line 75]\n REMOVE_TEMPS(n$2); [line 75]\n " shape="box"] 67 -> 66 ; -66 [label="66: 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"] +66 [label="66: 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"] 66 -> 65 ; @@ -215,7 +215,7 @@ digraph iCFG { 63 -> 62 ; -62 [label="62: Return Stmt \n n$1=*&x:class X * [line 69]\n n$2=_fun_X_div(n$1:class X ) [line 69]\n *&return:int =n$2 [line 69]\n REMOVE_TEMPS(n$1,n$2); [line 69]\n NULLIFY(&x,false); [line 69]\n APPLY_ABSTRACTION; [line 69]\n " shape="box"] +62 [label="62: Return Stmt \n n$1=*&x:class X * [line 69]\n n$2=_fun_X_div(n$1:class X *) [line 69]\n *&return:int =n$2 [line 69]\n REMOVE_TEMPS(n$1,n$2); [line 69]\n NULLIFY(&x,false); [line 69]\n APPLY_ABSTRACTION; [line 69]\n " shape="box"] 62 -> 58 ; @@ -243,7 +243,7 @@ digraph iCFG { 56 -> 55 ; -55 [label="55: Return Stmt \n n$1=*&x:class X * [line 62]\n n$2=_fun_X_div(n$1:class X ) [line 62]\n *&return:int =n$2 [line 62]\n REMOVE_TEMPS(n$1,n$2); [line 62]\n NULLIFY(&x,false); [line 62]\n APPLY_ABSTRACTION; [line 62]\n " shape="box"] +55 [label="55: Return Stmt \n n$1=*&x:class X * [line 62]\n n$2=_fun_X_div(n$1:class X *) [line 62]\n *&return:int =n$2 [line 62]\n REMOVE_TEMPS(n$1,n$2); [line 62]\n NULLIFY(&x,false); [line 62]\n APPLY_ABSTRACTION; [line 62]\n " shape="box"] 55 -> 51 ; @@ -271,7 +271,7 @@ digraph iCFG { 49 -> 48 ; -48 [label="48: Return Stmt \n n$1=*&x:class X * [line 55]\n n$2=_fun_X_div(n$1:class X ) [line 55]\n *&return:int =n$2 [line 55]\n REMOVE_TEMPS(n$1,n$2); [line 55]\n NULLIFY(&x,false); [line 55]\n APPLY_ABSTRACTION; [line 55]\n " shape="box"] +48 [label="48: Return Stmt \n n$1=*&x:class X * [line 55]\n n$2=_fun_X_div(n$1:class X *) [line 55]\n *&return:int =n$2 [line 55]\n REMOVE_TEMPS(n$1,n$2); [line 55]\n NULLIFY(&x,false); [line 55]\n APPLY_ABSTRACTION; [line 55]\n " shape="box"] 48 -> 44 ; @@ -299,7 +299,7 @@ digraph iCFG { 42 -> 41 ; -41 [label="41: Return Stmt \n n$1=*&x:class X * [line 48]\n n$2=_fun_X_div(n$1:class X ) [line 48]\n *&return:int =n$2 [line 48]\n REMOVE_TEMPS(n$1,n$2); [line 48]\n NULLIFY(&x,false); [line 48]\n APPLY_ABSTRACTION; [line 48]\n " shape="box"] +41 [label="41: Return Stmt \n n$1=*&x:class X * [line 48]\n n$2=_fun_X_div(n$1:class X *) [line 48]\n *&return:int =n$2 [line 48]\n REMOVE_TEMPS(n$1,n$2); [line 48]\n NULLIFY(&x,false); [line 48]\n APPLY_ABSTRACTION; [line 48]\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 34]\n _fun_X_nonzero(n$0:class X ) [line 34]\n REMOVE_TEMPS(n$0); [line 34]\n NULLIFY(&x,false); [line 34]\n APPLY_ABSTRACTION; [line 34]\n " shape="box"] +26 [label="26: Call _fun_X_nonzero \n n$0=*&x:class X & [line 34]\n _fun_X_nonzero(n$0:class X &) [line 34]\n REMOVE_TEMPS(n$0); [line 34]\n NULLIFY(&x,false); [line 34]\n APPLY_ABSTRACTION; [line 34]\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 30]\n _fun_X_zero(n$0: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"] +23 [label="23: Call _fun_X_zero \n n$0=*&x:class X & [line 30]\n _fun_X_zero(n$0: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"] 23 -> 22 ; @@ -389,7 +389,7 @@ digraph iCFG { 18 -> 20 ; -17 [label="17: Call _fun_X_nonzero \n n$0=*&x:class X * [line 22]\n _fun_X_nonzero(n$0:class X ) [line 22]\n REMOVE_TEMPS(n$0); [line 22]\n NULLIFY(&x,false); [line 22]\n APPLY_ABSTRACTION; [line 22]\n " shape="box"] +17 [label="17: Call _fun_X_nonzero \n n$0=*&x:class X * [line 22]\n _fun_X_nonzero(n$0:class X *) [line 22]\n REMOVE_TEMPS(n$0); [line 22]\n NULLIFY(&x,false); [line 22]\n APPLY_ABSTRACTION; [line 22]\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 18]\n _fun_X_zero(n$0:class X ) [line 18]\n REMOVE_TEMPS(n$0); [line 18]\n NULLIFY(&x,false); [line 18]\n APPLY_ABSTRACTION; [line 18]\n " shape="box"] +14 [label="14: Call _fun_X_zero \n n$0=*&x:class X * [line 18]\n _fun_X_zero(n$0:class X *) [line 18]\n REMOVE_TEMPS(n$0); [line 18]\n NULLIFY(&x,false); [line 18]\n APPLY_ABSTRACTION; [line 18]\n " shape="box"] 14 -> 13 ; diff --git a/infer/tests/codetoanalyze/cpp/frontend/types/inheritance.cpp.dot b/infer/tests/codetoanalyze/cpp/frontend/types/inheritance.cpp.dot index 87c30c53d..68df41736 100644 --- a/infer/tests/codetoanalyze/cpp/frontend/types/inheritance.cpp.dot +++ b/infer/tests/codetoanalyze/cpp/frontend/types/inheritance.cpp.dot @@ -11,27 +11,27 @@ digraph iCFG { 22 -> 21 ; -21 [label="21: 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"] +21 [label="21: 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"] 21 -> 20 ; -20 [label="20: 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"] +20 [label="20: 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"] 20 -> 19 ; -19 [label="19: Call _fun_Base_fun \n n$6=*&s2:class Sub * [line 28]\n n$7=_fun_Base_fun(n$6:class Base ) [line 28]\n REMOVE_TEMPS(n$6,n$7); [line 28]\n " shape="box"] +19 [label="19: Call _fun_Base_fun \n n$6=*&s2:class Sub * [line 28]\n n$7=_fun_Base_fun(n$6:class Base *) [line 28]\n REMOVE_TEMPS(n$6,n$7); [line 28]\n " shape="box"] 19 -> 18 ; -18 [label="18: 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"] +18 [label="18: 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"] 18 -> 17 ; -17 [label="17: 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"] +17 [label="17: 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"] 17 -> 16 ; -16 [label="16: 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"] +16 [label="16: 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"] 16 -> 15 ;