An example:
#include <vector>
template<typename T>
class Stack {
std::vector<T> elems;
};
int main() {
Stack<int> intStack;
Stack<bool> boolStack;
}
intStack and boolStack both resolve to my primary template Stack. But if I resolve intStack our current context is T=int and I want to be able to also resolve the containing std::vector<T> elems to the primary template vector. By context I mean the types of all template parameters, in the above example T=int.
But if I resolve boolStack my current context is T=bool so std::vector<T> elems should resolve to the fully specialized vector template. It should resolve to the same as when I have std::vector<bool>.
The final goal is to get an instance of ICPPSpecialization for a name, e.g. for the template-id vector<T> (where T is in the current context an int or a bool or anything else) so we can call getTemplateParameterMap() and getSpecializedBinding(). We want to know to which template a name resolves in a specific context and what the chosen template arguments are. So we want to instantiate the template even if it depends on other template arguments. The existing CDT methods return a deferred binding if a type depends on a template argument so we needed a workaround to instantiate such templates.
The described workflows are our solutions to get the ICPPSpecialization for a name/template-id and avoiding that we get a deferred binding. The first paragraph describes how we get the ICPPFunctionInstance for a function call _expression_ and the second how we instantiate a class template to get a ICPPSpecialization that is not of type ICPPUnknownBinding.
We only want to instantiate the template to later get the template definition so we can show it in our view and find further names inside the template body that depend on a template argument. Instantiating the template was the easiest way we could think of. We don’t want to change something in the user code.
Since we rely on reflection to achieve this with existing CDT methods that are not public, I asked if it is possible to change the mentioned methods so they are public or I can pass the current context (template arguments) that should be considered when resolving the name.
Is it still unclear what I mean by that? If so, what is unclear?