[cfe-dev] Rewriter in a macro

JohnH jan.hoogerbrugge at gmail.com
Tue Jan 29 12:42:44 PST 2013


I am not interested in code such as the token paste example. I mentioned the
hypothetical for to while
loop transformation. Code like this is not uncommon:

#define copy_array(a, b, n)  { int i; for(i = 0; i < n; i++) a[i] = b[i]; }

  copy_array(foo, bar)

I would like that the for loop inside the expanded macro will also be
rewritten.

If clang is able to rewrite the definition of the macro. What would happen
when the macro is expanded
multiple times? In the for to while loop rewrite example, a for loop will be
detected multiple times but
it needs to be rewritten only once.



--
View this message in context: http://clang-developers.42468.n3.nabble.com/Rewriter-in-a-macro-tp4030056p4030134.html
Sent from the Clang Developers mailing list archive at Nabble.com.



More information about the cfe-dev mailing list