Issues with clang_Cursor_getSpellingNameRange not reporting the correct range


Context: We're using libclang as our C++ parser backend in KDevelop.

We're having some difficulties in finding the correct range for some
identifiers using libclang. Example:

% cat test.cpp
struct Foo
    void operator++() {}

% c-index-test -cursor-at=test.cpp:3:10 test.cpp
3:10 CXXMethod=operator++:3:10 (Definition) Extent=[3:5 - 3:25]
Spelling=operator++ ([3:10 - 3:18])
Completion string: {ResultType void}{TypedText operator++}{LeftParen (}
{RightParen )}

Here, the range is obviously wrong: [3:10 - 3:18] only points to 'operator',
not 'operator++'. This is the fault of clang_Cursor_getSpellingNameRange.
This happens for a C++ destructor declaration (only '~' is in the range), and
all operator overloads (only 'operator' in the range).

I guess that this is a bug, and not intended, and that
clang_Cursor_getSpellingNameRange just needs special-casing for C.kind ==
CXCursor_CXXMethod and friends. Am I right in that assumption and a patch
would be accepted?


Yes =)

(Sorry if this has already been answered in another thread, I'm going
through my backlog of seemingly-unanswered mail.)