<table><tr><td style="">thomassc created this revision.<br />Herald added a project: KDevelop.<br />Herald added a subscriber: kdevelop-devel.<br />thomassc requested review of this revision.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D18218">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>When hovering over a C++ template function, the function argument names were shown incorrectly. For example, for the following function definition:</p>

<p>template <int a><br />
void foo(char b, char c) {}</p>

<p>The function would be displayed like this in the toolip:</p>

<p>void foo(char a, char b)</p>

<p>This is because argument names, different from argument types, are fetched from argumentContext->localDeclarations() for display.<br />
In case of template functions, both the template arguments and the function arguments are in this list, which was not accounted for.<br />
This diff changes the behavior to count the function arguments from the end of the local declarations instead of the start, which fixes the bug.<br />
(Note: I am not sure whether it is possible that the local declarations list also contains other entries. I did not observe<br />
this during some short testing. Also, not sure what the situation is for other languages than C++.)</p>

<p>Note to reviewers: Before realizing that the issue can be solved as easily as in this diff, I implemented a solution<br />
which associates template function parameters with that function, in the same way that template class parameters are<br />
associated with that class (in the Identifier class). I could also post this if you think it is useful.</p></div></div><br /><div><strong>TEST PLAN</strong><div><p>Some manual testing.</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R32 KDevelop</div></div></div><br /><div><strong>BRANCH</strong><div><div>fix_template_function_arguments_3 (branched from master)</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D18218">https://phabricator.kde.org/D18218</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>kdevplatform/language/duchain/navigation/abstractdeclarationnavigationcontext.cpp</div></div></div><br /><div><strong>To: </strong>thomassc<br /><strong>Cc: </strong>kdevelop-devel, glebaccon, hase, antismap, iodelay, geetamc, Pilzschaf, akshaydeo, surgenight, arrowd<br /></div>