Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] what exactly is stored in the index?

Lets consider a case involving template specialization:

template <typename T> class A {};

template <> class A<int> { A(const char* s) {} }

void f()
{
         typedef int Int;
         A<Int> a("");
}

'A' in 'A<Int> a("");' is a reference to template class A and a("") contains an implicit reference to constructor A<int>::A(const char*). It looks like these are the only two references that we need for search and rename refactoring. The reference to the template specialization A<int> is not needed since rename refactoring does not need it and C/C++ search cannot search for specializations.

-sergey


On Fri, Jan 4, 2013 at 12:38 PM, Nathan Ridge <zeratul976@xxxxxxxxxxx> wrote:

>>>> template <typename T> class A {};
>>>>
>>>> void f()
>>>> {
>>>>          typedef int Int;
>>>>          A<Int> a;
>>>> }
>>>
>>> It seems that the class instance A<Int> should not be stored in the
>>> index, but there should be a PDOMName representing 'A' in 'A<Int> a;'
>>
>> Why, if it's a local declaration?
>
> Class A is a global binding and we need to keep track of all references
> to global bindings, both in global and local contexts. This is needed
> for search, rename refactoring, etc.

I see. But given that the local type 'Int' is a typedef for the global
type 'int', shouldn't a search for 'A<int>' find the 'A<Int>' as well?

Thanks,
Nate



_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev


Back to the top