[PATCH] D16403: Add scope information to CFG

Artem Dergachev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 26 12:45:09 PST 2018


NoQ added a comment.

> Do we need to have one-to-one mapping between ScopeBegins and corresponding ScopeEnds or is it OK to assume that ScopeEnd can terminate several nested scopes?

It's fine if `ScopeEnds` terminates multiple scopes - as long as it is easy to find out what scopes are being terminated by looking at it. Because in the analyzer we need to put the scope on the stack when we enter it and pop it from the stack when we leave it, and those must match no matter what. So imagine that we look at the current `ScopeEnd` and at the stack of scopes we currently have. Once we have that, we should be able to figure out what scopes are ending, without using `ParentMap` or `CFGStmtMap` or re-visiting a large chunk of the AST recursively - ideally by a direct lookup.


Repository:
  rL LLVM

https://reviews.llvm.org/D16403





More information about the llvm-commits mailing list