Review Request 120174: Fix SwitchToBuddy from function definitions for kdev-clang

Olivier Jean de Gaalon olivier.jg at gmail.com
Sat Sep 13 07:22:52 UTC 2014


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

Ship it!


Looks good, thanks!

You cannot remove the condition otherwise you'll always get the top context. In the future we just want to travel up until the first FunctionContext and use that, but for now this allow backwards compatibility with oldcpp's context structure.

Could you add a comment: "TODO: oldcpp: just need to find first FunctionContext"

- Olivier Jean de Gaalon


On Sept. 12, 2014, 11:49 p.m., Max Schwarz wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/120174/
> -----------------------------------------------------------
> 
> (Updated Sept. 12, 2014, 11:49 p.m.)
> 
> 
> Review request for KDevelop.
> 
> 
> Repository: kdevplatform
> 
> 
> Description
> -------
> 
> I'm using kdev-clang and the SwitchToBuddy functionality (Ctrl+Alt+c) does not work from function definition to declaration. See attached files for a minimal example.
> 
> The problem is that `SwitchToBuddy::switchDefinitionDeclaration()` just traverses `DUChainContext::Other` contexts while looking for a parent context owned by a definition. kdev-clang creates a `DUChainContext::Function` context for the definition (as I would expect), and the function fails to find a context.
> 
> Fix that by also considering `DUChainContext::Function` contexts. Maybe we can also drop the context type check, not sure why it is there.
> 
> 
> Diffs
> -----
> 
>   plugins/switchtobuddy/switchtobuddyplugin.cpp 142553f 
> 
> Diff: https://git.reviewboard.kde.org/r/120174/diff/
> 
> 
> Testing
> -------
> 
> Tested on a large private codebase and the KDevelop codebase, seems to work fine.
> 
> 
> File Attachments
> ----------------
> 
> test.cpp
>   https://git.reviewboard.kde.org/media/uploaded/files/2014/09/12/b9ecffbc-0637-4c50-a1f1-0cdbe0901e4a__test.cpp
> test.h
>   https://git.reviewboard.kde.org/media/uploaded/files/2014/09/12/e8a17aea-08d9-4947-aa87-7bd127043812__test.h
> 
> 
> Thanks,
> 
> Max Schwarz
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20140913/620f0782/attachment-0001.html>


More information about the KDevelop-devel mailing list