diff options
author | David Malcolm <dmalcolm@redhat.com> | 2022-12-02 16:30:52 -0500 |
---|---|---|
committer | David Malcolm <dmalcolm@redhat.com> | 2022-12-02 16:30:52 -0500 |
commit | e24fe1283ca1c4d22dc3cf29c26d7b705fb0a568 (patch) | |
tree | 4203e14037ebd059e5033a0f5eaf1592eea4ddc5 /gcc/analyzer/engine.cc | |
parent | f5758fe5b430ef3447fbab947fcea32a1d995f36 (diff) | |
download | gcc-e24fe1283ca1c4d22dc3cf29c26d7b705fb0a568.zip gcc-e24fe1283ca1c4d22dc3cf29c26d7b705fb0a568.tar.gz gcc-e24fe1283ca1c4d22dc3cf29c26d7b705fb0a568.tar.bz2 |
analyzer: introduce struct event_loc_info
gcc/analyzer/ChangeLog:
* analyzer.h (struct event_loc_info): New forward decl.
* bounds-checking.cc: Use event_loc_info throughout to bundle the
loc, fndecl, depth triples.
* call-info.cc: Likewise.
* checker-event.cc: Likewise.
* checker-event.h (struct event_loc_info): New decl. Use it
throughout to bundle the loc, fndecl, depth triples.
* checker-path.cc: Likewise.
* checker-path.h: Likewise.
* diagnostic-manager.cc: Likewise.
* engine.cc: Likewise.
* infinite-recursion.cc: Likewise.
* pending-diagnostic.cc: Likewise.
* pending-diagnostic.h: Likewise.
* region-model.cc: Likewise.
* sm-signal.cc: Likewise.
* varargs.cc: Likewise.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
Diffstat (limited to 'gcc/analyzer/engine.cc')
-rw-r--r-- | gcc/analyzer/engine.cc | 63 |
1 files changed, 34 insertions, 29 deletions
diff --git a/gcc/analyzer/engine.cc b/gcc/analyzer/engine.cc index 991b592..b3b81cc 100644 --- a/gcc/analyzer/engine.cc +++ b/gcc/analyzer/engine.cc @@ -1789,9 +1789,9 @@ public: /* Compare with diagnostic_manager::add_events_for_superedge. */ const int src_stack_depth = src_point.get_stack_depth (); m_stack_pop_event = new precanned_custom_event - (src_point.get_location (), - src_point.get_fndecl (), - src_stack_depth, + (event_loc_info (src_point.get_location (), + src_point.get_fndecl (), + src_stack_depth), "stack frame is popped here, invalidating saved environment"); emission_path->add_event (std::unique_ptr<custom_event> (m_stack_pop_event)); @@ -2045,19 +2045,19 @@ dynamic_call_info_t::add_events_to_path (checker_path *emission_path, if (m_is_returning_call) emission_path->add_event (make_unique<return_event> (eedge, - (m_dynamic_call - ? m_dynamic_call->location - : UNKNOWN_LOCATION), - dest_point.get_fndecl (), - dest_stack_depth)); + event_loc_info (m_dynamic_call + ? m_dynamic_call->location + : UNKNOWN_LOCATION, + dest_point.get_fndecl (), + dest_stack_depth))); else emission_path->add_event (make_unique<call_event> (eedge, - (m_dynamic_call - ? m_dynamic_call->location - : UNKNOWN_LOCATION), - src_point.get_fndecl (), - src_stack_depth)); + event_loc_info (m_dynamic_call + ? m_dynamic_call->location + : UNKNOWN_LOCATION, + src_point.get_fndecl (), + src_stack_depth))); } /* class rewind_info_t : public custom_edge_info. */ @@ -2103,14 +2103,18 @@ rewind_info_t::add_events_to_path (checker_path *emission_path, emission_path->add_event (make_unique<rewind_from_longjmp_event> - (&eedge, get_longjmp_call ()->location, - src_point.get_fndecl (), - src_stack_depth, this)); + (&eedge, + event_loc_info (get_longjmp_call ()->location, + src_point.get_fndecl (), + src_stack_depth), + this)); emission_path->add_event (make_unique<rewind_to_setjmp_event> - (&eedge, get_setjmp_call ()->location, - dst_point.get_fndecl (), - dst_stack_depth, this)); + (&eedge, + event_loc_info (get_setjmp_call ()->location, + dst_point.get_fndecl (), + dst_stack_depth), + this)); } /* class exploded_edge : public dedge<eg_traits>. */ @@ -2651,9 +2655,9 @@ mark_params_as_tainted (program_state *state, tree fndecl, class tainted_args_function_custom_event : public custom_event { public: - tainted_args_function_custom_event (location_t loc, tree fndecl, int depth) - : custom_event (loc, fndecl, depth), - m_fndecl (fndecl) + tainted_args_function_custom_event (const event_loc_info &loc_info) + : custom_event (loc_info), + m_fndecl (loc_info.m_fndecl) { } @@ -2697,7 +2701,7 @@ public: { emission_path->add_event (make_unique<tainted_args_function_custom_event> - (DECL_SOURCE_LOCATION (m_fndecl), m_fndecl, 0)); + (event_loc_info (DECL_SOURCE_LOCATION (m_fndecl), m_fndecl, 0))); } private: @@ -3069,7 +3073,7 @@ class tainted_args_field_custom_event : public custom_event { public: tainted_args_field_custom_event (tree field) - : custom_event (DECL_SOURCE_LOCATION (field), NULL_TREE, 0), + : custom_event (event_loc_info (DECL_SOURCE_LOCATION (field), NULL_TREE, 0)), m_field (field) { } @@ -3093,9 +3097,9 @@ private: class tainted_args_callback_custom_event : public custom_event { public: - tainted_args_callback_custom_event (location_t loc, tree fndecl, int depth, - tree field) - : custom_event (loc, fndecl, depth), + tainted_args_callback_custom_event (const event_loc_info &loc_info, + tree field) + : custom_event (loc_info), m_field (field) { } @@ -3148,8 +3152,9 @@ public: "(2) function 'gadget_dev_desc_UDC_store' used as initializer for field 'store' marked with '__attribute__((tainted_args))'". */ emission_path->add_event - (make_unique<tainted_args_callback_custom_event> (m_loc, m_fndecl, - 0, m_field)); + (make_unique<tainted_args_callback_custom_event> + (event_loc_info (m_loc, m_fndecl, 0), + m_field)); } private: |