[cfe-dev] Templates (again)

Andrew Sutton andrew.n.sutton at gmail.com
Wed Dec 24 08:45:19 PST 2008


>
> This is in the tree now. Basically, we keep track of the template parameter
> lists that we've parsed and then provide those to the various Action
> routines that will end up constructing templates, e.g., ActOnTag for
> creating class templates (but not enum templates <g>).
>
> The Depth/Position stuff is working toward a fix in the type system.
> Basically, template parameters in the type system will be identified by
> their kind, depth (= the number of enclosing template parameter lists), and
> position with in that template parameter list. For example, 'T' in
>
>        template<typename T> void foo(T);
>
> is a template type parameter with depth=0 and position=0. That's the
> canonical type for 'T', and we'll use some sugar to give it the name 'T'.
> That way, we can quickly match the declaration above with the definition
> below
>
>        template<class U> void foo(U) { }
>
>        - Doug
>

I just merged my patches onto yours and started stubbing out some
declaration classes. I also broke the template node declarations out into
DeclTemplates.h/cpp so I could navigate around a little easier. It's
included at the bottom of DeclCXX for now. The new code doesn't really *do*
anything yet.

Also, I'm not entirely sure how to use TemplateParameterList. It's not quite
like any "list/array/vector" structure that I've run across. I'm guessing
that I'd have TemplateDecl contain a ptr to it, since the list is likely
created and populated during parsing.

I merged the changes into Dan (Christiansen's) Mercurial mirror on
BitBucket, here:

http://bitbucket.org/danchr/clang/

It's just a start, an offering for comments. More code to follow, but
probably not today or tomorrow.

Andrew Sutton
andrew.n.sutton at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20081224/63c6092c/attachment.html>


More information about the cfe-dev mailing list