<div dir="ltr">This type is a union of:<div><br></div><div> - Stmt</div><div> - Decl</div><div> - Type</div><div> - TemplateArgument</div><div> - NestedNameSpecifier</div><div> - NestedNameSpecifierLoc (!)</div><div> - QualType (!)</div>
<div> - TypeLoc (!)</div><div> - CXXCtorInitializer<br><div><br></div><div>... and is used for:</div><div><br></div><div><div class="gmail_extra"> - AST matchers<br> - the parent map (as an implementation detail, where it's really just used as an obscure way of writing PointerUnion<Decl*,Stmt*>)<br>
 - and nothing else<br><br>This really seems to be a discriminated union of "the things that AST matchers want to match", rather than some fundamental concept like an "AST node". So, I'd suggest...</div>
<div class="gmail_extra"><br></div><div class="gmail_extra">1) The parent map stops using it and uses a more appropriate data structure (unless we have some reason to think this is the right long-term direction for it?)</div>
<div class="gmail_extra">2) We move it into ASTMatchers/ as clang::ast_matchers::Node or similar.</div><div class="gmail_extra"><br></div><div class="gmail_extra">Likewise, I think RecursiveASTVisitor should have its own discriminated union type, rather than trying to cram its requirements into DynTypedNode.<br>
<br><div class="gmail_quote">On Tue, May 20, 2014 at 11:06 AM, Manuel Klimek <span dir="ltr"><<a href="mailto:klimek@google.com" target="_blank">klimek@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div dir="ltr">+doug & richard, as the keepers of clang<div><br></div><div>I'm not too bought into any name, but somebody needs to make a decision.</div></div><div class=""><div class="h5"><div class="gmail_extra">
<br><br><div class="gmail_quote">
On Tue, May 20, 2014 at 8:00 PM, Sean Silva <span dir="ltr"><<a href="mailto:chisophugis@gmail.com" target="_blank">chisophugis@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div>On Tue, May 20, 2014 at 11:50 AM, Alp Toker <span dir="ltr"><<a href="mailto:alp@nuanti.com" target="_blank">alp@nuanti.com</a>></span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><br>
On 20/05/2014 20:42, Sean Silva wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div>
<br>
<br>
<br>
On Tue, May 20, 2014 at 11:37 AM, Alp Toker <<a href="mailto:alp@nuanti.com" target="_blank">alp@nuanti.com</a> <mailto:<a href="mailto:alp@nuanti.com" target="_blank">alp@nuanti.com</a>>> wrote:<br>
<br>
<br>
    On 20/05/2014 20:34, Manuel Klimek wrote:<br>
<br>
        On Tue, May 20, 2014 at 7:19 PM, Sean Silva<br>
        <<a href="mailto:chisophugis@gmail.com" target="_blank">chisophugis@gmail.com</a> <mailto:<a href="mailto:chisophugis@gmail.com" target="_blank">chisophugis@gmail.com</a>><br></div>
        <mailto:<a href="mailto:chisophugis@gmail.com" target="_blank">chisophugis@gmail.com</a> <mailto:<a href="mailto:chisophugis@gmail.com" target="_blank">chisophugis@gmail.com</a>><u></u>>><div>
<br>
        wrote:<br>
<br>
            Manuel, do you remember why this name was chosen? I seem<br>
        to recall<br>
            thinking that the name was well-chosen.<br>
<br>
<br>
        It's a DynTypedNode, because the type information is kept /<br>
        available dynamically. ASTNode would suggest that there is a<br>
        common interface for AST nodes, which there is not.<br>
<br>
<br>
    Well, QualType is a wrapper around Type structures that works<br>
    similarly and we don't make the distinction there.<br>
<br>
<br>
        What doesn't work for me is saying "DynTypedNode is an AST<br>
        node". This feels wrong. DynTypedNode is more like a "smart<br>
        reference".<br>
<br>
<br>
    How about ASTNodeRef? I don't have a strong feeling about ASTNode<br>
    / ASTNodeRef or something along those lines, but DynTypedNode<br>
    specifically doesn't feel right.<br>
<br>
    The current name doesn't mean much outside ASTMatchers lingo<br>
    whereas the functionality is fairly general and could be useful<br>
    elsewhere.<br>
<br>
<br>
There was some speculation about extending use of DynTypedNode outside the ASTMatchers library <a href="http://reviews.llvm.org/D33?id=85#inline-386" target="_blank">http://reviews.llvm.org/D33?<u></u>id=85#inline-386</a>; is there something in particular that you have in mind that you are trying to work towards?<br>



</div></blockquote>
<br>
Yes, it became apparent during the RecursiveASTVisitor / DataRecursiveASTVisitor that we have two data recursion techniques and this showed up as a possible way forward while investigating whether it's feasible to unify them. That kind of unification would be far off but the associated cleanup makes sense to make this class more discoverable outside of ASTMatchers.<br>



<br>
DynTypedNode, along with the parent map in ASTContext is fairly useful with the caveat that the code reads rather silly with the name "DynTypedNode" where what you have and what you want is an AST node reference.<br>


</blockquote><div><br></div></div></div><div>Makes sense; I agree that DynTypedNode doesn't work too well in that context.</div><div><br></div><div>I'm still not a fan of anything that would suggest that there is a unified AST hierarchy (IMO even ASTNodeRef suggests that there is some sort of underlying unified "ASTNode" being "Ref"erenced). Maybe ASTVariant?</div>

<span><font color="#888888">
<div><br></div><div>-- Sean Silva</div></font></span><div><div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

<br>
Alp.<br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div>
<br>
-- Sean Silva<br>
<br>
<br>
    Alp.<br>
<br>
<br>
<br>
<br>
        Cheers,<br>
        /Manuel<br>
<br>
<br>
            -- Sean Silva<br>
<br>
<br>
            On Sun, May 18, 2014 at 11:18 PM, Alp Toker<br>
        <<a href="mailto:alp@nuanti.com" target="_blank">alp@nuanti.com</a> <mailto:<a href="mailto:alp@nuanti.com" target="_blank">alp@nuanti.com</a>><br></div><div>
            <mailto:<a href="mailto:alp@nuanti.com" target="_blank">alp@nuanti.com</a> <mailto:<a href="mailto:alp@nuanti.com" target="_blank">alp@nuanti.com</a>>>> wrote:<br>
<br>
                This is always referred to as an AST node in<br>
        documentation. By<br>
                wrapping Decls, Stmts and QualTypes it provides a<br>
        generalised<br>
                way to reference AST nodes. And despite the name,<br>
        DynTypedNode<br>
                doesn't have anything to do with dynamic types in the AST.<br>
<br>
                The attached patch renames the class and implementation to<br>
                ASTNode.<br>
<br>
                (Indeed the namespace "ast_type_traits" is equally<br>
        confusing.<br>
                Presumably both are cases where implementation details<br>
        have<br>
                leaked into the naming scheme?)<br>
<br>
                Alp.<br>
<br>
                -- <a href="http://www.nuanti.com" target="_blank">http://www.nuanti.com</a><br>
                the browser experts<br>
<br>
<br>
                ______________________________<u></u>_________________<br>
                cfe-commits mailing list<br>
        <a href="mailto:cfe-commits@cs.uiuc.edu" target="_blank">cfe-commits@cs.uiuc.edu</a> <mailto:<a href="mailto:cfe-commits@cs.uiuc.edu" target="_blank">cfe-commits@cs.uiuc.<u></u>edu</a>><br></div>
        <mailto:<a href="mailto:cfe-commits@cs.uiuc.edu" target="_blank">cfe-commits@cs.uiuc.<u></u>edu</a> <mailto:<a href="mailto:cfe-commits@cs.uiuc.edu" target="_blank">cfe-commits@cs.uiuc.<u></u>edu</a>>><div>


<br>
        <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/cfe-commits</a><br>
<br>
<br>
<br>
<br>
    --     <a href="http://www.nuanti.com" target="_blank">http://www.nuanti.com</a><br>
    the browser experts<br>
<br>
<br>
</div></blockquote><div><div>
<br>
-- <br>
<a href="http://www.nuanti.com" target="_blank">http://www.nuanti.com</a><br>
the browser experts<br>
<br>
</div></div></blockquote></div></div></div><br></div></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div></div></div></div>