[GSoC] Provide information for the type as written in template instantiations

Hi,
my name is Jan Svoboda and I’d like to participate in this year’s GSoC.

In particular, I’m interested in improving template-related error messages
by using sugared (as-written) representation of template type arguments:
https://llvm.org/OpenProjects.html#clang-template-instantiation-sugar.

I’ve been looking through the source code and I have two questions regarding
the proposed design approach:

  1. “… whenever a member of a class template specialization is accessed.”
    How can I detect this kind of member access? In the first example with
    vector<string>, is it as simple as checking the result of
    FunctionDecl::isTemplateInstantiation? I think this check could be
    done in FunctionDecl::getReturnType when deducing types in the
    assignment.

  2. “… add a new type node to represent template argument sugar,”
    How can I fetch the template argument sugar? I believe it’s already being
    stored in clang::TemplateArgument, but haven’t found and obvious way
    how to get it from FunctionDecl::getReturnType.

Any thoughts appreciated.

Thanks,
Jan