This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GCC Plugin Development CLEANUP_POINT_EXPR


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
            }
        }
    }
    /* ... */
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]