[cfe-dev] [Analyzer] ScopeContext implementation

Devin Coughlin via cfe-dev cfe-dev at lists.llvm.org
Fri Apr 1 13:20:36 PDT 2016

Hi Aleksei,

> On Apr 1, 2016, at 10:20 AM, Aleksei Sidorin via cfe-dev <cfe-dev at lists.llvm.org> wrote:
> Hello,
> We have developed a static analyzer feature to handle scope enter/exit. It may be useful to check variable lifetime. It may also solve some issues pointed on "Lifetime checker" discussion (http://lists.llvm.org/pipermail/cfe-dev/2015-December/046653.html). The implementation of this feature is based on the patch that is currently on the review (http://reviews.llvm.org/D16403).

This is exciting!

> In our implementation, local variables have ScopeLocalsSpaceRegion (a special kind of MemorySpace) as their parent.
> Before I'll put this on review, (it will take 2-3 weeks because I'm going on a vacation), I want to ask some questions.
> 1. Should we eliminate StackLocalsSpaceRegion? As I understand, it should be replaced by ScopeLocalsSpaceRegion.

This seems reasonable to me as long as the checkers that query whether a variable is on the stack (StackAddrEscape checker, pthread_once checker) still work. I think Sean Eveson’s work on widening also relies on StackLocalsSpaceRegion to invalidate when widening a loop. I imagine these could be changed to use the new ScopeLocalsSpaceRegion.

> 2. Is there any activity on http://reviews.llvm.org/D16403? If no, I'm going to fix the issues with this review since our patch strongly depends on it.

To the best of my knowledge, no. It might be worth pinging Bhargava in D16403 just to make sure there is no duplication of effort.


More information about the cfe-dev mailing list