This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
plugin: modify attribute arguments inside plugin
- From: Klemen Jan Enova <klemen dot jan dot enova at gmail dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Sat, 02 Aug 2014 10:25:06 +0200
- Subject: plugin: modify attribute arguments inside plugin
- Authentication-results: sourceware.org; auth=none
I would like to code a plugin, that would count the number of accesses
to a field of some C struct.
That struct would be marked with __attribute__((access_count)). When
handling that attribute, I
would like to assign an index to it (as an attribute argument), so that
I can update the proper
element of my counter array, when there is a COMPONENT_REF with a marked
struct as the target.
But attribute arguments are normally passed by the user, can the plugin
change them, and how?
Juts checking that argument would be simpler and faster than looking for
the target's name
(in a hashtable, or just an ordered array if there aren't going to be so
many tracked structs)
and getting an index from that.