[cfe-dev] which class represent variable scope ?
John McCall
rjmccall at apple.com
Fri Jan 11 00:22:48 PST 2013
On Jan 10, 2013, at 9:05 PM, kevinlynx <kevinlynx at gmail.com> wrote:
> For example:
>
> void func() {
> unsigned a;
> {
> unsigned b;
> }
> }
>
> I want to know whether `a` and `b` is in the same code scope. DeclContext does NOT work on this, which means `a` and `b` have the same DeclContext (a function decl context). I googled and found someone have already asked this question but didn't get an answer.
Scope is not recorded directly in the AST. It would be both possible and reasonable to provide an API that recomputes the language-specific notion of the scope of each declaration in a function.
John.
More information about the cfe-dev
mailing list