[cfe-dev] how does clang tackle DeclContext, like ForContext

Nikola Smiljanic popizdeh at gmail.com
Fri May 8 19:23:51 PDT 2015


By performing a name lookup into appropriate Scope. Scopes are linked in a
chain and name lookup traverses them starting from the inner one.

On Sat, May 9, 2015 at 3:09 AM, Eric Lu <eirc.lew at gmail.com> wrote:

> Hi,
>
> In a C for loop like:
> int a[10];
> for(int i = 0; i < 10; i++){
>    a[i] = i + 1;
> }
>
> The variable "i" is declared in the ForContext in ParseForStatement(), and
> then when parse body, I.E., the expression "a[i]" later, how does it know
> that "i" is declared?
>
> In other words, how does the ForContext affect the later parsing of
> variable "i" ?
>
> --
> Best Regards!
> Eric Lew
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150509/df55b9a5/attachment.html>


More information about the cfe-dev mailing list