[cfe-dev] Repeated NNS in Elaborated types?

Abramo Bagnara abramo.bagnara at gmail.com
Wed Mar 2 15:33:31 PST 2011


Il 03/03/2011 00:22, Enea Zaffanella ha scritto:
> Il 02/03/2011 18:26, Douglas Gregor ha scritto:
>>
>> On Mar 2, 2011, at 8:44 AM, Enea Zaffanella wrote:
> [...]
>>> Does this sound as a reasonable approach?
>>
>>
>> Good find. I hadn't realized that this duplication actually occurred
>> in our ASTs.
>>
>> However, I suggest that we take the opposite approach: when we see
>> that we're building a TemplateSpecializationType with a
>> QualifiedTemplateName, map that QTN down to the underlying template
>> name.
> 
> We had a try on this, but we start suspecting that we have not enough
> confidence with this portion of clang code, which also seems to be
> changing very quickly. It is unclear to us, for instance, whether a QTN
> can be mapped to a simple template name without breaking the existing
> invariants. So, if you have a clearer picture of what needs to be done,
> then your help will be greatly appreciated. On our side, we will keep
> checking the accuracy of source location info and provide all feedback
> we can.

Perhaps something more than a try ;-) The truth is that the repeated NNS
breaks several tests from the testsuite of our application and it is an
unfortunate obstacle to adopt the otherwise great new NNSLoc machinery.

>> The reasoning is that we'd like to move away from using
>> TemplateName as the representation for the template in
>> TemplateSpecializationType, and instead use a TemplateDecl * [1].
>> However, stripping off the QualifiedTemplateName would be a step in
>> the right direction.
>>
>> - Doug
>>
>> [1] Even better: introduce a TypeTemplateDecl into the Decl
>> hierarchy, which is the common superclass of ClassTemplateDecl,
>> TemplateTemplateParmDecl, and the not-yet-implemented
>> AliasTemplateDecl. This isn't trivial, since RedeclarableTemplate
>> currently gets in the way.

Indeed this seems the right path.



More information about the cfe-dev mailing list