Summary: We do not inject a destructor call if the destructor declaration does not contain a body in AST. We miss all the cases where the destructor is declared in `.h` file and defined in `.cpp` file as other files include `.h` file and do not contain the body of the destructor when destructor calls are being injected based on AST information. After this diff we inject destructor calls even if we do not have body for the destructor in AST.
Reviewed By: sblackshear
Differential Revision: D6796567
fbshipit-source-id: 1c187ec
master
Daiva Naudziuniene7 years agocommitted byFacebook Github Bot
INFER_MODEL/cpp/include/infer_model/unique_ptr.h, std::operator!=<65d659492edc5cb5>, 1, Abduction_case_not_implemented, [start of procedure std::operator!=<65d659492edc5cb5>()]
INFER_MODEL/cpp/include/infer_model/unique_ptr.h, std::unique_ptr<int,unique_ptr_with_deleter::Deleter<int>>___infer_inner_destructor_~unique_ptr, 0, Missing_fld, [start of procedure __infer_inner_destructor_~unique_ptr,start of procedure Pointer,return from a call to unique_ptr_with_deleter::Pointer<int>_Pointer,start of procedure Pointer,return from a call to unique_ptr_with_deleter::Pointer<int>_Pointer]
INFER_MODEL/cpp/include/infer_model/unique_ptr.h, std::unique_ptr<int[_*4],unique_ptr_with_deleter::Deleter<int[_*4]>>___infer_inner_destructor_~unique_ptr, 0, Missing_fld, [start of procedure __infer_inner_destructor_~unique_ptr,start of procedure Pointer,return from a call to unique_ptr_with_deleter::Pointer<int[_*4]>_Pointer,start of procedure Pointer,return from a call to unique_ptr_with_deleter::Pointer<int[_*4]>_Pointer]
codetoanalyze/cpp/errors/c_tests/c_bugs.cpp, crash_fgetc, 4, NULL_DEREFERENCE, [start of procedure crash_fgetc()]
codetoanalyze/cpp/errors/c_tests/c_bugs.cpp, crash_getc, 4, NULL_DEREFERENCE, [start of procedure crash_getc()]
codetoanalyze/cpp/errors/c_tests/c_bugs.cpp, malloc_fail_gets_reported, 2, NULL_DEREFERENCE, [start of procedure malloc_fail_gets_reported()]
codetoanalyze/cpp/errors/vector/empty_access.cpp, clear_empty, 3, EMPTY_VECTOR_ACCESS, [start of procedure clear_empty()]
codetoanalyze/cpp/errors/vector/empty_access.cpp, copy_empty, 3, EMPTY_VECTOR_ACCESS, [start of procedure copy_empty()]
codetoanalyze/cpp/errors/vector/empty_access.cpp, empty_check_access_empty, 2, EMPTY_VECTOR_ACCESS, [start of procedure empty_check_access_empty(),Condition is true]
codetoanalyze/cpp/errors/vector/empty_access.cpp, getter_empty, 0, EMPTY_VECTOR_ACCESS, [start of procedure getter_empty(),start of procedure get_vector(),return from a call to get_vector]
codetoanalyze/cpp/errors/vector/empty_access.cpp, getter_empty, 0, EMPTY_VECTOR_ACCESS, [start of procedure getter_empty(),start of procedure get_vector(),Skipping ~vector: function or method not found,return from a call to get_vector]
codetoanalyze/cpp/errors/vector/empty_access.cpp, size_check0_empty, 2, EMPTY_VECTOR_ACCESS, [start of procedure size_check0_empty(),Condition is true]
codetoanalyze/cpp/errors/vector/empty_access.cpp, vector_as_param_by_value_empty, 2, EMPTY_VECTOR_ACCESS, [start of procedure vector_as_param_by_value_empty(),start of procedure vector_param_by_value_access(),return from a call to vector_param_by_value_access]
codetoanalyze/cpp/errors/vector/empty_access.cpp, vector_as_param_clear, 3, EMPTY_VECTOR_ACCESS, [start of procedure vector_as_param_clear(),start of procedure vector_param_clear(),return from a call to vector_param_clear]
codetoanalyze/cpp/shared/constructors/copy_array_field.cpp, copy_array_field::npe, 4, NULL_DEREFERENCE, [start of procedure copy_array_field::npe(),start of procedure X,return from a call to copy_array_field::X_X,start of procedure X,return from a call to copy_array_field::X_X]
codetoanalyze/cpp/shared/constructors/copy_move_constructor.cpp, copy_move_constructor::copyX_div0, 4, DIVIDE_BY_ZERO, [start of procedure copy_move_constructor::copyX_div0(),start of procedure X,return from a call to copy_move_constructor::X_X,start of procedure X,return from a call to copy_move_constructor::X_X]
codetoanalyze/cpp/shared/constructors/copy_move_constructor.cpp, copy_move_constructor::copyY_div0, 4, DIVIDE_BY_ZERO, [start of procedure copy_move_constructor::copyY_div0(),start of procedure Y,return from a call to copy_move_constructor::Y_Y,start of procedure Y,return from a call to copy_move_constructor::Y_Y]
codetoanalyze/cpp/shared/constructors/copy_move_constructor.cpp, copy_move_constructor::moveX_div0, 0, DIVIDE_BY_ZERO, [start of procedure copy_move_constructor::moveX_div0(),start of procedure copy_move_constructor::getX(),start of procedure X,return from a call to copy_move_constructor::X_X,start of procedure X,return from a call to copy_move_constructor::X_X,return from a call to copy_move_constructor::getX]
codetoanalyze/cpp/shared/constructors/copy_move_constructor.cpp, copy_move_constructor::moveY_div0, 0, DIVIDE_BY_ZERO, [start of procedure copy_move_constructor::moveY_div0(),start of procedure copy_move_constructor::getY(),start of procedure Y,return from a call to copy_move_constructor::Y_Y,start of procedure Y,return from a call to copy_move_constructor::Y_Y,return from a call to copy_move_constructor::getY]
codetoanalyze/cpp/shared/constructors/copy_move_constructor.cpp, copy_move_constructor::moveY_moveY_copyY_div0, 3, DIVIDE_BY_ZERO, [start of procedure copy_move_constructor::moveY_moveY_copyY_div0(),start of procedure copy_move_constructor::getY(),start of procedure Y,return from a call to copy_move_constructor::Y_Y,start of procedure Y,return from a call to copy_move_constructor::Y_Y,return from a call to copy_move_constructor::getY,start of procedure Y,return from a call to copy_move_constructor::Y_Y,start of procedure Y,return from a call to copy_move_constructor::Y_Y]
codetoanalyze/cpp/shared/constructors/copy_move_constructor.cpp, copy_move_constructor::moveX_div0, 0, DIVIDE_BY_ZERO, [start of procedure copy_move_constructor::moveX_div0(),start of procedure copy_move_constructor::getX(),start of procedure X,return from a call to copy_move_constructor::X_X,start of procedure X,return from a call to copy_move_constructor::X_X,Skipping ~X: function or method not found,return from a call to copy_move_constructor::getX]
codetoanalyze/cpp/shared/constructors/copy_move_constructor.cpp, copy_move_constructor::moveY_div0, 0, DIVIDE_BY_ZERO, [start of procedure copy_move_constructor::moveY_div0(),start of procedure copy_move_constructor::getY(),start of procedure Y,return from a call to copy_move_constructor::Y_Y,start of procedure Y,return from a call to copy_move_constructor::Y_Y,Skipping ~Y: function or method not found,return from a call to copy_move_constructor::getY]
codetoanalyze/cpp/shared/constructors/copy_move_constructor.cpp, copy_move_constructor::moveY_moveY_copyY_div0, 3, DIVIDE_BY_ZERO, [start of procedure copy_move_constructor::moveY_moveY_copyY_div0(),start of procedure copy_move_constructor::getY(),start of procedure Y,return from a call to copy_move_constructor::Y_Y,start of procedure Y,return from a call to copy_move_constructor::Y_Y,Skipping ~Y: function or method not found,return from a call to copy_move_constructor::getY,start of procedure Y,return from a call to copy_move_constructor::Y_Y,start of procedure Y,return from a call to copy_move_constructor::Y_Y]
codetoanalyze/cpp/shared/constructors/temp_object.cpp, temp_object::assign_temp_div0, 2, DIVIDE_BY_ZERO, [start of procedure temp_object::assign_temp_div0(),start of procedure X,return from a call to temp_object::X_X,start of procedure X,return from a call to temp_object::X_X,start of procedure div]
codetoanalyze/cpp/shared/constructors/temp_object.cpp, temp_object::getX_field_div0, 0, DIVIDE_BY_ZERO, [start of procedure temp_object::getX_field_div0(),start of procedure temp_object::getX(),start of procedure X,return from a call to temp_object::X_X,start of procedure X,return from a call to temp_object::X_X,return from a call to temp_object::getX,start of procedure temp_object::div()]
codetoanalyze/cpp/shared/constructors/temp_object.cpp, temp_object::getX_method_div0, 0, DIVIDE_BY_ZERO, [start of procedure temp_object::getX_method_div0(),start of procedure temp_object::getX(),start of procedure X,return from a call to temp_object::X_X,start of procedure X,return from a call to temp_object::X_X,return from a call to temp_object::getX,start of procedure div]
@ -354,8 +356,8 @@ codetoanalyze/cpp/shared/templates/method.cpp, method::div0_getter_templ2, 4, DI
codetoanalyze/cpp/shared/types/const.cpp, call_const_params_with_pointer1, 2, NULL_DEREFERENCE, [start of procedure call_const_params_with_pointer1(),start of procedure const_in_param1()]
codetoanalyze/cpp/shared/types/const.cpp, call_const_params_with_pointer2, 2, NULL_DEREFERENCE, [start of procedure call_const_params_with_pointer2(),start of procedure const_in_param2()]
codetoanalyze/cpp/shared/types/const.cpp, call_const_params_with_pointer3, 2, NULL_DEREFERENCE, [start of procedure call_const_params_with_pointer3(),start of procedure const_in_param2()]
codetoanalyze/cpp/shared/types/inheritance_casts.cpp, inheritance_casts::div0_A, 0, DIVIDE_BY_ZERO, [start of procedure inheritance_casts::div0_A(),start of procedure inheritance_casts::getA(),start of procedure A,return from a call to inheritance_casts::A_A,start of procedure A,return from a call to inheritance_casts::A_A,return from a call to inheritance_casts::getA,start of procedure inheritance_casts::div()]
codetoanalyze/cpp/shared/types/inheritance_casts.cpp, inheritance_casts::div0_B, 0, DIVIDE_BY_ZERO, [start of procedure inheritance_casts::div0_B(),start of procedure inheritance_casts::getB(),start of procedure B,start of procedure A,return from a call to inheritance_casts::A_A,return from a call to inheritance_casts::B_B,start of procedure B,start of procedure A,return from a call to inheritance_casts::A_A,return from a call to inheritance_casts::B_B,return from a call to inheritance_casts::getB,start of procedure inheritance_casts::div()]
codetoanalyze/cpp/shared/types/inheritance_casts.cpp, inheritance_casts::div0_A, 0, DIVIDE_BY_ZERO, [start of procedure inheritance_casts::div0_A(),start of procedure inheritance_casts::getA(),start of procedure A,return from a call to inheritance_casts::A_A,start of procedure A,return from a call to inheritance_casts::A_A,Skipping ~A: function or method not found,return from a call to inheritance_casts::getA,start of procedure inheritance_casts::div()]
codetoanalyze/cpp/shared/types/inheritance_casts.cpp, inheritance_casts::div0_B, 0, DIVIDE_BY_ZERO, [start of procedure inheritance_casts::div0_B(),start of procedure inheritance_casts::getB(),start of procedure B,start of procedure A,return from a call to inheritance_casts::A_A,return from a call to inheritance_casts::B_B,start of procedure B,start of procedure A,return from a call to inheritance_casts::A_A,return from a call to inheritance_casts::B_B,Skipping ~B: function or method not found,return from a call to inheritance_casts::getB,start of procedure inheritance_casts::div()]
codetoanalyze/cpp/shared/types/inheritance_field.cpp, div0_b1, 2, DIVIDE_BY_ZERO, [start of procedure div0_b1()]
codetoanalyze/cpp/shared/types/inheritance_field.cpp, div0_b1_s, 3, DIVIDE_BY_ZERO, [start of procedure div0_b1_s()]
codetoanalyze/cpp/shared/types/inheritance_field.cpp, div0_b2, 2, DIVIDE_BY_ZERO, [start of procedure div0_b2()]
@ -368,9 +370,9 @@ codetoanalyze/cpp/shared/types/operator_overload.cpp, div0_inheritted_op, 2, DIV
codetoanalyze/cpp/shared/types/operator_overload.cpp, div0_method, 3, DIVIDE_BY_ZERO, [start of procedure div0_method(),start of procedure operator[],return from a call to X_operator[]]
codetoanalyze/cpp/shared/types/operator_overload.cpp, div0_method_op, 3, DIVIDE_BY_ZERO, [start of procedure div0_method_op(),start of procedure operator[],return from a call to X_operator[]]
codetoanalyze/cpp/shared/types/operator_overload.cpp, div0_method_op_ptr, 0, DIVIDE_BY_ZERO, [start of procedure div0_method_op_ptr(),start of procedure operator[],return from a call to X_operator[]]
codetoanalyze/cpp/shared/types/return_struct.cpp, return_struct::get_div0, 2, DIVIDE_BY_ZERO, [start of procedure return_struct::get_div0(),start of procedure return_struct::get(),start of procedure X,return from a call to return_struct::X_X,start of procedure X,return from a call to return_struct::X_X,return from a call to return_struct::get,start of procedure X,return from a call to return_struct::X_X]
codetoanalyze/cpp/shared/types/return_struct.cpp, return_struct::get_field_div0, 2, DIVIDE_BY_ZERO, [start of procedure return_struct::get_field_div0(),start of procedure return_struct::get(),start of procedure X,return from a call to return_struct::X_X,start of procedure X,return from a call to return_struct::X_X,return from a call to return_struct::get,Skipping skip: function or method not found,start of procedure return_struct::get(),start of procedure X,return from a call to return_struct::X_X,start of procedure X,return from a call to return_struct::X_X,return from a call to return_struct::get]
codetoanalyze/cpp/shared/types/return_struct.cpp, return_struct::get_method_div0, 0, DIVIDE_BY_ZERO, [start of procedure return_struct::get_method_div0(),start of procedure return_struct::get(),start of procedure X,return from a call to return_struct::X_X,start of procedure X,return from a call to return_struct::X_X,return from a call to return_struct::get,start of procedure div]
codetoanalyze/cpp/shared/types/return_struct.cpp, return_struct::get_div0, 2, DIVIDE_BY_ZERO, [start of procedure return_struct::get_div0(),start of procedure return_struct::get(),start of procedure X,return from a call to return_struct::X_X,start of procedure X,return from a call to return_struct::X_X,Skipping ~X: function or method not found,return from a call to return_struct::get,start of procedure X,return from a call to return_struct::X_X]
codetoanalyze/cpp/shared/types/return_struct.cpp, return_struct::get_field_div0, 2, DIVIDE_BY_ZERO, [start of procedure return_struct::get_field_div0(),start of procedure return_struct::get(),start of procedure X,return from a call to return_struct::X_X,start of procedure X,return from a call to return_struct::X_X,Skipping ~X: function or method not found,return from a call to return_struct::get,Skipping skip: function or method not found,start of procedure return_struct::get(),start of procedure X,return from a call to return_struct::X_X,start of procedure X,return from a call to return_struct::X_X,Skipping ~X: function or method not found,return from a call to return_struct::get]
codetoanalyze/cpp/shared/types/return_struct.cpp, return_struct::get_method_div0, 0, DIVIDE_BY_ZERO, [start of procedure return_struct::get_method_div0(),start of procedure return_struct::get(),start of procedure X,return from a call to return_struct::X_X,start of procedure X,return from a call to return_struct::X_X,Skipping ~X: function or method not found,return from a call to return_struct::get,start of procedure div]
codetoanalyze/cpp/shared/types/struct_forward_declare.cpp, struct_forward_declare::X_Y_div0, 7, DIVIDE_BY_ZERO, [start of procedure struct_forward_declare::X_Y_div0(),start of procedure X,return from a call to struct_forward_declare::X_X,Condition is false,start of procedure getF,return from a call to struct_forward_declare::X_getF]
codetoanalyze/cpp/shared/types/struct_forward_declare.cpp, struct_forward_declare::X_div0, 3, DIVIDE_BY_ZERO, [start of procedure struct_forward_declare::X_div0(),start of procedure X,return from a call to struct_forward_declare::X_X,start of procedure getF,return from a call to struct_forward_declare::X_getF]
codetoanalyze/cpp/shared/types/struct_forward_declare.cpp, struct_forward_declare::X_ptr_div0, 2, DIVIDE_BY_ZERO, [start of procedure struct_forward_declare::X_ptr_div0(),start of procedure getF,return from a call to struct_forward_declare::X_getF]