Skip to content
Commit 49d503f8 authored by Thomas Schöps's avatar Thomas Schöps Committed by Milian Wolff
Browse files

Properly display argument names of template functions

When hovering over a C++ template function, the function argument names were
shown incorrectly. For example, for the following function definition:

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

The function would be displayed like this in the tooltip:

    void foo(char a, char b)

This is because argument names, different from argument types, are fetched from
argumentContext->localDeclarations() for display. In case of template functions,
both the template arguments and the function arguments are in this list, which
was not accounted for. 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. (Note: I am not sure whether it is possible that the local
declarations list also contains other entries. I did not observe this during
some short testing. Also, not sure what the situation is for other languages
than C++.)

Test Plan: Some manual testing.

Reviewers: #kdevelop, mwolff

Reviewed By: #kdevelop, mwolff

Subscribers: aacid, mwolff, kdevelop-devel

Tags: #kdevelop

Differential Revision: https://phabricator.kde.org/D18218
parent 37cc98f3
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment