<html><body><div style="color:#000; background-color:#fff; font-family:Courier New, courier, monaco, monospace, sans-serif;font-size:10pt"><DIV id=yiv8565963053 style="RIGHT: auto">
<DIV style="RIGHT: auto">
<DIV style="FONT-SIZE: 10pt; FONT-FAMILY: Courier New, courier, monaco, monospace, sans-serif; COLOR: #000; BACKGROUND-COLOR: #fff">
<DIV id=yiv8565963053yui_3_7_2_18_1373866234488_43 style="RIGHT: auto"><SPAN id=yiv8565963053yui_3_7_2_18_1373866234488_50 style="RIGHT: auto">Hi Eric,</SPAN></DIV>
<DIV id=yiv8565963053yui_3_7_2_18_1373866234488_244 style="FONT-SIZE: 13px; FONT-FAMILY: Courier New, courier, monaco, monospace, sans-serif; COLOR: rgb(0,0,0); FONT-STYLE: normal; BACKGROUND-COLOR: transparent"><SPAN id=yiv8565963053yui_3_7_2_18_1373866234488_110></SPAN> </DIV><SPAN id=yiv8565963053yui_3_7_2_18_1373866234488_155 style="RIGHT: auto">
<DIV id=yiv8565963053yui_3_7_2_18_1373866234488_1069 style="RIGHT: auto">I was considering machine instructions to get scope information. And variable declaration does not correspond to machine instruction, hence the problem i.e. no scope associated with it. If 'i' is initialized in the 'if-scope' then we get 'variable i' mapped to correct scope as corresponding machine instruction is generated for this. This is not a problem as we can't expect variable declaration in a machine instruction, I thought.</DIV>
<DIV id=yiv8565963053yui_3_7_2_18_1373866234488_2102> </DIV>
<DIV id=yiv8565963053yui_3_7_2_18_1373866234488_2740 style="RIGHT: auto">S</SPAN><SPAN id=yiv8565963053yui_3_7_2_18_1373866234488_245 style="RIGHT: auto">o instead of using machine instructions to collect scope information, (as used by LexicalScope pass), I had written code to collect scope information based on LLVM Instructions. I did this by iterating over 'Function->BasicBlock' instead of 'MachineFunction->MachineBasicBlock'.</SPAN></DIV>
<DIV id=yiv8565963053yui_3_7_2_18_1373866234488_6386 style="RIGHT: auto"><SPAN id=yiv8565963053yui_3_7_2_18_1373866234488_6385 style="RIGHT: auto">const Function *F1 =  MF->getFunction();<BR>for(Function::const_iterator BB = F1->begin(), E = F1->end();<BR>                                BB != E; ++BB)<BR>  {<BR>     for(BasicBlock::const_iterator ii = BB->begin(), ie = BB->end();<BR>        ii != ie; ++ii)<BR>     {<BR>        const Instruction *I = ii;  //I->dump();//debug<BR>        DebugLoc MIDB = I->getDebugLoc();</SPAN></DIV>
<DIV style="RIGHT: auto"><SPAN id=yiv8565963053yui_3_7_2_18_1373866234488_5312 style="RIGHT: auto">      }</SPAN></DIV>
<DIV style="RIGHT: auto"><SPAN id=yiv8565963053yui_3_7_2_18_1373866234488_5327 style="RIGHT: auto">   }</SPAN></DIV>
<DIV style="RIGHT: auto"><SPAN style="RIGHT: auto">
<DIV style="RIGHT: auto"><SPAN id=yiv8565963053yui_3_7_2_18_1373866234488_5302 style="RIGHT: auto">Though this is an overhead as scope information exists, but I need to collect specific information such as 'start line, end line, start column, end column' (End line information s<VAR id=yui-ie-cursor></VAR>hould be derived as is not obvious).</SPAN></DIV></SPAN></DIV>
<DIV style="RIGHT: auto"><SPAN id=yiv8565963053yui_3_7_2_18_1373866234488_5340 style="RIGHT: auto">Collecting information this way allowed me to get correct scope information, and hence I was able to map the variable declaration to the scope. It worked for me this way.</SPAN></DIV>
<DIV style="RIGHT: auto"><SPAN style="RIGHT: auto"></DIV>
<DIV id=yiv8565963053yui_3_7_2_18_1373866234488_2042 style="RIGHT: auto"></SPAN><SPAN id=yiv8565963053yui_3_7_2_18_1373866234488_153 style="RIGHT: auto"></SPAN> </DIV>
<DIV style="RIGHT: auto"> </DIV>
<DIV id=yiv8565963053yui_3_7_2_18_1373866234488_5169><SPAN id=yiv8565963053yui_3_7_2_18_1373866234488_111>Regards,</SPAN></DIV>
<DIV id=yiv8565963053yui_3_7_2_18_1373866234488_154 style="RIGHT: auto"><SPAN id=yiv8565963053yui_3_7_2_18_1373866234488_139 style="RIGHT: auto">Pankaj</SPAN></DIV>
<DIV id=yiv8565963053yui_3_7_2_18_1373866234488_152 style="FONT-SIZE: 13px; FONT-FAMILY: Courier New, courier, monaco, monospace, sans-serif; COLOR: rgb(0,0,0); FONT-STYLE: normal; BACKGROUND-COLOR: transparent"><SPAN id=yiv8565963053yui_3_7_2_18_1373866234488_146></SPAN> </DIV>
<DIV id=yiv8565963053yui_3_7_2_18_1373866234488_151 style="FONT-SIZE: 13px; FONT-FAMILY: Courier New, courier, monaco, monospace, sans-serif; COLOR: rgb(0,0,0); FONT-STYLE: normal; BACKGROUND-COLOR: transparent"><BR id=yiv8565963053yui_3_7_2_18_1373866234488_44></DIV>
<DIV id=yiv8565963053yui_3_7_2_18_1373866234488_45 class=yiv8565963053ms__id6568 style="FONT-SIZE: 10pt; FONT-FAMILY: Courier New, courier, monaco, monospace, sans-serif">
<DIV id=yiv8565963053yui_3_7_2_18_1373866234488_108 class=yiv8565963053ms__id6570 style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">
<DIV id=yiv8565963053yui_3_7_2_18_1373866234488_51 dir=ltr>
<DIV id=yiv8565963053yui_3_7_2_18_1373866234488_138 class="yiv8565963053hr yiv8565963053yui-non yiv8565963053yui-skip" style="FONT-SIZE: 0px; BORDER-TOP: #ccc 1px solid; HEIGHT: 0px; BORDER-RIGHT: #ccc 1px solid; BORDER-BOTTOM: #ccc 1px solid; PADDING-BOTTOM: 0px; PADDING-TOP: 0px; PADDING-LEFT: 0px; MARGIN: 5px 0px; BORDER-LEFT: #ccc 1px solid; LINE-HEIGHT: 0; PADDING-RIGHT: 0px"></DIV><FONT id=yiv8565963053yui_3_7_2_18_1373866234488_107 size=2 face=Arial><B id=yiv8565963053yui_3_7_2_18_1373866234488_106><SPAN style="FONT-WEIGHT: bold">From:</SPAN></B> eric.lew <eirc.lew@gmail.com><BR><B><SPAN style="FONT-WEIGHT: bold">To:</SPAN></B> llvmdev@cs.uiuc.edu <BR><B><SPAN style="FONT-WEIGHT: bold">Sent:</SPAN></B> Friday, July 12, 2013 8:30 AM<BR><B><SPAN style="FONT-WEIGHT: bold">Subject:</SPAN></B> Re: [LLVMdev] Regarding scope information for variable declaration.<BR></FONT></DIV>
<DIV class=yiv8565963053y_msg_container style="RIGHT: auto"><BR id=yiv8565963053yui_3_7_2_18_1373866234488_5168 style="RIGHT: auto">I have the same demand. Have you resolved this problems? if so, would you<BR>share me the solution?<BR><BR>Best Regards.<BR><BR>Eric<BR><BR><BR><BR>--<BR>View this message in context: <A href="http://llvm.1065342.n5.nabble.com/Regarding-scope-information-for-variable-declaration-tp47707p59268.html" rel=nofollow target=_blank>http://llvm.1065342.n5.nabble.com/Regarding-scope-information-for-variable-declaration-tp47707p59268.html</A><BR>Sent from the LLVM - Dev mailing list archive at Nabble.com.<BR>_______________________________________________<BR>LLVM Developers mailing list<BR><A href="mailto:LLVMdev@cs.uiuc.edu" rel=nofollow target=_blank ymailto="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</A>        <A href="http://llvm.cs.uiuc.edu/" rel=nofollow target=_blank>http://llvm.cs.uiuc.edu/</A><BR><A
 href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" rel=nofollow target=_blank>http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</A><BR><BR><BR></DIV></DIV></DIV></DIV></DIV></DIV></div></body></html>