This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Rename IDENTIFIER_NODE in a plugin
- From: Peter Colberg <peter at colberg dot org>
- To: gcc at gcc dot gnu dot org
- Date: Tue, 30 Oct 2012 13:39:59 -0400
- Subject: Rename IDENTIFIER_NODE in a plugin
Hello,
I am in the process of writing a plugin that parses the header files
of a C library using GCC, walks the AST in GENERIC format, and
translates to C code for a foreign function interface (for LuaJIT).
Many libraries internally use different C type names than those part
of the API, using the C preprocessor for name mangling. I would like
to rename certain tree nodes back to their known API name, before
generating the C output code.
How does one reassign the IDENTIFIER_POINTER of an IDENTIFIER_NODE?
How is the memory of the identifier string allocated and freed?
I have looked at build_string() in tree.c, but this function seems
to apply only to STRING_CST nodes. There are also the functions
make_node_stat() and build*_stat(), but I cannot find any call
to these functions with tree code IDENTIFIER_NODE.
I would be thankful for any pointers.
Peter