<div style="font-family: arial, helvetica, sans-serif"><font size="2"><div class="gmail_quote">On Mon, Jun 18, 2012 at 4:13 PM, Stephen Kelly <span dir="ltr"><<a href="mailto:steveire@gmail.com" target="_blank">steveire@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">Manuel Klimek wrote:<br>
<br>
> Hi Stephen,<br>
><br>
> first, really cool blog post, and thanks for providing feedback & docs and<br>
> helping us making the tools more awesome - we really appreciate this!<br>
<br>
</div>No problem. Clang based porting tools is a cool party :).<br>
<div class="im"><br>
>> After that, the matches are actually nested function calls (the<br>
>> capitalisation style for functions seems funny to use Qt developers).<br>
>> Nested<br>
>><br>
><br>
> Yea, that's not set yet - please chime in with your color of the bikeshed<br>
> on the review thread for the ast matchers ;) I seriously don't care, so I<br>
> want people who care about one way or the other to jump in with good<br>
> arguments of why their preferred way is superior :D<br>
<br>
</div>Is the review thread on cfe-commits? I'm not really familiar with how<br>
reviews are done in this community yet. Does this mean that the content of<br>
the branch is being rebased and applied to trunk?<br></blockquote><div><br></div><div>Yep. The content of the branch is "rebased" (well, as far as you can do that in svn) continuously anyway (usually about once per week, or when somebody screams at me because the compile breaks).</div>
<div><a href="http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20120611/059010.html">http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20120611/059010.html</a> </div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<br>
I don't think I'll jump in on this bikeshed aspect though :). The case is<br>
something I noted for colleagues who use Qt all day, where the convention is<br>
methods/functions = lowercase first letter. If you want to be 'compatible'<br>
with Qt, they would need to be changed, but otherwise it's not important :).<br></blockquote><div><br></div><div>Fair enough...</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<br>
>> [End copy-paste]<br>
>><br>
><br>
> All accurate.<br>
<br>
Great, thanks.<br>
<div class="im"><br>
><br>
>> I was also wondering if there is an easy way to only modify the code<br>
>> inside the repo and not included headers? In my tool I require the user<br>
>> to pass the<br>
>> source-dir on the command line, and then manually check paths to see if<br>
>> they<br>
>> are below it, but this is error-prone.<br>
>><br>
><br>
> If with "manually", you mean "do a regexp match on the path", then yep,<br>
> that's what I also do.<br>
> Why is that error prone?<br>
<br>
</div>There could be aspects of relative/absolute paths, symlinks, os-specific<br>
issues, bugs in the regexp, etc.<br>
<div class="im"><br>
>> Additionally, many of the concepts I encoded are generic, not Qt specific<br>
>> (such as renaming methods, enums etc). It seems that these could be re-<br>
>> usable, so we could either add some version of this to the clang<br>
>> examples, and/or see if we can define a higher level collection of ways<br>
>> to refactor the code. I presume google also has some collection/repo of<br>
>> such things already?<br>
>><br>
><br>
> Unfortunately not. Most of the engineers using those tools at Google have<br>
> pretty non-standard and complex problems, at which point other costs start<br>
> to dwarf writing the matchers and replacements.<br>
><br>
> But we are starting to work on a more principled approach that includes<br>
> ready-made refactorings, targeted towards small scale use cases ("I want<br>
> to rename what is under my cursor", we actually have a prototype for this<br>
> in the branch).<br>
<br>
</div>The ClangRename example?<br>
<br>
Yes, that's also useful in the context of an IDE I think, but in terms of<br>
our goals of a 'fire and forget' tool that does the boring parts of a<br>
porting job, it's not really so important to rename things by symbol under<br>
cursor or at a location in a file.<br></blockquote><div><br></div><div>Good point.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div class="h5"><br>
><br>
><br>
>><br>
>> Finally, the suggestion here:<br>
>><br>
>><br>
<a href="http://thread.gmane.org/gmane.comp.compilers.clang.devel/20433/focus=20759" target="_blank">http://thread.gmane.org/gmane.comp.compilers.clang.devel/20433/focus=20759</a><br>
>><br>
>> was not quite what I needed to use to correctly match the code used. The<br>
>> matcher I used was this:<br>
>><br>
>>  Finder.addMatcher(<br>
>>    Id("call",<br>
>>      Call(<br>
>>        Callee(Function(HasName(QtEscapeFunction))),<br>
>>        HasArgument(<br>
>>          0,<br>
>>          AnyOf(<br>
>>            BindTemporaryExpression(has(Id("ctor", ConstructorCall()))),<br>
>>            BindTemporaryExpression(has(Id("operator",<br>
>> OverloadedOperatorCall()))),<br>
>>            Id("operator", OverloadedOperatorCall()),<br>
>>            Id("ctor", ConstructorCall()),<br>
>>            Id("expr", Expression())<br>
>>          )<br>
>>        )<br>
>>      )<br>
>>    ),<br>
>>    &Callback);<br>
>><br>
>> So I had to add some extra BindTemporaryExpression() into the expression<br>
>> which I would have preferred to be automatic, like I think some implicit<br>
>> cast stuff is.<br>
>><br>
><br>
> Yep, the temporary stuff is not yet perfect. Ideas welcome, preferably<br>
> when we have it in mainline ;) (there's a review thread currently open -<br>
> afaik nobody answered yet).<br>
<br>
</div></div>I'd like to have a look if you can link it.<br>
<br></blockquote><div><br></div><div>See link above. Feedback welcome! </div><div><br></div><div>Cheers,</div><div>/Manuel</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Thanks,<br>
<div class="HOEnZb"><div class="h5"><br>
Steve.<br>
<br>
<br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
</div></div></blockquote></div><br></font></div>