Review Request 116842: Added virtual override completion to kdev-clang

Olivier Jean de Gaalon olivier.jg at gmail.com
Thu Mar 20 05:09:22 UTC 2014



> On March 19, 2014, 6:34 a.m., Olivier Jean de Gaalon wrote:
> > codecompletion/context.cpp, line 211
> > <https://git.reviewboard.kde.org/r/116842/diff/2/?file=255285#file255285line211>
> >
> >     Are you sure this is necessary? What about clang_getSpecializedCursorTemplate?
> 
> David Stevens wrote:
>     No, that doesn't work. clang_getSpecializedCursorTemplate brings the cursor from an instantiation Foo<int> to the template Foo<T>.
>     
>     It looks like new versions if libclang include a function clang_Type_getTemplateArgumentAsType, but that doesn't seemt to be available in libclang-3.4.
> 
> Olivier Jean de Gaalon wrote:
>     I mean to recurse into the cursor returned by clang_getSpecializedCursorTemplate(templateBaseClass). That way the template paramaters are already correctly resolved, and you don't need to string-replace them at all.
> 
> David Stevens wrote:
>     That's not what clang_getSpecializedCursorTemplate does. You give clang_getSpecializedCursorTemplate a cursor that is a specialized or instantiated template, and it returns a cursor for the template from which it was specialized or instantiated. So the returned cursor has none of the necessary type information. Recursing into the returned cursor gives me the template parameter types, which I then match with the parsed argument types. I think clang_getSpecializedFromCursorTemplate would be a clearer name for the function.

Ah ok, I had it backwards. Just fix typo getTempalteTypes > getTemplateTypes then.
It would be nice to have a way to handle "virtual void std::vector<T> foobar()" as well, but it shouldn't hold up the patch.


- Olivier Jean de


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/116842/#review53386
-----------------------------------------------------------


On March 20, 2014, 3:22 a.m., David Stevens wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/116842/
> -----------------------------------------------------------
> 
> (Updated March 20, 2014, 3:22 a.m.)
> 
> 
> Review request for KDevelop.
> 
> 
> Repository: kdev-clang
> 
> 
> Description
> -------
> 
> Added virtual override completion to kdev-clang. Regular functions, template functions, and pure functions work. Signals and slots don't work, and const-qualified functions lose their qualifier. I'm not sure if the UI is completely correct.
> 
> 
> Diffs
> -----
> 
>   codecompletion/context.cpp f6e85d6 
>   codecompletion/context.h aa6fcfb 
> 
> Diff: https://git.reviewboard.kde.org/r/116842/diff/
> 
> 
> Testing
> -------
> 
> Manual testing.
> 
> 
> Thanks,
> 
> David Stevens
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20140320/faed68e4/attachment.html>


More information about the KDevelop-devel mailing list