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

Max Schwarz max.schwarz at online.de
Fri Sep 12 22:28:34 UTC 2014


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

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/20140912/2b127107/attachment.html>


More information about the KDevelop-devel mailing list