D15530: kdev-clang : somewhat more complete ObjC(++) support

René J.V. Bertin noreply at phabricator.kde.org
Sat Sep 15 13:07:27 BST 2018

rjvbb created this revision.
rjvbb added a reviewer: KDevelop.
rjvbb added a project: KDevelop.
rjvbb requested review of this revision.

  This improves ObjC support:
  - by recognising additional mimetypes (also in the source formatter)
  - by changing the logic in `argsForSession()` such that the ObjC and ObjC++ mode arguments are appended to the other C/C++ arguments rather than replacing them.
  Those are probably the main changes that give a significant improvement. In addition, I added code for handling two more `CXCursor_*` types (a bit via educated guessing). Handling `CXCursor_BlockExpr` as a lambda expr. seems rather evident, it is much less clear how to handle `CXCursor_ObjCMessageExpr` as I couldn't find a generic C/C++ expression handler (nor a corresponding CXCursor type, btw).

  Example project: `github:mulle-nat/mulle-xcode-to-cmake` (requires gnustep-base to be installed).
  Parsing of the project's ObjC file seems much more complete with my patch (once you get KDevelop to recognise .m files as ObjC by default). There's still plenty room for improvement though:
  - the outline navigator drop-down list doesn't include any ObjC methods
  - instance and class functions appear as "invalid type" in context browser popups, both when hovering over their definition or when they're used as a selector in a message sent to an instance variable (or class object).
  - Class categories (e.g. `@implementation NSString (ExternalName)`) are promoted to a class of their own, so methods in that category are listed as, for example, belonging to the class `ExternalName` instead of the `NSString` class to which they actually belong.
  - sticking with this example from the project above: the outline widget shows current ObjC methods inappropriately in C++ syntax, e.g. `ExternalName::externalNameForInternalName:separatorString:useAllCaps:`
  - selectors are sometimes mistaken for functions of the same name
  - in an expression like `[NSMutableString string]`, `NSMutableString` shows up as a function (in this case, the `string` method) instead of as a class object (or instead of an instance variable in expressions like `[s length]`).
  Fixing those on my own is out of my league, but I'm willing to lend a hand.

  R32 KDevelop



To: rjvbb, #kdevelop
Cc: kdevelop-devel, antismap, iodelay, vbspam, geetamc, Pilzschaf, akshaydeo, surgenight, arrowd
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20180915/84a0e24b/attachment.html>

More information about the KDevelop-devel mailing list