<table><tr><td style="">rjvbb created this revision.<br />rjvbb added a reviewer: KDevelop.<br />rjvbb added a project: KDevelop.<br />rjvbb requested review of this revision.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D15530">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>This improves ObjC support:</p>

<ul class="remarkup-list">
<li class="remarkup-list-item">by recognising additional mimetypes (also in the source formatter)</li>
<li class="remarkup-list-item">by changing the logic in <tt style="background: #ebebeb; font-size: 13px;">argsForSession()</tt> such that the ObjC and ObjC++ mode arguments are appended to the other C/C++ arguments rather than replacing them.</li>
</ul>

<p>Those are probably the main changes that give a significant improvement. In addition, I added code for handling two more <tt style="background: #ebebeb; font-size: 13px;">CXCursor_*</tt> types (a bit via educated guessing). Handling <tt style="background: #ebebeb; font-size: 13px;">CXCursor_BlockExpr</tt> as a lambda expr. seems rather evident, it is much less clear how to handle <tt style="background: #ebebeb; font-size: 13px;">CXCursor_ObjCMessageExpr</tt> as I couldn't find a generic C/C++ expression handler (nor a corresponding CXCursor type, btw).</p></div></div><br /><div><strong>TEST PLAN</strong><div><p>Example project: <tt style="background: #ebebeb; font-size: 13px;">github:mulle-nat/mulle-xcode-to-cmake</tt> (requires gnustep-base to be installed).</p>

<p>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:</p>

<ul class="remarkup-list">
<li class="remarkup-list-item">the outline navigator drop-down list doesn't include any ObjC methods</li>
<li class="remarkup-list-item">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).</li>
<li class="remarkup-list-item">Class categories (e.g. <tt style="background: #ebebeb; font-size: 13px;">@implementation NSString (ExternalName)</tt>) are promoted to a class of their own, so methods in that category are listed as, for example, belonging to the class <tt style="background: #ebebeb; font-size: 13px;">ExternalName</tt> instead of the <tt style="background: #ebebeb; font-size: 13px;">NSString</tt> class to which they actually belong.</li>
<li class="remarkup-list-item">sticking with this example from the project above: the outline widget shows current ObjC methods inappropriately in C++ syntax, e.g. <tt style="background: #ebebeb; font-size: 13px;">ExternalName::externalNameForInternalName:separatorString:useAllCaps:</tt></li>
<li class="remarkup-list-item">selectors are sometimes mistaken for functions of the same name</li>
<li class="remarkup-list-item">in an expression like <tt style="background: #ebebeb; font-size: 13px;">[NSMutableString string]</tt>, <tt style="background: #ebebeb; font-size: 13px;">NSMutableString</tt> shows up as a function (in this case, the <tt style="background: #ebebeb; font-size: 13px;">string</tt> method) instead of as a class object (or instead of an instance variable in expressions like <tt style="background: #ebebeb; font-size: 13px;">[s length]</tt>).</li>
</ul>

<p>Fixing those on my own is out of my league, but I'm willing to lend a hand.</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R32 KDevelop</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D15530">https://phabricator.kde.org/D15530</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>plugins/astyle/astyle_plugin.cpp<br />
plugins/clang/duchain/builder.cpp<br />
plugins/clang/duchain/documentfinderhelpers.cpp<br />
plugins/clang/duchain/parsesession.cpp<br />
plugins/clang/kdevclangsupport.json</div></div></div><br /><div><strong>To: </strong>rjvbb, KDevelop<br /><strong>Cc: </strong>kdevelop-devel, antismap, iodelay, vbspam, geetamc, Pilzschaf, akshaydeo, surgenight, arrowd<br /></div>