public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: David Malcolm <dmalcolm@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-3636] analyzer: use std::unique_ptr for state machines from plugins Date: Thu, 3 Nov 2022 17:48:58 +0000 (GMT) [thread overview] Message-ID: <20221103174858.C782438582B5@sourceware.org> (raw) https://gcc.gnu.org/g:e177be86c7d327b9abd2441d52e3f240b3a488cd commit r13-3636-ge177be86c7d327b9abd2441d52e3f240b3a488cd Author: David Malcolm <dmalcolm@redhat.com> Date: Thu Nov 3 13:47:02 2022 -0400 analyzer: use std::unique_ptr for state machines from plugins 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> Diff: --- 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
reply other threads:[~2022-11-03 17:48 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20221103174858.C782438582B5@sourceware.org \ --to=dmalcolm@gcc.gnu.org \ --cc=gcc-cvs@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: linkBe 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).