[cfe-dev] CFG blocks and variable scope
Ted Kremenek
kremenek at apple.com
Sat Mar 28 17:37:44 PDT 2009
On Mar 28, 2009, at 5:25 PM, Chris Lattner wrote:
>
> On Mar 28, 2009, at 5:23 PM, Ted Kremenek wrote:
>
>>> Would it make sense for the CFG to contain a "virtual statement"
>>> saying "variable x destroyed here"? This would be a natural way
>>> to handle C++ dtors and would also be useful in C, because you'd
>>> know the end of the variable's life. CFG construction would
>>> handle this as it is walking the scopes.
>>>
>> Yes, this is the approach I was envisioning. We still need the
>> scope information to be available during CFG construction.
>
>
> For declstmt's? I think the AST has enough information to know
> scopes. What is missing?
I would like a solution that will work well with C++ (e.g., the
construction/destruction of temporaries, etc.), so having an ad hoc
solution to reconstruct scope and other places where objects get
destroyed seems suboptimal. I suppose the CFG could construct that,
but it might be nice if that information was affixed to the AST in
some way. Other clients (e.g., CodeGen) might want to use that as well.
More information about the cfe-dev
mailing list