[cfe-dev] [PATCH] Source location of "template" keyword in TemplateSpecializationTypeLoc.
Enea Zaffanella
zaffanella at cs.unipr.it
Tue Jan 31 05:04:30 PST 2012
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
DependentTemplateSpecializationTypeLoc
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
DependentTemplateSpecializationTypeLoc.
Enea.
-------------- 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/6770b78b/attachment.bin>
More information about the cfe-dev
mailing list