<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Jul 8, 2009, at 4:49 PM, Eli Friedman wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>On Wed, Jul 8, 2009 at 4:34 PM, Argyrios Kyrtzidis<<a href="mailto:kyrtzidis@apple.com">kyrtzidis@apple.com</a>> wrote:<br><blockquote type="cite">Ideally all the type source info for the above type would be readily<br></blockquote><blockquote type="cite">available from the AST; recomputing all the information from the tokens<br></blockquote><blockquote type="cite">isn't practical, Sema already did the hard work, we just need to store it.<br></blockquote><br>Hmm... are you planning to make the SourceType recursive?<br></div></blockquote><div><br></div>Possibly but no concrete plans about C++ yet. Let's start focusing on the single typedef case for now :-)</div><div><br></div><div><blockquote type="cite"><div><br><blockquote type="cite"><blockquote type="cite">Also, your suggestion doesn't really address where exactly you plan to<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">store your flag; there aren't any spare bits in QualType.<br></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">The flag is just a boolean to pass to Sema to tell it whether to create<br></blockquote><blockquote type="cite">SourceTypes or not. If the flag is false, Sema will discard the source info<br></blockquote><blockquote type="cite">and just pass QualTypes to the Decls, as it currently does.<br></blockquote><br>Oh, I see; it would vary with a flag on the ASTContext rather than the<br>individual Decls.<br></div></blockquote><div><br></div>Yes exactly; but note that whether a TypeSpecifier wraps a 'plain' QualType or a QualType containing a SourceType can be varied and checked using TypeSpecifier::isSourceType().</div><div><br></div><div>This is basically what the TypeSpecifier would look like:</div><div><br></div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(14, 98, 65); "><span style="color: #8f0768">class</span><span style="color: #000000"> </span>TypeSpecifier<span style="color: #000000"> {</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(14, 98, 65); "><span style="color: #000000">  </span>QualType<span style="color: #000000"> </span><span style="color: #1b02ca">Ty</span><span style="color: #000000">;</span></div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; min-height: 15.0px">  <br class="webkit-block-placeholder"></p><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(143, 7, 104); ">public<span style="color: #000000">:</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">  <span style="color: #8f0768">explicit</span> TypeSpecifier(<span style="color: #0e6241">QualType</span> type) : <span style="color: #1b02ca">Ty</span>(type) { }</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">  TypeSpecifier(<span style="color: #0e6241">SourceType</span> *sourceTy) : <span style="color: #1b02ca">Ty</span>(QualType(sourceTy, 0)) { }</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">  <span style="color: #0e6241">QualType</span> getType() <span style="color: #8f0768">const</span> {</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">    <span style="color: #8f0768">if</span> (<span style="color: #0e6241">SourceType</span> *ST = dyn_cast_or_null<<span style="color: #0e6241">SourceType</span>>(<span style="color: #1b02ca">Ty</span>.getTypePtr()))</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">      <span style="color: #8f0768">return</span> ST->getBaseType();</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">    <span style="color: #8f0768">return</span> <span style="color: #1b02ca">Ty</span>;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">  }</div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; min-height: 15.0px">  <br class="webkit-block-placeholder"></p><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">  <span style="color: #8f0768">bool</span> isSourceType() <span style="color: #8f0768">const</span> {</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">    <span style="color: #8f0768">return</span> dyn_cast_or_null<<span style="color: #0e6241">SourceType</span>>(<span style="color: #1b02ca">Ty</span>.getTypePtr()) <span style="color: #cf7811">!=</span> 0;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">  }</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">  <span style="color: #0e6241">SourceType</span> *getSourceType() <span style="color: #8f0768">const</span> { <span style="color: #8f0768">return</span> cast<<span style="color: #0e6241">SourceType</span>>(<span style="color: #1b02ca">Ty</span>); }</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">};</div><div><font class="Apple-style-span" face="Monaco" size="3"><span class="Apple-style-span" style="font-size: 11px;"><br></span></font></div></div><div><br></div><div>-Argiris</div></body></html>