Decomposing short circuit


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?

Thanks in advance,

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.