This patch adds additional printing of template argument list when the described function is a template specialization.
This can be useful when handling complex template functions in constexpr evaluator.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Generally in favour of this, but I wonder if we ought to have a way of suppressing it when the specialisation is known and ends up being a gargantuan name (this is a discussion, not an action item). cc @dblaikie
Do we not already have some function name printing helper we could be reusing that might have some smarts about not printing deduced template arguments, using preferred names, whatever else?
FunctionDecll::getNameForDiagnostic yields almost the same result and I should use it here.
This function internal avoids printing template args that match the defaults, but it doesn't seem to have other techniques to reduce the size of printing.
Link: https://github.com/llvm/llvm-project/blob/03125e6894f82f9aa6f4e8d8036d0c833dd7d761/clang/lib/AST/TypePrinter.cpp#L2163-L2229
BTW, Line2171-2173 in the link seems to be dead code.
I think this looks fine, I just wonder if we should be adding more tests to make sure we cover the a fuller set of types and non-type template parameters. I feel like this is always what bites us when bugs come up, if we had just test more carefully we would have caught the problem earlier.
@hazohelet can you commit this yourself, or do you need someone to commit it on your behalf? (& if so, what name/email address would you like to be credited)
Thanks for the review.
I have commit access now, so I'll land this myself.
I'll add some missing tests on method function templates before landing this.