@ -7,12 +7,21 @@
open ! IStd
open ! IStd
module F = Format
module F = Format
type std_vector_function = PushBack | Reserve [ @@ deriving compare ]
let std_vector_function_pp f = function
| PushBack ->
F . fprintf f " std::vector::push_back "
| Reserve ->
F . fprintf f " std::vector::reserve "
type t =
type t =
| CFree of AccessExpression . t * Location . t
| CFree of AccessExpression . t * Location . t
| CppDelete of AccessExpression . t * Location . t
| CppDelete of AccessExpression . t * Location . t
| CppDestructor of Typ . Procname . t * AccessExpression . t * Location . t
| CppDestructor of Typ . Procname . t * AccessExpression . t * Location . t
| Nullptr
| Nullptr
| StdVectorPushBack of AccessExpression . t * Location . t
| StdVector of std_vector_function * AccessExpression . t * Location . t
[ @@ deriving compare ]
[ @@ deriving compare ]
let issue_type_of_cause = function
let issue_type_of_cause = function
@ -24,7 +33,7 @@ let issue_type_of_cause = function
IssueType . use_after_destructor
IssueType . use_after_destructor
| Nullptr ->
| Nullptr ->
IssueType . null_dereference
IssueType . null_dereference
| StdVector PushBack _ ->
| StdVector _ ->
IssueType . vector_invalidation
IssueType . vector_invalidation
@ -32,7 +41,7 @@ let get_location = function
| CFree ( _ , location )
| CFree ( _ , location )
| CppDelete ( _ , location )
| CppDelete ( _ , location )
| CppDestructor ( _ , _ , location )
| CppDestructor ( _ , _ , location )
| StdVector PushBack ( _ , location ) ->
| StdVector ( _ , _ , location ) ->
Some location
Some location
| Nullptr ->
| Nullptr ->
None
None
@ -50,6 +59,6 @@ let pp f = function
AccessExpression . pp access_expr Location . pp location
AccessExpression . pp access_expr Location . pp location
| Nullptr ->
| Nullptr ->
F . fprintf f " null pointer "
F . fprintf f " null pointer "
| StdVector PushBack ( access_expr , location ) ->
| StdVector ( std_vector_f , access_expr , location ) ->
F . fprintf f " potentially invalidated by call to ` std::vector::push_back(%a, ..)` at %a"
F . fprintf f " potentially invalidated by call to ` %a(%a, ..)` at %a" std_vector_function_pp
AccessExpression . pp access_expr Location . pp location
std_vector_f AccessExpression . pp access_expr Location . pp location