32 lines
921 B
C++
32 lines
921 B
C++
#include <iostream>
|
|
|
|
#include "gcc-plugin.h"
|
|
#include "plugin-version.h"
|
|
#include "tree.h"
|
|
|
|
int plugin_is_GPL_compatible;
|
|
|
|
static tree handle_slr_attr(tree* node, tree name, tree args, int flags, bool* no_add_attrs) {
|
|
if (!node)
|
|
return NULL_TREE;
|
|
|
|
std::cout << "SLR attribute found!" << std::endl;
|
|
return NULL_TREE;
|
|
}
|
|
|
|
static struct attribute_spec slr_attr = { "slr", 0, 0, false, false, false, false, handle_slr_attr, NULL };
|
|
|
|
void register_attributes(void* event_data, void* data) {
|
|
register_attribute(&slr_attr);
|
|
}
|
|
|
|
int plugin_init(struct plugin_name_args* plugin_info, struct plugin_gcc_version* version) {
|
|
if (!plugin_default_version_check(version, &gcc_version)) {
|
|
std::cerr << "This plugin is for GCC version " << GCCPLUGIN_VERSION_MAJOR << "." << GCCPLUGIN_VERSION_MINOR << std::endl;
|
|
return 1;
|
|
}
|
|
|
|
register_callback(plugin_info->base_name, PLUGIN_ATTRIBUTES, register_attributes, NULL);
|
|
return 0;
|
|
}
|