diff options
author | David Malcolm <dmalcolm@redhat.com> | 2023-08-21 21:13:18 -0400 |
---|---|---|
committer | David Malcolm <dmalcolm@redhat.com> | 2023-08-21 21:13:18 -0400 |
commit | 2503dd59b588d3f941c7df945ed41c40bb3a147f (patch) | |
tree | ce1afe3a733a33c9753dd8dceb7569bc2a71b45c /gcc/analyzer/diagnostic-manager.h | |
parent | e40a935db29cfd8f1c68b1d0b7219d71b9c5abb0 (diff) | |
download | gcc-2503dd59b588d3f941c7df945ed41c40bb3a147f.zip gcc-2503dd59b588d3f941c7df945ed41c40bb3a147f.tar.gz gcc-2503dd59b588d3f941c7df945ed41c40bb3a147f.tar.bz2 |
analyzer: add ability for context to add events to a saved_diagnostic
gcc/analyzer/ChangeLog:
* diagnostic-manager.cc (saved_diagnostic::add_event): New.
(saved_diagnostic::add_any_saved_events): New.
(diagnostic_manager::add_event): New.
(dedupe_winners::emit_best): New.
(diagnostic_manager::emit_saved_diagnostic): Make "sd" param
non-const. Call saved_diagnostic::add_any_saved_events.
* diagnostic-manager.h (saved_diagnostic::add_event): New decl.
(saved_diagnostic::add_any_saved_events): New decl.
(saved_diagnostic::m_saved_events): New field.
(diagnostic_manager::add_event): New decl.
(diagnostic_manager::emit_saved_diagnostic): Make "sd" param
non-const.
* engine.cc (impl_region_model_context::add_event): New.
* exploded-graph.h (impl_region_model_context::add_event): New decl.
* region-model.cc
(noop_region_model_context::add_event): New.
(region_model_context_decorator::add_event): New.
* region-model.h (region_model_context::add_event): New vfunc.
(noop_region_model_context::add_event): New decl.
(region_model_context_decorator::add_event): New decl.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
Diffstat (limited to 'gcc/analyzer/diagnostic-manager.h')
-rw-r--r-- | gcc/analyzer/diagnostic-manager.h | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/gcc/analyzer/diagnostic-manager.h b/gcc/analyzer/diagnostic-manager.h index d3022b8..413ab0c 100644 --- a/gcc/analyzer/diagnostic-manager.h +++ b/gcc/analyzer/diagnostic-manager.h @@ -42,6 +42,7 @@ public: bool operator== (const saved_diagnostic &other) const; void add_note (std::unique_ptr<pending_note> pn); + void add_event (std::unique_ptr<checker_event> event); json::object *to_json () const; @@ -64,6 +65,8 @@ public: bool supercedes_p (const saved_diagnostic &other) const; + void add_any_saved_events (checker_path &dst_path); + void emit_any_notes () const; //private: @@ -87,6 +90,12 @@ private: auto_vec<const saved_diagnostic *> m_duplicates; auto_delete_vec <pending_note> m_notes; + + /* Optionally: additional context-dependent events to be emitted + immediately before the warning_event, giving more details of what + operation was being simulated when a diagnostic was saved + e.g. "looking for null terminator in param 2 of 'foo'". */ + auto_delete_vec <checker_event> m_saved_events; }; class path_builder; @@ -124,11 +133,12 @@ public: std::unique_ptr<pending_diagnostic> d); void add_note (std::unique_ptr<pending_note> pn); + void add_event (std::unique_ptr<checker_event> event); void emit_saved_diagnostics (const exploded_graph &eg); void emit_saved_diagnostic (const exploded_graph &eg, - const saved_diagnostic &sd); + saved_diagnostic &sd); unsigned get_num_diagnostics () const { |