<html><body><div style="color:#000; background-color:#fff; font-family:Courier New, courier, monaco, monospace, sans-serif;font-size:10pt"><div style="RIGHT: auto"><SPAN style="RIGHT: auto">Thanks for sharing the link. </SPAN></div>
<div style="RIGHT: auto"><SPAN style="RIGHT: auto">I had a similar link by chris, but it was a small text document. </SPAN></div>
<div style="RIGHT: auto"><SPAN style="RIGHT: auto"><VAR id=yui-ie-cursor></VAR>This link was helpful in understanding how the anonymous types, and specially the numbered types, are so represented.</SPAN></div>
<div style="RIGHT: auto"><SPAN style="RIGHT: auto"></SPAN> </div>
<div style="RIGHT: auto"><SPAN style="RIGHT: auto">Thanks & Regards,</SPAN></div>
<div style="RIGHT: auto"><SPAN style="RIGHT: auto">Pankaj</SPAN></div>
<div style="RIGHT: auto"><SPAN style="RIGHT: auto"></SPAN><SPAN style="RIGHT: auto"></SPAN> </div>
<div style="RIGHT: auto"><SPAN style="RIGHT: auto"></SPAN> </div>
<div><BR></div>
<DIV style="FONT-FAMILY: Courier New, courier, monaco, monospace, sans-serif; FONT-SIZE: 10pt">
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt"><FONT size=2 face=Arial>
<DIV style="BORDER-BOTTOM: #ccc 1px solid; BORDER-LEFT: #ccc 1px solid; PADDING-BOTTOM: 0px; LINE-HEIGHT: 0; MARGIN: 5px 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; HEIGHT: 0px; FONT-SIZE: 0px; BORDER-TOP: #ccc 1px solid; BORDER-RIGHT: #ccc 1px solid; PADDING-TOP: 0px" class=hr contentEditable=false readonly="true"></DIV><B><SPAN style="FONT-WEIGHT: bold">From:</SPAN></B> Devang Patel <dpatel@apple.com><BR><B><SPAN style="FONT-WEIGHT: bold">To:</SPAN></B> Pankaj Gode <godepankaj@yahoo.com> <BR><B><SPAN style="FONT-WEIGHT: bold">Cc:</SPAN></B> llvm Developers <llvmdev@cs.uiuc.edu> <BR><B><SPAN style="FONT-WEIGHT: bold">Sent:</SPAN></B> Wednesday, December 7, 2011 12:06 AM<BR><B><SPAN style="FONT-WEIGHT: bold">Subject:</SPAN></B> Re: [LLVMdev] Regarding anonymous types<BR></FONT><BR>
<DIV id=yiv568058573>
<DIV>Pankaj,
<DIV><BR></DIV>
<DIV>I encourage you to read Chris's excellent blog entry on type system @ http://blog.llvm.org/2011/11/llvm-30-type-system-rewrite.html</DIV>
<DIV>-</DIV>
<DIV>Devang</DIV>
<DIV><BR>
<DIV>
<DIV>On Dec 6, 2011, at 3:54 AM, Pankaj Gode wrote:</DIV><BR class=yiv568058573Apple-interchange-newline>
<BLOCKQUOTE type="cite">
<DIV>
<DIV style="BACKGROUND-COLOR: #fff; FONT-FAMILY: Courier New, courier, monaco, monospace, sans-serif; COLOR: #000; FONT-SIZE: 10pt">
<DIV class=yiv568058573MsoNormal>Hi All,</DIV>
<DIV class=yiv568058573MsoNormal><VAR id=yiv568058573yui-ie-cursor></VAR> </DIV>
<DIV class=yiv568058573MsoNormal>While collecting type information for "anonymous types", I had below observation.</DIV>
<DIV class=yiv568058573MsoNormal> </DIV>
<DIV class=yiv568058573MsoNormal>For the example with anonymous types, given below</DIV>
<DIV class=yiv568058573MsoNormal>struct test </DIV>
<DIV class=yiv568058573MsoNormal>{</DIV>
<DIV class=yiv568058573MsoNormal><SPAN>  s</SPAN>truct {</DIV>
<DIV class=yiv568058573MsoNormal><SPAN>    u</SPAN>nion {</DIV>
<DIV class=yiv568058573MsoNormal><SPAN>      </SPAN>Char a[4];</DIV>
<DIV class=yiv568058573MsoNormal><SPAN>   </SPAN><SPAN> </SPAN>};</DIV>
<DIV class=yiv568058573MsoNormal><SPAN> </SPAN><SPAN> </SPAN>};</DIV>
<DIV class=yiv568058573MsoNormal><SPAN>  s</SPAN>truct {</DIV>
<DIV class=yiv568058573MsoNormal><SPAN>    i</SPAN>nt b;</DIV>
<DIV class=yiv568058573MsoNormal><SPAN>    c</SPAN>har c;</DIV>
<DIV class=yiv568058573MsoNormal><SPAN>  </SPAN>};</DIV>
<DIV class=yiv568058573MsoNormal>};</DIV>
<DIV class=yiv568058573MsoNormal> </DIV>
<DIV class=yiv568058573MsoNormal>LLVM 2.6 defines the types as </DIV>
<DIV class=yiv568058573MsoNormal>%struct.anon1 = type { %union.anon0}</DIV>
<DIV class=yiv568058573MsoNormal>%struct.anon2 = type { i32, i8}</DIV>
<DIV class=yiv568058573MsoNormal>%struct.test = type { %struct.anon1, %struct.anon2}</DIV>
<DIV class=yiv568058573MsoNormal>%union.anon0 = type {[4 x i8]}</DIV>
<DIV class=yiv568058573MsoNormal> </DIV>
<DIV class=yiv568058573MsoNormal>Whereas, LLVM 2.9 defines the types as</DIV>
<DIV class=yiv568058573MsoNormal>%0 = type { i32, i8}</DIV>
<DIV class=yiv568058573MsoNormal>%anonanonct. = type {%anonanonn.}</DIV>
<DIV class=yiv568058573MsoNormal>%anonanonn.<SPAN>  </SPAN>= type { [ 4x i8] }</DIV>
<DIV class=yiv568058573MsoNormal>%struct.test = type { %anonanonct., %0}</DIV>
<DIV class=yiv568058573MsoNormal> </DIV>
<DIV class=yiv568058573MsoNormal>In case of LLVM2.9, "%0" is interesting case.  </DIV>
<DIV class=yiv568058573MsoNormal>When I try to extract types using " Module_Ptr->getTypeSymbolTable()".</DIV>
<DIV class=yiv568058573MsoNormal>for(TypeSymbolTable::const_iterator I = M->getTypeSymbolTable().begin(),<BR>      E = M->getTypeSymbolTable().end(); I != E; ++I) {</DIV>
<DIV class=yiv568058573MsoNormal>   if( I->second->isStructTy() )</DIV>
<DIV class=yiv568058573MsoNormal>   {</DIV>
<DIV class=yiv568058573MsoNormal>     //code to collect type names</DIV>
<DIV class=yiv568058573MsoNormal>   }      </DIV>
<DIV class=yiv568058573MsoNormal>}</DIV>
<DIV class=yiv568058573MsoNormal> </DIV>
<DIV class=yiv568058573MsoNormal>I don't get this type in TypeSymbolTable.  :( </DIV>
<DIV class=yiv568058573MsoNormal> </DIV>
<DIV class=yiv568058573MsoNormal>Though </DIV>
<DIV class=yiv568058573MsoNormal>struct{</DIV>
<DIV class=yiv568058573MsoNormal> union {</DIV>
<DIV class=yiv568058573MsoNormal>   char a[4];</DIV>
<DIV class=yiv568058573MsoNormal> };</DIV>
<DIV class=yiv568058573MsoNormal>};</DIV>
<DIV class=yiv568058573MsoNormal>too is anonymous, but a name is given to it, i.e anonanonct. </DIV>
<DIV class=yiv568058573MsoNormal> </DIV>
<DIV class=yiv568058573MsoNormal>I need this information as I want to collect all type-names. </DIV>
<DIV class=yiv568058573MsoNormal> </DIV>
<DIV class=yiv568058573MsoNormal> </DIV>
<DIV class=yiv568058573MsoNormal>Thanks & Regards,</DIV>
<DIV class=yiv568058573MsoNormal>Pankaj</DIV>
<DIV class=yiv568058573MsoNormal> </DIV>
<DIV class=yiv568058573MsoNormal> </DIV></DIV></DIV>_______________________________________________<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>         http://llvm.cs.uiuc.edu<BR>http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev<BR></BLOCKQUOTE></DIV><BR></DIV></DIV></DIV><BR><BR></DIV></DIV></div></body></html>