commit 67e5b50611441e611504896b2aac02eb77bff53a
Author: David Malcolm <dmalcolm(a)redhat.com>
Date: Mon May 7 16:46:03 2012 -0400
add gcc_function_get_decl
generate-function-c.py | 4 +++-
proposed-plugin-api/function.xml | 1 +
proposed-plugin-api/gcc-function.c | 6 ++++++
3 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/generate-function-c.py b/generate-function-c.py
index 65905f9..a1e700b 100644
--- a/generate-function-c.py
+++ b/generate-function-c.py
@@ -24,6 +24,8 @@ cu.add_include('gcc-python-wrappers.h')
cu.add_include('gcc-plugin.h')
cu.add_include("function.h")
cu.add_include("proposed-plugin-api/gcc-function.h")
+cu.add_include("proposed-plugin-api/gcc-declaration.h")
+cu.add_include("proposed-plugin-api/gcc-tree.h")
modinit_preinit = ''
modinit_postinit = ''
@@ -49,7 +51,7 @@ def generate_function():
typename='PyGccFunction')
getsettable.add_simple_getter(cu,
'decl',
-
'gcc_python_make_wrapper_tree(gcc_private_make_tree(self->fun.inner->decl))',
+
'gcc_python_make_wrapper_tree(gcc_decl_upcast(gcc_function_decl_upcast(gcc_function_get_decl(self->fun))))',
'The declaration of this function, as a
gcc.FunctionDecl instance')
getsettable.add_simple_getter(cu,
'local_decls',
diff --git a/proposed-plugin-api/function.xml b/proposed-plugin-api/function.xml
index 55a5b93..e774e9e 100644
--- a/proposed-plugin-api/function.xml
+++ b/proposed-plugin-api/function.xml
@@ -26,6 +26,7 @@
<doc>The control flow graph for this function (can be NULL in early
passes)</doc>
</attribute>
+ <attribute name="decl" kind="function_decl"/>
<attribute name="index" kind="int"/>
<attribute name="start" kind="location"/>
<attribute name="end" kind="location"/>
diff --git a/proposed-plugin-api/gcc-function.c b/proposed-plugin-api/gcc-function.c
index cf8ee2f..84c3753 100644
--- a/proposed-plugin-api/gcc-function.c
+++ b/proposed-plugin-api/gcc-function.c
@@ -56,6 +56,12 @@ gcc_function_get_cfg(gcc_function func)
return gcc_private_make_cfg(func.inner->cfg);
}
+GCC_IMPLEMENT_PUBLIC_API(gcc_function_decl)
+gcc_function_get_decl(gcc_function func)
+{
+ return gcc_private_make_function_decl(func.inner->decl);
+}
+
GCC_IMPLEMENT_PUBLIC_API(int)
gcc_function_get_index(gcc_function func)
{
Show replies by date