]> git.ipfire.org Git - thirdparty/gcc.git/commit - gcc/analyzer/analyzer.cc
analyzer: support diagnostics that don't have a stmt
authorDavid Malcolm <dmalcolm@redhat.com>
Fri, 15 Sep 2023 17:47:42 +0000 (13:47 -0400)
committerDavid Malcolm <dmalcolm@redhat.com>
Fri, 15 Sep 2023 17:47:42 +0000 (13:47 -0400)
commitb09193fb0686b70ca26b7fa87f9d258503d63837
treed3a89f43bb0fa693450c7a64c42f9924da89a0aa
parent759a1a52ea615df707f569246e5e15b5f12a2307
analyzer: support diagnostics that don't have a stmt

gcc/analyzer/ChangeLog:
* analyzer.cc (get_stmt_location): Handle null stmt.
* diagnostic-manager.cc (saved_diagnostic::saved_diagnostic): Copy
m_loc from ploc.
(saved_diagnostic::operator==): Compare m_loc.
(saved_diagnostic::calc_best_epath): Only use m_stmt_finder if
m_loc is unknown.
(dedupe_key::dedupe_key): Initialize m_loc.
(dedupe_key::operator==): Compare m_loc.
(dedupe_key::get_location): Use m_loc if it's known.
(dedupe_key::m_loc): New field.
(diagnostic_manager::emit_saved_diagnostic): Only call
get_emission_location if m_loc is unknown, preferring to use m_loc
if it's available.
* diagnostic-manager.h (saved_diagnostic::m_loc): New field.
(pending_location::pending_location): Initialize m_loc.  Add
overload taking a location_t rather than a stmt/stmt_finder.
(pending_location::m_loc): New field.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
gcc/analyzer/analyzer.cc
gcc/analyzer/diagnostic-manager.cc
gcc/analyzer/diagnostic-manager.h