1 diff --git a/gcc/c-decl.c b/gcc/c-decl.c
2 index b438b06..c3738b9 100644
5 @@ -4480,6 +4480,8 @@ finish_decl (tree decl, location_t init_loc, tree init,
6 && C_TYPE_FIELDS_READONLY (type))
7 diagnose_uninitialized_cst_member (decl, type);
10 + invoke_plugin_callbacks(PLUGIN_FINISH_DECL, decl);
13 /* Given a parsed parameter declaration, decode it into a PARM_DECL. */
14 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
15 index 6a13cc4..9752cf4 100644
18 @@ -6147,6 +6147,8 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p,
21 TREE_READONLY (decl) = 1;
23 + invoke_plugin_callbacks(PLUGIN_FINISH_DECL, decl);
26 /* Returns a declaration for a VAR_DECL as if:
27 diff --git a/gcc/doc/plugins.texi b/gcc/doc/plugins.texi
28 index 767cee8..d989ddd 100644
29 --- a/gcc/doc/plugins.texi
30 +++ b/gcc/doc/plugins.texi
31 @@ -153,6 +153,7 @@ enum plugin_event
32 PLUGIN_FINISH_TYPE, /* After finishing parsing a type. */
33 PLUGIN_FINISH_UNIT, /* Useful for summary processing. */
34 PLUGIN_PRE_GENERICIZE, /* Allows to see low level AST in C and C++ frontends. */
35 + PLUGIN_FINISH_DECL, /* Allows to see all declarations in C and C++ frontends. */
36 PLUGIN_FINISH, /* Called before GCC exits. */
37 PLUGIN_INFO, /* Information about the plugin. */
38 PLUGIN_GGC_START, /* Called at start of GCC Garbage Collection. */
39 diff --git a/gcc/plugin.c b/gcc/plugin.c
40 index c93daed..f65e54a 100644
43 @@ -423,6 +423,7 @@ register_callback (const char *plugin_name,
44 case PLUGIN_START_UNIT:
45 case PLUGIN_FINISH_UNIT:
46 case PLUGIN_PRE_GENERICIZE:
47 + case PLUGIN_FINISH_DECL:
48 case PLUGIN_GGC_START:
49 case PLUGIN_GGC_MARKING:
51 @@ -499,6 +500,7 @@ invoke_plugin_callbacks_full (int event, void *gcc_data)
52 case PLUGIN_START_UNIT:
53 case PLUGIN_FINISH_UNIT:
54 case PLUGIN_PRE_GENERICIZE:
55 + case PLUGIN_FINISH_DECL:
56 case PLUGIN_ATTRIBUTES:
59 diff --git a/gcc/plugin.def b/gcc/plugin.def
60 index 4a40c2c..4f8ad08 100644
63 @@ -30,6 +30,9 @@ DEFEVENT (PLUGIN_FINISH_UNIT)
64 /* Allows to see low level AST in C and C++ frontends. */
65 DEFEVENT (PLUGIN_PRE_GENERICIZE)
67 +/* Allows to see all declarations in C and C++ frontends. */
68 +DEFEVENT (PLUGIN_FINISH_DECL)
70 /* Called before GCC exits. */
71 DEFEVENT (PLUGIN_FINISH)