From c5d229607d32c6d509d7ed4cd5c9d5b4b42dce51 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Fri, 27 Sep 2019 09:24:41 -0400 Subject: [PATCH 33/61] FIXME: analyzer: new file: analyzer-plugin.cc --- gcc/analyzer/analyzer-plugin.cc | 88 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 gcc/analyzer/analyzer-plugin.cc diff --git a/gcc/analyzer/analyzer-plugin.cc b/gcc/analyzer/analyzer-plugin.cc new file mode 100644 index 0000000..2c64b81 --- /dev/null +++ b/gcc/analyzer/analyzer-plugin.cc @@ -0,0 +1,88 @@ +/* Top-level interface to the analyzer, as a GCC plugin. + Copyright (C) 2019 Free Software Foundation, Inc. + Contributed by David Malcolm . + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +/* FIXME. */ +#include "config.h" +#include "gcc-plugin.h" +#include "system.h" +#include "coretypes.h" +#include "tree.h" +#include "tm.h" +#include "toplev.h" +#include "hash-table.h" +#include "vec.h" +#include "ggc.h" +#include "basic-block.h" +#include "tree-ssa-alias.h" +#include "internal-fn.h" +#include "gimple-fold.h" +#include "tree-eh.h" +#include "gimple-expr.h" +#include "is-a.h" +#include "gimple.h" +#include "tree-pass.h" +#include "intl.h" +#include "context.h" +#include "diagnostic.h" +#include "bitmap.h" +#include "gimple.h" +#include "gimple-iterator.h" +#include "gimple-pretty-print.h" + +#include "analyzer/analyzer.h" +#include "analyzer/analyzer-selftests.h" + +int plugin_is_GPL_compatible; + +#if CHECKING_P + +namespace selftest { + +static void +analyzer_selftests_cb (void */*gcc_data*/, void */*user_data*/) +{ + run_analyzer_selftests (); +} + +} /* end of namespace selftest. */ + +#endif /* #if CHECKING_P */ + +/* Entrypoint to the pass. */ + +int +plugin_init (struct plugin_name_args *plugin_info ATTRIBUTE_UNUSED, + struct plugin_gcc_version */*version*/) +{ + if (0) + fprintf (stderr, "got here\n"); + + /* Register our selftests. */ +#if CHECKING_P + register_callback (plugin_info->base_name, + PLUGIN_RUN_SELFTESTS, + selftest::analyzer_selftests_cb, NULL); +#endif /* #if CHECKING_P */ + + /* Register our pass. */ + register_analyzer_pass (); + + return 0; +} -- 1.8.5.3