1  /* This plugin creates a fake function in the FINISH_UNIT callback, in
       2   * other words right after compilation of the translation unit. 
       3  */
       4  #include "gcc-plugin.h"
       5  #include "config.h"
       6  #include "system.h"
       7  #include "coretypes.h"
       8  #include "tm.h"
       9  #include "tree.h"
      10  #include "toplev.h"
      11  #include "basic-block.h"
      12  #include "hash-table.h"
      13  #include "vec.h"
      14  #include "ggc.h"
      15  #include "basic-block.h"
      16  #include "tree-ssa-alias.h"
      17  #include "internal-fn.h"
      18  #include "tree-eh.h"
      19  #include "gimple-expr.h"
      20  #include "is-a.h"
      21  #include "gimple.h"
      22  #include "tree.h"
      23  #include "tree-pass.h"
      24  #include "intl.h"
      25  #include "cgraph.h"
      26  
      27  int plugin_is_GPL_compatible;
      28  
      29  static void finish_unit_callback (void *gcc_data, void *user_data)
      30  {
      31    cgraph_build_static_cdtor ('I', NULL, DEFAULT_INIT_PRIORITY);
      32  }
      33  
      34  int plugin_init (struct plugin_name_args *plugin_info,
      35                   struct plugin_gcc_version *version)
      36  {
      37    register_callback ("finish_unit", PLUGIN_FINISH_UNIT, &finish_unit_callback, NULL);
      38    return 0;
      39  }