Rename IDENTIFIER_NODE in a plugin
Peter Colberg
peter@colberg.org
Tue Oct 30 17:40:00 GMT 2012
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
More information about the Gcc
mailing list