[cfe-commits] [cfe-dev] [PATCH] Source location of "template" keyword in TemplateSpecializationTypeLoc.
Enea Zaffanella
zaffanella at cs.unipr.it
Wed Feb 1 07:23:24 PST 2012
On 01/31/2012 10:25 PM, Richard Smith wrote:
> Hi,
>
> On Tue, Jan 31, 2012 at 5:04 AM, Enea Zaffanella <zaffanella at cs.unipr.it
> <mailto: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.
OK, thanks.
> The patch itself is missing tests. Can the fix to TST's source range be
> tested with c-index-test?
Given the very little knowledge we have of the c-index-test tool, we can
not produce such a test unless some CIndex expert provides some useful
hints (e.g., pointing us to another testcase where c-index-test is used
to check non-trivial source location info from a TypeLoc; I say
"non-trivial" because in the relevant examples the TSTLoc is not the
outermost type, but it is wrapped by an ElaboratedTypeLoc).
Enea.
> Thanks,
> Richard
More information about the cfe-commits
mailing list