Mercurial > cospy
view src/cospy.c @ 5:a32f4bd19eda
Show line number and source file after function name
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Wed, 08 Sep 2010 17:54:33 +0800 |
parents | 8855f7d934ae |
children | 165781cb4cdd |
line wrap: on
line source
#include "gcc-plugin.h" #include "plugin-version.h" #include "system.h" #include "coretypes.h" #include "tree-pass.h" #include "tree.h" #include "gimple.h" #include "cgraph.h" #include <stdio.h> int plugin_is_GPL_compatible; static void handle_all_passes(void *gcc_data, void *user_data) { tree decl; decl = cfun->decl; printf("decl %x\n", decl); printf(" %s:%d:%s\n", current_function_name(), DECL_SOURCE_LINE(decl), DECL_SOURCE_FILE(decl)); } int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version) { struct cgraph_node_hook_list *hook; if (!plugin_default_version_check (version, &gcc_version)) return 1; printf("Initialize plugin %s\n", plugin_info->base_name); register_callback(plugin_info->base_name, PLUGIN_ALL_PASSES_START, handle_all_passes, NULL); return 0; }