[LLVMdev] Regarding scope information for variable declaration.

Pankaj Gode godepankaj at yahoo.com
Mon Jul 30 07:09:30 PDT 2012


Hi All,
 
I have question regarding lexical scope information.
 
If I have .c source with scope as below. 

void func()
{
   //-- some code here..
   { //parent scope
      if() //high pass
      {
         int i;
         for( i =0; i < FRAM_I; i++)
         {
         }
      }
      if() //low pass
      {
         int i;
         for( i =0; i < FRAM_J; i++)
         {
         }
      }
   }
}

 
In this case, the 'variable i' is not initialized in any of the if scope, so it should belong to which scope? 
Is it ok, if 'scope information' gives me that it belongs to the parent scope of 'if-scope'?
Is it because the scope information is collected for machine instructions, and as there will be not machine corresponding to 'int i;', and thus no scope will be associated with it?
 
Regards,
Pankaj
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120730/7a59a7f8/attachment.html>


More information about the llvm-dev mailing list