From: David Malcolm <dmalcolm@redhat.com>
To: gcc-patches@gcc.gnu.org
Cc: David Malcolm <dmalcolm@redhat.com>
Subject: [committed 8/8] analyzer: use std::unique_ptr for state machines from plugins
Date: Thu, 3 Nov 2022 13:51:35 -0400 [thread overview]
Message-ID: <20221103175135.2269543-9-dmalcolm@redhat.com> (raw)
In-Reply-To: <20221103175135.2269543-1-dmalcolm@redhat.com>
gcc/analyzer/ChangeLog:
* analyzer.h: Use std::unique_ptr for state machines from plugins.
* engine.cc: Likewise.
gcc/testsuite/ChangeLog:
* gcc.dg/plugin/analyzer_gil_plugin.c: Use std::unique_ptr for
state machines from plugins.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
---
gcc/analyzer/analyzer.h | 2 +-
gcc/analyzer/engine.cc | 4 ++--
gcc/testsuite/gcc.dg/plugin/analyzer_gil_plugin.c | 3 ++-
3 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/gcc/analyzer/analyzer.h b/gcc/analyzer/analyzer.h
index 88fdc1d04f0..c0041c35d1a 100644
--- a/gcc/analyzer/analyzer.h
+++ b/gcc/analyzer/analyzer.h
@@ -242,7 +242,7 @@ public:
class plugin_analyzer_init_iface
{
public:
- virtual void register_state_machine (state_machine *) = 0;
+ virtual void register_state_machine (std::unique_ptr<state_machine>) = 0;
virtual void register_known_function (const char *name,
std::unique_ptr<known_function>) = 0;
virtual logger *get_logger () const = 0;
diff --git a/gcc/analyzer/engine.cc b/gcc/analyzer/engine.cc
index fe17f8f76ce..9c32afc6c71 100644
--- a/gcc/analyzer/engine.cc
+++ b/gcc/analyzer/engine.cc
@@ -5953,10 +5953,10 @@ public:
m_logger (logger)
{}
- void register_state_machine (state_machine *sm) final override
+ void register_state_machine (std::unique_ptr<state_machine> sm) final override
{
LOG_SCOPE (m_logger);
- m_checkers->safe_push (sm);
+ m_checkers->safe_push (sm.release ());
}
void register_known_function (const char *name,
diff --git a/gcc/testsuite/gcc.dg/plugin/analyzer_gil_plugin.c b/gcc/testsuite/gcc.dg/plugin/analyzer_gil_plugin.c
index cf0baa5670d..b72856bf6f6 100644
--- a/gcc/testsuite/gcc.dg/plugin/analyzer_gil_plugin.c
+++ b/gcc/testsuite/gcc.dg/plugin/analyzer_gil_plugin.c
@@ -410,7 +410,8 @@ gil_analyzer_init_cb (void *gcc_data, void */*user_data*/)
LOG_SCOPE (iface->get_logger ());
if (0)
inform (input_location, "got here: gil_analyzer_init_cb");
- iface->register_state_machine (new gil_state_machine (iface->get_logger ()));
+ iface->register_state_machine
+ (make_unique<gil_state_machine> (iface->get_logger ()));
}
} // namespace ana
--
2.26.3
prev parent reply other threads:[~2022-11-03 17:51 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-03 17:51 [committed 0/8] Use std::unique_ptr in analyzer David Malcolm
2022-11-03 17:51 ` [committed 1/8] analyzer: use std::unique_ptr for pending_diagnostic/note David Malcolm
2022-11-03 17:51 ` [committed 2/8] analyzer: use std::unique_ptr for saved_diagnostic::m_stmt_finder David Malcolm
2022-11-03 17:51 ` [committed 3/8] analyzer: use std::unique_ptr for custom_edge_info pointers David Malcolm
2022-11-03 17:51 ` [committed 4/8] analyzer: use std::unique_ptr for feasibility_problems and exploded_path David Malcolm
2022-11-03 17:51 ` [committed 5/8] analyzer: use std::unique_ptr for checker_event David Malcolm
2022-11-03 17:51 ` [committed 6/8] analyzer: use std::unique_ptr during bifurcation David Malcolm
2022-11-03 17:51 ` [committed 7/8] analyzer: use std::unique_ptr for known functions David Malcolm
2022-11-03 17:51 ` David Malcolm [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221103175135.2269543-9-dmalcolm@redhat.com \
--to=dmalcolm@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).