Here's another shot at this. This version will print template parameter names instead of actual types used in the instantiation. It covers return type, function parameters and parameters from the enclosing class/es.<div>

<br></div><div>Note that we don't show template parameter names when it comes to classes:</div><div><br></div><div>ClassTemplate<int>::memberFunction(T) [T = int] // GCC would show ClassTemplate<T></div><div>

<br></div><div>This part of the string is obtained by calling FunctionDecl::getQualifiedNameAsString. Showing template parameter names like GCC would require duplicating most of the code in getQualifiedNameAsString without any significant gain.</div>

<div><br></div><div>I added a few tests to test\CodeGenCXX\predefined-expr.cpp that cover:</div><div> - template parameter as return type</div><div> - function template with two template parameters</div><div> - template parameter that doesn't show up in the function declaration (used only inside the body)</div>

<div> - nested classes with template parameters</div><div> - non type template parameter</div><div> - template template parameter</div><div><br></div><div>There is also a FIXME that says: "Maybe this should use DeclPrinter with a special "print predefined expr" policy instead". I'm not really sure what this means as I am not familiar with printers and policies, but if you think it makes sense just point me in the right direction and I'll be more than happy to rework the code.</div>

<div><br></div><div>P.S. Gmail sets the mime type, let's see if changing the extension to .txt helps</div>