[cfe-dev] MallocChecker/RetainCountChecker bind symbol invalidation logic

Tom Care tom.care at uqconnect.edu.au
Thu May 24 08:22:51 PDT 2012


On 23/05/2012, at 7:17 PM, Anna Zaks wrote:

> If 'class' is a global and we don't know anything about bar(), we should assume that the pointer escapes.

This is what I was trying to get to, though the example in my head had some false assumptions. I was thinking of something like:

Object* bar() {
static Object *obj = new Object();
...
obj->var = 0;
...
return obj;
}

void test(Object *obj) {
obj->var = malloc ... // track obj->var
...
bar(); // don't know anything about bar
}

However my example was wrong because any pointer passed in as a parameter would have to be invalidated when we call bar().

Tom




More information about the cfe-dev mailing list