<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Nov 14, 2008, at 12:15 PM, Doug Gregor wrote:</div><br><blockquote type="cite"><div>On Fri, Nov 14, 2008 at 2:48 PM, Chris Lattner <<a href="mailto:clattner@apple.com">clattner@apple.com</a>> wrote:<br><blockquote type="cite">On Nov 13, 2008, at 10:00 AM, Doug Gregor wrote:<br></blockquote><blockquote type="cite"><blockquote type="cite">Known Issues<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">==========<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">There's a small layering violation in DeclarationName. DeclarationName<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">lives in the AST, because that's where it makes sense to talk about<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">the name of a declaration as a more abstract entity. However,<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">DeclarationNameExtras and Selector live in Basic, because Selector is<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">used in the Parse-Sema interaction and Selector's internal<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">implementation depends on DeclarationNameExtras.<br></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">I'm missing something: how is that a layering violation?  From your<br></blockquote><blockquote type="cite">description, it sounds like Sema will depend on Basic.  That is ok, but<br></blockquote><blockquote type="cite">basic can't depend on sema.<br></blockquote><br>The layering violation is that something in Basic declares a friend<br>that is in Sema, but it's admittedly a very weak form of Basic->Sema<br>dependency.</div></blockquote><div><br></div>Ahhh ok.  If it is just a friend, I wouldn't worry about it.</div><div><br></div><div><blockquote type="cite"><div>One option would be to move DeclarationName to Basic and use it to<br>completely replace Selector. Then everything that can name a<br>declaration will use a single class type, across all languages.<br></div></blockquote></div><br><div>Is that the right thing to do independently of the layering issue?  If so, then it's interesting.</div><div><br></div><div>Jumping to the patch, it definitely qualifies as "beautiful code".  I like it a lot and you did an outstanding job on the interfaces.  Here are some random minor comments:</div><div><br></div><div><br></div><div><div>+/// DeclarationNameExtra - Common base of the MultiKeywordSelector and</div> <div>+/// CXXSpecialName classes, both of which are private classes that can</div> <div>+/// be stored by the AST's DeclarationName class.</div> <div>+class DeclarationNameExtra {</div> <br></div><div>This and DeclarationName is very clever.  Can I con you into describing some of the high level design decisions behind this in docs/InternalsManual.html?</div><div><br></div><div><br></div><div><div>+class DeclarationName {</div> ..</div><div><div>+  /// getExtra - Get the "extra" information associated with this</div> <div>+  /// multi-argument selector or C++ special name.</div> <div>+  DeclarationNameExtra *getExtra() const {</div> <div>+    return reinterpret_cast<DeclarationNameExtra *>(Ptr & ~PtrMask);</div> <div>+  }</div> <br></div><div>Should assert that it is the right kind?  I guess it doesn't matter too much since it is private.</div><div><br></div><div><br></div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">+class DeclarationNameTable {</div><div><font class="Apple-style-span" face="Monaco" size="2"><span class="Apple-style-span" style="font-size: 10px;"><br></span></font></div><div><font class="Apple-style-span" face="Monaco" size="2"><span class="Apple-style-span" style="font-size: 10px;">Please add a doxygen comment.</span></font></div><div><font class="Apple-style-span" face="Monaco" size="2"><span class="Apple-style-span" style="font-size: 10px;"><br></span></font></div><div><font class="Apple-style-span" face="Monaco" size="2"><span class="Apple-style-span" style="font-size: 10px;"><br></span></font></div><div><font class="Apple-style-span" face="Monaco" size="2"><span class="Apple-style-span" style="font-size: 10px;"><br></span></font></div><div><font class="Apple-style-span" face="Monaco" size="2"><span class="Apple-style-span" style="font-size: 10px;"><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">+std::string NamedDecl::getName() const {</div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">...</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">+  default:</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">+    break;</div><div><br></div></div><div><br></div><div>What is the default case here?  This seems like it should be an assert(0), no?</div><div><br></div><div>-Chris</div><div><br></div></span></font></div></div></body></html>