summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2012-01-12 20:29:47 (GMT)
committerDavid Malcolm <dmalcolm@redhat.com>2012-01-12 20:29:47 (GMT)
commit801499a74370185ac6080510dc0105626a007a3f (patch)
tree2411c2cb6cb14e00ab1ab914f03170bb338563b4
parent834ad11a05f48452183c4dc5011690749b5187d7 (diff)
downloadgcc-python-plugin-801499a74370185ac6080510dc0105626a007a3f.zip
gcc-python-plugin-801499a74370185ac6080510dc0105626a007a3f.tar.gz
gcc-python-plugin-801499a74370185ac6080510dc0105626a007a3f.tar.xz
move gcc_python_get_callgraph_nodes from gcc-python.c to gcc-python-callgraph.c
-rw-r--r--gcc-python-callgraph.c36
-rw-r--r--gcc-python-wrappers.h3
-rw-r--r--gcc-python.c37
3 files changed, 39 insertions, 37 deletions
diff --git a/gcc-python-callgraph.c b/gcc-python-callgraph.c
index 86fa42d..289380a 100644
--- a/gcc-python-callgraph.c
+++ b/gcc-python-callgraph.c
@@ -163,6 +163,42 @@ gcc_python_make_wrapper_cgraph_node(struct cgraph_node * node)
real_make_cgraph_node_wrapper);
}
+PyObject *
+gcc_python_get_callgraph_nodes(PyObject *self, PyObject *args)
+{
+ PyObject *result;
+ struct cgraph_node *node;
+
+ /* For debugging, see GCC's dump of things: */
+ if (0) {
+ fprintf(stderr, "----------------BEGIN----------------\n");
+ dump_cgraph (stderr);
+ fprintf(stderr, "---------------- END ----------------\n");
+ }
+
+ result = PyList_New(0);
+ if (!result) {
+ goto error;
+ }
+
+ for (node = cgraph_nodes; node; node = node->next) {
+ PyObject *obj_var = gcc_python_make_wrapper_cgraph_node(node);
+ if (!obj_var) {
+ goto error;
+ }
+ if (-1 == PyList_Append(result, obj_var)) {
+ Py_DECREF(obj_var);
+ goto error;
+ }
+ Py_DECREF(obj_var);
+ }
+
+ return result;
+
+ error:
+ Py_XDECREF(result);
+ return NULL;
+}
/*
PEP-7
diff --git a/gcc-python-wrappers.h b/gcc-python-wrappers.h
index e421af1..882a242 100644
--- a/gcc-python-wrappers.h
+++ b/gcc-python-wrappers.h
@@ -56,6 +56,9 @@ gcc_CallgraphNode_get_callers(struct PyGccCallgraphNode * self);
extern PyObject *
gcc_CallgraphNode_get_callees(struct PyGccCallgraphNode * self);
+PyObject *
+gcc_python_get_callgraph_nodes(PyObject *self, PyObject *args);
+
/* gcc-python-diagnostics.c: */
PyObject*
gcc_python_permerror(PyObject *self, PyObject *args);
diff --git a/gcc-python.c b/gcc-python.c
index 4b962d9..91070d7 100644
--- a/gcc-python.c
+++ b/gcc-python.c
@@ -333,43 +333,6 @@ gcc_python_get_gcc_version(PyObject *self, PyObject *args)
return gcc_version_to_object(actual_gcc_version);
}
-static PyObject *
-gcc_python_get_callgraph_nodes(PyObject *self, PyObject *args)
-{
- PyObject *result;
- struct cgraph_node *node;
-
- /* For debugging, see GCC's dump of things: */
- if (0) {
- fprintf(stderr, "----------------BEGIN----------------\n");
- dump_cgraph (stderr);
- fprintf(stderr, "---------------- END ----------------\n");
- }
-
- result = PyList_New(0);
- if (!result) {
- goto error;
- }
-
- for (node = cgraph_nodes; node; node = node->next) {
- PyObject *obj_var = gcc_python_make_wrapper_cgraph_node(node);
- if (!obj_var) {
- goto error;
- }
- if (-1 == PyList_Append(result, obj_var)) {
- Py_DECREF(obj_var);
- goto error;
- }
- Py_DECREF(obj_var);
- }
-
- return result;
-
- error:
- Py_XDECREF(result);
- return NULL;
-}
-
/* Dump files */
static PyObject *