<div dir="ltr"><div class="gmail_quote"><div>Both of these projects duplicate a lot of code from clang-tidy and the AST matcher infrastructure in clang.</div><div><br></div><div>I'd be curious what the reasons are to not use those, so we can try to address them :)</div><div><br></div><div>Browsing over the code, I think a large percentage of it could be saved.</div><div>For example:</div><div><div>static CXXMethodDecl* isArgMethod(FunctionDecl *func)</div><div>{</div><div> if (!func)</div><div> return nullptr;</div><div><br></div><div> CXXMethodDecl *method = dyn_cast<CXXMethodDecl>(func);</div><div> if (!method || method->getNameAsString() != "arg")</div><div> return nullptr;</div><div><br></div><div> CXXRecordDecl *record = method->getParent();</div><div> if (!record || record->getNameAsString() != "QString")</div><div> return nullptr;</div><div><br></div><div> return method;</div><div>}</div></div><div><br></div><div>would become the AST matcher:</div><div>cxxMethodDecl(hasName("QString::arg"))</div><div><br></div><div>Generally, you could find calls to QString::arg with something like:</div><div>callExpr(callee(cxxMethodDecl(hasName("QString::arg"))))<br></div><div><br></div><div>Cheers,</div><div>/Manuel</div><div dir="ltr"><br></div><div dir="ltr">On Tue, Feb 14, 2017 at 11:29 PM Kevin Funk via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Tuesday, 14 February 2017 20:33:15 CET Richard Braun via cfe-dev wrote:<br class="gmail_msg">
> Hello,<br class="gmail_msg">
><br class="gmail_msg">
> During work on an internal Qt-based project at Novasys-Ingenierie,<br class="gmail_msg">
> a Clang plugin was written to convert string-based signals and slots<br class="gmail_msg">
> to the Qt5 syntax. The plugin has since been pushed to Github [1]<br class="gmail_msg">
> in the hope it will be useful to others facing similar issues.<br class="gmail_msg">
<br class="gmail_msg">
Heya Richard,<br class="gmail_msg">
<br class="gmail_msg">
just for the sake of making you aware of existing tools (to save work & share<br class="gmail_msg">
ideas): there already is a Qt oriented Clang-based code checker called Clazy<br class="gmail_msg">
mainly developed by one of my colleagues at KDAB.<br class="gmail_msg">
<br class="gmail_msg">
Clazy allows all sorts of checking & refactoring in Qt code. It also has a<br class="gmail_msg">
check for 'old-style-connect' & provides fixits for it: IOW, it will transform<br class="gmail_msg">
the code to new-style-connect statements if desired.<br class="gmail_msg">
<br class="gmail_msg">
Worth having a look, maybe you want to contribute some of your code there<br class="gmail_msg">
instead so it gets available to a wider audience:<br class="gmail_msg">
<a href="https://github.com/KDE/clazy" rel="noreferrer" class="gmail_msg" target="_blank">https://github.com/KDE/clazy</a><br class="gmail_msg">
<br class="gmail_msg">
Clazy has already been used to refactor *lots* of code in KDE land<br class="gmail_msg">
automatically.<br class="gmail_msg">
<br class="gmail_msg">
Hope that helps,<br class="gmail_msg">
Kevin<br class="gmail_msg">
<br class="gmail_msg">
PS: CC'ed Sergio, the main author.<br class="gmail_msg">
<br class="gmail_msg">
--<br class="gmail_msg">
Kevin Funk | <a href="mailto:kfunk@kde.org" class="gmail_msg" target="_blank">kfunk@kde.org</a> | <a href="http://kfunk.org" rel="noreferrer" class="gmail_msg" target="_blank">http://kfunk.org</a>_______________________________________________<br class="gmail_msg">
cfe-dev mailing list<br class="gmail_msg">
<a href="mailto:cfe-dev@lists.llvm.org" class="gmail_msg" target="_blank">cfe-dev@lists.llvm.org</a><br class="gmail_msg">
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" class="gmail_msg" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br class="gmail_msg">
</blockquote></div></div>