Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Support for C++14 Variable Templates



On Thu, Oct 8, 2015 at 8:42 AM, Lukas Wegmann <lukas.wegmann@xxxxxx> wrote:
Here are some updates on the progress on variable templates and some questions concerning the implementation.

I’ve succeeded to implement most parts of binding resolution for variable templates. Furthermore, there are now PDOM bindings for variable and field templates. Reusing most parts of the class template resolution logic has been surprisingly easy :)

Currently, I use the following class hierarchy to represent bindings of templates, instances, specializations and partial specializations:

Inline-Bild 2

ICPPPartiallySpecializable abstracts over class and variable templates which can both be partially specialized. Accordingly, there is ICPPPartialSpecialization to represent partial specializations of classes and variables.

Some questions about this design:

- What public interfaces are needed? For example, do we need a ICPPFieldInstance?

It's preferable to be conservative and to add public interfaces only when there is a known use case for them.

- Is creating redundant classes/interfaces for variables and fields reasonable? At one hand, this corresponds to the current hierarchy of functions and methods and adds to the existing ICPPField hierarchy. On the other hand, it leads to a lot of duplicated code. Furthermore, the distinction between members and globals does not exist for classes.

Duplicate code can be reduced by moving it to shared static methods.
 
- Does every binding class need a corresponding PDOM and Composite binding or are there cases that allow to reuse those for multiple binding types?

Yes, pretty much. One way to make sure nothing is missing is to add tests to both AST2TemplateTests and to IndexCPPTemplateResolutionTest.


Regards,

Lukas

-sergey 

_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/cdt-dev


Back to the top