[cfe-commits] r41258 - in /cfe/trunk: AST/CFG.cpp include/clang/AST/CFG.h

Chris Lattner clattner at apple.com
Wed Aug 22 14:07:19 PDT 2007

>>> The current design thought was to allow the construction of CFGs  
>>> for arbitrary subtrees of valid ASTs (that represent a function  
>>> body).
>>> However, a subtree of an AST may contain gotos that reference  
>>> labels in other subtrees of the AST (and thus the subtree is  
>>> "invalid" from the perspective of constructing a CFG).  If we  
>>> allow CFGs to be constructed from arbitrary subtrees of valid  
>>> ASTs, then I don't see how this cannot be a run-time check.
>> Interesting point.  In that case, instead of 'return NULL' you  
>> should have 'continue'.
>> -Chris
> This will result in CFGs where there will be blocks with gotos that  
> do not have any successors.  Is this the desired behavior?

I don't see how we could do anything else that would be better, do  
you?  In the code with a return, this means it will just stop  
backpatching gotos, which could include cases where the target is  

> Should we return a flag or something indicating that the control- 
> flow in the CFG is "not complete?"

Or the client can just "know" that CFGs for a subset of a function  
can just have blocks that end with gotos that have no successors.


More information about the cfe-commits mailing list