[cfe-dev] Checker for Context Sensitive Call Graph

Tarun Sethi tarunsethi01 at gmail.com
Mon Apr 25 18:17:33 PDT 2011


Hi,

I have been trying to write a checker using PreStmt<CallExpr> interface to
get a context sensitive call graph with the SVal's of each argument at each
call node (in other words with CheckerContext at that node).

To explain in detail, for example in the code below, I would like my checker
to be invoked 3 times each for malloc and free calls (because they have been
called thrice through alloc_mem), rather than just once for malloc and free,
which is currently the case in PreStmt<CallExpr> and evalCall checkers
including the MallocChecker.

void* alloc_mem(int x) {

       void *p = malloc(x);
       return p;
}

int main() {

     void *x = alloc_mem(4);
     free(x);
     x = alloc_mem(8);
     free(x);
     x = alloc_mem(12);
     free(x);
     return 0;
}


And as per my understanding, I do not just want to walk/traverse the AST as
I would not get the state (checkerContext, SVal) at the call expression.
I also want to visit the calls made from within the member functions of the
classes, in object oriented langs, which I could not find in any of the
checkers.

If something like this has already been implemented in Clang, please direct
me there, else please guide me to do so.

Thanks in advance!

 ~ Tarun
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110425/d7e10943/attachment.html>


More information about the cfe-dev mailing list