[cfe-dev] propagating checker state for duration of a block

Jordan Rose jordan_rose at apple.com
Mon Dec 17 09:39:43 PST 2012


Hm. The analyzer sort of deliberately doesn't make it easy to do that, because of the (rough) equivalence of examples like this:

> if (foo) {
>   doSomething();
> }

> if (!foo) {
> } else {
>   doSomething();
> }

> if (!foo)
>   return;
> doSomething();

And you don't want to just use the block ID because of this:

> if (foo) {
>   if (bar) {
>     doSomething();
>   } else {
>     doSomethingElse();
>   }
> }


For what it's worth, clearing out the state is generally just an optimization. If you don't do it, the analyzer will just continue analyzing the rest of the program along both paths (where the branch was true and where it was false).

What are you actually trying to do?

Jordan


On Dec 17, 2012, at 8:55 , Richard <tarka.t.otter at googlemail.com> wrote:

> hello
> 
> i am trying to write a checker that needs to propagate state for the duration of the branch blocks. can anyone suggest a good pattern for this? i can easily set state in the checkBranchCondition callback, but there does not seem to be any way to know when the branch block is complete, so it is not possible to know when to clear the state. ideally there would be a checkBlockEdge callback or something similar, then i could associate the state with the block id and it would be simple to know when to clear it. i cannot use the branch condition symbol as the state key as it will be purged as soon as the block starts.
> 
> is there already a way to do this that i am missing?
> 
> thanks
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev




More information about the cfe-dev mailing list