[cfe-dev] Variable out of scope

Ted Kremenek kremenek at apple.com
Mon Apr 21 07:23:39 PDT 2014


On Apr 17, 2014, at 8:25 AM, David Blaikie <dblaikie at gmail.com> wrote:

> But I don't know anything about the static analyzers to actually say
> whether there's a good way to implement such a check.

There is not.  We’ve wanted this “lifetime” or “scope” information for a while to find bugs like these.  It’s an infrastructure issue.  One thing that just occurred to me is that we could probably add this information as an enhancement to the CFG.  We’re already inserting destructors for C++ objects; similarly lifetime “markers” could be added to the CFG for ordinary local variables.  These markers would not be needed by all clients of the CFG (e.g., the frontend), but they would precisely model this problem very nicely for the static analyzer and similar clients.  Adding this enhancement to the CFG probably wouldn’t be that hard at this point either, since the destructor support in the CFG has prepped much of the needed plumbing.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140421/82b4a3cc/attachment.html>


More information about the cfe-dev mailing list