This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
GCC Plugin Development CLEANUP_POINT_EXPR
- From: mario dot miller at web dot de
- To: gcc-help at gcc dot gnu dot org
- Date: Sat, 4 Aug 2012 15:44:09 +0200 (CEST)
- Subject: GCC Plugin Development CLEANUP_POINT_EXPR
- Sensitivity: Normal
Hello,
I'm developing a Plugin with GCC and I want to parse function bodies.
What interests me is when a class calls a method of an other class.
Like in the following example; method E::doSth calls A::getA
class A {
public:
int getA() {return 1;}
};
class E {
public:
void doSth() {
A* a = new A();
int y = a->getA();
/* ... */
}
};
When I parse the doSth method I get two CLEANUP_POINT_EXPR.
I don't really know what to do with this, and the header files don't help me either.
How can I use the CLEANUP_POINT_EXPR to get the function call to getA()?
My code looks like this, so far. I'm stuck where the comment is:
void Explorer::traverseExpression(tree node)
{
if(TREE_CODE(node) == BIND_EXPR)Â{
tree exprBody = BIND_EXPR_BODY(node);
for(tree_stmt_iterator i = tsi_start(exprBody); !tsi_end_p(i); tsi_next(&i)) {
tree* stmt = tsi_stmt_ptr(i);
if(TREE_CODE(*stmt) == CLEANUP_POINT_EXPR) {
// Traverse Cleanup Point Expression
}
}
}
/* ... */
}