[cfe-dev] Location of a TypeAliasDecl from a TemplateSpecializationType

David Blaikie dblaikie at gmail.com
Sun Apr 6 14:18:37 PDT 2014


On Sun, Apr 6, 2014 at 2:17 PM, David Blaikie <dblaikie at gmail.com> wrote:
> On Sun, Apr 6, 2014 at 2:09 AM, Richard Smith <richard at metafoo.co.uk> wrote:
>> On Sun, Apr 6, 2014 at 12:21 AM, David Blaikie <dblaikie at gmail.com> wrote:
>>>
>>> Is it possible to retrieve the location of a TypeAliasDecl from a
>>> TemplateSpecializationType representing an alias template?
>>
>>
>> Something like:
>>
>>
>> cast<TypeAliasTemplateDecl>(TST->getTemplateName()->getTemplateDecl())->getTemplatedDecl()
>
> Oh, thanks - didn't think to look inside the TemplateName for more
> details... good to know.
>
> Used to implement debug info for alias templates in 205691.
>
>> (plus error checking).
>
> From what I could tell in the docs the error cases won

(fat-fingered premature send)

error cases won't apply to this code path since it's specifically only
for type alias templates.

I haven't looked at whether we need to produce any debug info for
function alias templates.

>
>>> It looks like the connection between the type and the original decl is
>>> lost during construction - I guess it could/should be persisted? (in a
>>> manner similar to TypedefType, for example)
>>>
>>> I don't need the alias template to have specializations like a real
>>> template, so the decl that the TemplateSpecializationType points to
>>> can just be the TypeAliasDecl which is generic/defined in terms of
>>> template arguments.
>>>
>>> Specifically what I need is the location and the DeclContext where the
>>> alias was written so I can accurately describe the alias in the debug
>>> info.
>>>
>>> Thanks,
>>> - David
>>
>>



More information about the cfe-dev mailing list