[cfe-dev] Decomposing short circuit

Ted Kremenek kremenek at apple.com
Mon Sep 20 10:24:45 PDT 2010


On Sep 20, 2010, at 5:38 AM, Ilya Mirsky wrote:

> Hi,
> 
> I need to decompose short circuit expressions into regular And, Or.
> I've started doing it manually, but then I figured out that the compiler probably does the same.
> Currently I identify such expressions using Stmt::hasImplicitControlFlow, and then if it's a BinaryOperator I check if opCode is BO_LAnd or BO_LOr. Is this the right way?
> Is there a way to get clang to do it for me?
> Can I assist CFG class with this issue?

Hi Ilya,

It's a little hard for me to advise you on what to do since I don't have a sense for what you are trying to accomplish, but your approach for identifying '||' and '&&' operations is correct.  The CFG class represents all such control-flow explicitly by constructing basic blocks, etc., but that might be overkill for what you are trying to accomplish.

Ted





More information about the cfe-dev mailing list