[cfe-dev] [PATCH] Source location of "template" keyword in TemplateSpecializationTypeLoc.

Richard Smith richard at metafoo.co.uk
Tue Jan 31 13:25:16 PST 2012


On Tue, Jan 31, 2012 at 5:04 AM, Enea Zaffanella <zaffanella at cs.unipr.it>wrote:

> Please find attached for review a patch that adds the source location of
> the optional "template" keyword to TemplateSpecializationTypeLoc, thereby
> allowing for a more faithful AST representation of constructs such as the
> following:
> namespace N {
> template <typename T>
> struct S;
> }
> template <typename T>
> void foo() {
>  N::S<T> s;          // TSTLoc without template keyword
>  N::template S<T> s; // TSTLoc with template keyword
> }
> NOTE: we can not exploit the pretty printer to provide a testcase for the
> patch, because (as far as we can tell) the pretty printer is visiting the
> Type hierarchy (i.e., it disregards the TypeLoc hierarchy).
> While at it, also renamed a few members in class
>  DependentTemplateSpecializatio**nTypeLoc
> so as to have a more consistent and clearer naming scheme:
>  getKeywordLoc --> getElaboratedKeywordLoc
>  getNameLoc    --> getTemplateNameLoc
> The patch is adding 3 new FIXME's in TreeTransform.h: these will be
> addressed in a forthcoming patch adding the template keyword location to
> DependentTemplateSpecializatio**nTypeLoc.

Patches should be sent to cfe-commits for review; dropping cfe-dev via bcc.

The patch itself is missing tests. Can the fix to TST's source range be
tested with c-index-test?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120131/d25f9360/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TSTLoc-TemplateKW.patch
Type: text/x-patch
Size: 27510 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120131/d25f9360/attachment.bin>

More information about the cfe-dev mailing list