Retrieve GENERIC function body in plugin

2012-10-24 Thread Peter Colberg
Hi, I am writing a plugin to analyse C code by walking the AST in GENERIC format, and have trouble getting the body of function declarations. The plugin registers a callback to PLUGIN_FINISH_UNIT, and therein retrieves function_decl nodes of the current translation unit by iterating over cgraph_n

Re: Retrieve GENERIC function body in plugin

2012-10-24 Thread Peter Colberg
On Wed, Oct 24, 2012 at 12:55:23PM -0400, Peter Colberg wrote: > The plugin registers a callback to PLUGIN_FINISH_UNIT, and therein > retrieves function_decl nodes of the current translation unit by > iterating over cgraph_nodes. However, getting the function body > using DECL_SAV

Rename IDENTIFIER_NODE in a plugin

2012-10-30 Thread Peter Colberg
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

Re: Rename IDENTIFIER_NODE in a plugin

2012-10-30 Thread Peter Colberg
On Tue, Oct 30, 2012 at 01:39:59PM -0400, Peter Colberg wrote: > How does one reassign the IDENTIFIER_POINTER of an IDENTIFIER_NODE? My question does not make sense, since identifiers are immutable. I found an alternative solution used throughout the GCC code: DECL_NAME(decl) = get_identif

[ANN] gcc-lua: Lua plugin for the GNU Compiler Collection

2012-10-31 Thread Peter Colberg
Hi, It is my pleasure to announce gcc-lua: gcc‑lua extends the GNU Compiler Collection with the ability to run Lua scripts. The plugin provides an interface to register callback functions for plugin events, and inspect the abstract syntax tree of a translation unit. The plugin is useful for stati