<div dir="ltr">On Tue, Jan 29, 2013 at 9:42 PM, JohnH <span dir="ltr"><<a href="mailto:jan.hoogerbrugge@gmail.com" target="_blank">jan.hoogerbrugge@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">I am not interested in code such as the token paste example. I mentioned the<br>

hypothetical for to while<br>
loop transformation. Code like this is not uncommon:<br>
<br>
#define copy_array(a, b, n)  { int i; for(i = 0; i < n; i++) a[i] = b[i]; }<br>
<br>
  copy_array(foo, bar)<br>
<br>
I would like that the for loop inside the expanded macro will also be<br>
rewritten.<br>
<br>
If clang is able to rewrite the definition of the macro. What would happen<br>
when the macro is expanded<br>
multiple times? In the for to while loop rewrite example, a for loop will be<br>
detected multiple times but<br>
it needs to be rewritten only once.<br></blockquote><div><br></div><div style>Yes, you need to generally deduplicate rewrites. This is even true for simple things as includes :)</div><div style><br></div><div style>Note that </div>
<div style><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Tooling/Refactoring.h?view=markup">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Tooling/Refactoring.h?view=markup</a><br></div>
<div style>has some infrastructure around the rewriter to help with that :)</div><div style><br></div><div style>Cheers,</div><div style>/Manuel</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

<br>
<br>
<br>
--<br>
View this message in context: <a href="http://clang-developers.42468.n3.nabble.com/Rewriter-in-a-macro-tp4030056p4030134.html" target="_blank">http://clang-developers.42468.n3.nabble.com/Rewriter-in-a-macro-tp4030056p4030134.html</a><br>

<div class=""><div class="h5">Sent from the Clang Developers mailing list archive at Nabble.com.<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></div></div>