<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 12/08/14 21:47, Bogdan Tabacaru
wrote:<br>
</div>
<blockquote
cite="mid:1407872869.35668.YahooMailNeo@web120004.mail.ne1.yahoo.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<div style="color:#000; background-color:#fff;
font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial,
Lucida Grande, sans-serif;font-size:12pt">
<div><span>Do you happen to have a simple out of the box example
which works for you?</span></div>
<div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida
Grande', sans-serif; font-style: normal; background-color:
transparent;"><span>It might still be something that I am
doing wrong and it might not be related to the Consumers.</span></div>
<div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida
Grande', sans-serif; font-style: normal; background-color:
transparent;"><span><br>
</span></div>
<div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida
Grande', sans-serif; font-style: normal; background-color:
transparent;"><span>I would appreciate it very much! Thank
you!</span></div>
</div>
</blockquote>
<a class="moz-txt-link-freetext" href="https://github.com/vgvassilev/clad/tree/master/tools">https://github.com/vgvassilev/clad/tree/master/tools</a><br>
<br>
I hope it helps.<br>
Vassil<br>
<blockquote
cite="mid:1407872869.35668.YahooMailNeo@web120004.mail.ne1.yahoo.com"
type="cite">
<div style="color:#000; background-color:#fff;
font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial,
Lucida Grande, sans-serif;font-size:12pt">
<div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida
Grande', sans-serif; font-style: normal; background-color:
transparent;"><span><br>
</span></div>
<div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida
Grande', sans-serif; font-style: normal; background-color:
transparent;"><span>Bogdan</span></div>
<div class="qtdSeparateBR"><br>
<br>
</div>
<div class="yahoo_quoted" style="display: block;">
<div style="font-family: HelveticaNeue, 'Helvetica Neue',
Helvetica, Arial, 'Lucida Grande', sans-serif; font-size:
12pt;">
<div style="font-family: HelveticaNeue, 'Helvetica Neue',
Helvetica, Arial, 'Lucida Grande', sans-serif; font-size:
12pt;">
<div dir="ltr"> <font face="Arial" size="2"> On Tuesday,
August 12, 2014 9:41 PM, Vassil Vassilev
<a class="moz-txt-link-rfc2396E" href="mailto:vvasilev@cern.ch"><vvasilev@cern.ch></a> wrote:<br>
</font> </div>
<br>
<br>
<div class="y_msg_container">
<div id="yiv3575213784">
<div>
<div class="yiv3575213784moz-cite-prefix">On
12/08/14 21:18, Bogdan Tabacaru wrote:<br
clear="none">
</div>
<blockquote type="cite"> </blockquote>
</div>
<div>
<div style="color: rgb(0, 0, 0); font-family:
HelveticaNeue, 'Helvetica Neue', Helvetica, Arial,
'Lucida Grande', sans-serif; font-size: 12pt;
background-color: rgb(255, 255, 255);">
<div class="yiv3575213784" id="yiv3575213784"
style="">
<div class="yiv3575213784" style="">
<div class="yiv3575213784" style="color:
rgb(0, 0, 0); font-family: HelveticaNeue,
'Helvetica Neue', Helvetica, Arial, 'Lucida
Grande', sans-serif; font-size: 12pt;
background-color: rgb(255, 255, 255);">
<div class="yiv3575213784"
id="yiv3575213784yui_3_16_0_6_1407867329136_4"
style=""><span class="yiv3575213784"
id="yiv3575213784yui_3_16_0_6_1407867329136_13"
style="">Hi Vassil,</span></div>
<div class="yiv3575213784"
id="yiv3575213784yui_3_16_0_6_1407867329136_4"
style="color: rgb(0, 0, 0); font-size:
16px; font-family: HelveticaNeue,
'Helvetica Neue', Helvetica, Arial,
'Lucida Grande', sans-serif; font-style:
normal; background-color: transparent;"><span
class="yiv3575213784"
id="yiv3575213784yui_3_16_0_6_1407867329136_16"
style=""><br style="" clear="none">
</span></div>
<div class="yiv3575213784"
id="yiv3575213784yui_3_16_0_6_1407867329136_4"
style="color: rgb(0, 0, 0); font-size:
16px; font-family: HelveticaNeue,
'Helvetica Neue', Helvetica, Arial,
'Lucida Grande', sans-serif; font-style:
normal; background-color: transparent;"><span
class="yiv3575213784" style="">I really
wasn't expecting this to work, but I
tried it out anyway. Sadly, it still did
not change anything.</span></div>
<div class="yiv3575213784"
id="yiv3575213784yui_3_16_0_6_1407867329136_4"
style="color: rgb(0, 0, 0); font-size:
16px; font-family: HelveticaNeue,
'Helvetica Neue', Helvetica, Arial,
'Lucida Grande', sans-serif; font-style:
normal; background-color: transparent;"><span
class="yiv3575213784" style="">With or
without the Visitor, calling the
HandleTopLevelDecl instead of
HandleTranslationUnit did not give me
the desired effect.</span></div>
<div class="yiv3575213784"
id="yiv3575213784yui_3_16_0_6_1407867329136_4"
style="color: rgb(0, 0, 0); font-size:
16px; font-family: HelveticaNeue,
'Helvetica Neue', Helvetica, Arial,
'Lucida Grande', sans-serif; font-style:
normal; background-color: transparent;">From
my side I think the problem resides in how
the Rewriter affects the AST. I have the
strange feeling that it doesn't really do
anything to actually change the original
AST, but instead it just buffers the user
changes (as per the class' name). With
respect to that, I have not found a way it
(if possible) to pass the buffer to the
CodeGenerator AST Consumer. Is this at all
possible?</div>
</div>
</div>
</div>
</div>
I don't know. I haven't used the Rewriter in such
scenario. We transform the AST with regular Stmt or
Decl Visitors.
<div class="yiv3575213784yqt1479094748"
id="yiv3575213784yqtfd86574"><br clear="none">
Vassil<br clear="none">
<blockquote type="cite">
<div style="color: rgb(0, 0, 0); font-family:
HelveticaNeue, 'Helvetica Neue', Helvetica,
Arial, 'Lucida Grande', sans-serif; font-size:
12pt; background-color: rgb(255, 255, 255);">
<div class="yiv3575213784" id="yiv3575213784"
style="">
<div class="yiv3575213784" style="">
<div class="yiv3575213784" style="color:
rgb(0, 0, 0); font-family:
HelveticaNeue, 'Helvetica Neue',
Helvetica, Arial, 'Lucida Grande',
sans-serif; font-size: 12pt;
background-color: rgb(255, 255, 255);">
<div class="yiv3575213784"
id="yiv3575213784yui_3_16_0_6_1407867329136_4"
style="color: rgb(0, 0, 0); font-size:
16px; font-family: HelveticaNeue,
'Helvetica Neue', Helvetica, Arial,
'Lucida Grande', sans-serif;
font-style: normal; background-color:
transparent;"><br clear="none">
</div>
<div class="yiv3575213784"
id="yiv3575213784yui_3_16_0_6_1407867329136_4"
style="color: rgb(0, 0, 0); font-size:
16px; font-family: HelveticaNeue,
'Helvetica Neue', Helvetica, Arial,
'Lucida Grande', sans-serif;
font-style: normal; background-color:
transparent;">Cheers,</div>
<div class="yiv3575213784"
id="yiv3575213784yui_3_16_0_6_1407867329136_4"
style="color: rgb(0, 0, 0); font-size:
16px; font-family: HelveticaNeue,
'Helvetica Neue', Helvetica, Arial,
'Lucida Grande', sans-serif;
font-style: normal; background-color:
transparent;">Bogdan</div>
<div class="yiv3575213784"
id="yiv3575213784yqt28115" style="">
<div class="yiv3575213784"
id="yiv3575213784yui_3_16_0_6_1407867329136_7"
style="display:none;">
<div class="yiv3575213784"
style="font-family: HelveticaNeue,
'Helvetica Neue', Helvetica,
Arial, 'Lucida Grande',
sans-serif; font-size: 12pt;">
<div class="yiv3575213784"
style="font-family:
HelveticaNeue, 'Helvetica Neue',
Helvetica, Arial, 'Lucida
Grande', sans-serif; font-size:
12pt;">
<div class="yiv3575213784"
dir="ltr" style=""> <font
class="yiv3575213784"
style="" face="Arial"
size="2"> On Tuesday, August
12, 2014 7:19 PM, Vassil
Vassilev <a
moz-do-not-send="true"
rel="nofollow"
shape="rect"
class="yiv3575213784moz-txt-link-rfc2396E"
ymailto="mailto:vvasilev@cern.ch" target="_blank"
href="mailto:vvasilev@cern.ch"><vvasilev@cern.ch></a>
wrote:<br
class="yiv3575213784"
style="" clear="none">
</font> </div>
<br class="yiv3575213784"
style="" clear="none">
<br class="yiv3575213784"
style="" clear="none">
<div class="yiv3575213784"
style="">
<div class="yiv3575213784"
id="yiv3575213784" style="">
<div class="yiv3575213784"
style="">
<div class="yiv3575213784"
style="">Hi Bogdan,<br
class="yiv3575213784"
style="" clear="none">
It seems that your
visitor is called too
late, i.e on
HandleTranslationUnit.
You should override
HandleTopLevelDecl
instead.<br
class="yiv3575213784"
style="" clear="none">
Cheers,<br
class="yiv3575213784"
style="" clear="none">
Vassil<br
class="yiv3575213784"
style="" clear="none">
On 12/08/14 10:53,
Bogdan Tabacaru wrote:<br
class="yiv3575213784"
style="" clear="none">
</div>
<blockquote
class="yiv3575213784"
type="cite" style=""> </blockquote>
</div>
<div class="yiv3575213784"
id="yiv3575213784yqt48551"
style="">
<div class="yiv3575213784"
style="">
<div
class="yiv3575213784"
style="color: rgb(0,
0, 0); font-family:
HelveticaNeue,
'Helvetica Neue',
Helvetica, Arial,
'Lucida Grande',
sans-serif; font-size:
12pt;
background-color:
rgb(255, 255, 255);">
<div
class="yiv3575213784"
style=""><span
class="yiv3575213784"
style="">Hi
Vassil,</span></div>
<div
class="yiv3575213784"
style="color: rgb(0,
0, 0); font-size:
16px; font-family:
HelveticaNeue,
'Helvetica Neue',
Helvetica, Arial,
'Lucida Grande',
sans-serif;
font-style: normal;
background-color:
transparent;"><span
class="yiv3575213784" style=""><br class="yiv3575213784" style=""
clear="none">
</span></div>
<div
class="yiv3575213784"
style="color: rgb(0,
0, 0); font-size:
16px; font-family:
HelveticaNeue,
'Helvetica Neue',
Helvetica, Arial,
'Lucida Grande',
sans-serif;
font-style: normal;
background-color:
transparent;"><span
class="yiv3575213784" style="">I have attempted to debug the Rewriter
and CodeGenerator
myself and see
what happens when
compiling, but the
amount of code is
rather massive and
will take some
time.</span></div>
<div
class="yiv3575213784"
style="color: rgb(0,
0, 0); font-size:
16px; font-family:
HelveticaNeue,
'Helvetica Neue',
Helvetica, Arial,
'Lucida Grande',
sans-serif;
font-style: normal;
background-color:
transparent;"><span
class="yiv3575213784" style=""><br class="yiv3575213784" style=""
clear="none">
</span></div>
<div
class="yiv3575213784"
style="color: rgb(0,
0, 0); font-size:
16px; font-family:
HelveticaNeue,
'Helvetica Neue',
Helvetica, Arial,
'Lucida Grande',
sans-serif;
font-style: normal;
background-color:
transparent;">Here
is an running
simplified example
of what I am doing.
Would mind running
it and telling me
whether it worked
for you or not?</div>
<div
class="yiv3575213784"
style="color: rgb(0,
0, 0); font-size:
16px; font-family:
HelveticaNeue,
'Helvetica Neue',
Helvetica, Arial,
'Lucida Grande',
sans-serif;
font-style: normal;
background-color:
transparent;"><br
class="yiv3575213784"
style=""
clear="none">
</div>
<div
class="yiv3575213784"
style="color: rgb(0,
0, 0); font-size:
16px; font-family:
HelveticaNeue,
'Helvetica Neue',
Helvetica, Arial,
'Lucida Grande',
sans-serif;
font-style: normal;
background-color:
transparent;">Cheers,</div>
<div
class="yiv3575213784"
style="color: rgb(0,
0, 0); font-size:
16px; font-family:
HelveticaNeue,
'Helvetica Neue',
Helvetica, Arial,
'Lucida Grande',
sans-serif;
font-style: normal;
background-color:
transparent;">Bogdan</div>
<div
class="yiv3575213784"
style=""><br
class="yiv3575213784"
style=""
clear="none">
<br
class="yiv3575213784"
style=""
clear="none">
</div>
<div
class="yiv3575213784"
style="display:block;">
<div
class="yiv3575213784"
style="font-family:
HelveticaNeue,
'Helvetica Neue',
Helvetica, Arial,
'Lucida Grande',
sans-serif;
font-size: 12pt;">
<div
class="yiv3575213784"
style="font-family:
HelveticaNeue,
'Helvetica
Neue',
Helvetica,
Arial, 'Lucida
Grande',
sans-serif;
font-size:
12pt;">
<div
class="yiv3575213784"
dir="ltr"
style=""> <font
class="yiv3575213784" style="" face="Arial" size="2"> On Monday, August
11, 2014 11:18
AM, Bogdan
Tabacaru <a
moz-do-not-send="true"
rel="nofollow"
shape="rect"
class="yiv3575213784"
ymailto="mailto:bogdan.tabacaru88@yahoo.com" target="_blank"
href="mailto:bogdan.tabacaru88@yahoo.com"
style=""><bogdan.tabacaru88@yahoo.com></a>
wrote:<br
class="yiv3575213784"
style=""
clear="none">
</font> </div>
<br
class="yiv3575213784"
style=""
clear="none">
<br
class="yiv3575213784"
style=""
clear="none">
<div
class="yiv3575213784"
style="">
<div
class="yiv3575213784"
id="yiv3575213784" style="">
<div
class="yiv3575213784"
style="">
<div
class="yiv3575213784"
style="color:
rgb(0, 0, 0);
font-family:
HelveticaNeue,
'Helvetica
Neue',
Helvetica,
Arial, 'Lucida
Grande',
sans-serif;
font-size:
12pt;
background-color:
rgb(255, 255,
255);">
<div
class="yiv3575213784"
style=""><span
class="yiv3575213784" style="">That is a good question.</span></div>
<div
class="yiv3575213784"
style="color:
rgb(0, 0, 0);
font-size:
16px;
font-family:
HelveticaNeue,
'Helvetica
Neue',
Helvetica,
Arial, 'Lucida
Grande',
sans-serif;
font-style:
normal;
background-color:
transparent;"><span
class="yiv3575213784" style=""><br class="yiv3575213784" style=""
clear="none">
</span></div>
<div
class="yiv3575213784"
style="color:
rgb(0, 0, 0);
font-size:
16px;
font-family:
HelveticaNeue,
'Helvetica
Neue',
Helvetica,
Arial, 'Lucida
Grande',
sans-serif;
font-style:
normal;
background-color:
transparent;"><span
class="yiv3575213784" style="">I have written a libTool with the same
visitor and
consumer.</span></div>
<div
class="yiv3575213784"
style="color:
rgb(0, 0, 0);
font-size:
16px;
font-family:
HelveticaNeue,
'Helvetica
Neue',
Helvetica,
Arial, 'Lucida
Grande',
sans-serif;
font-style:
normal;
background-color:
transparent;"><span
class="yiv3575213784" style="">I called my_Rewriter.ReplaceText() to
make my
AST-transformations.</span></div>
<div
class="yiv3575213784"
style="color:
rgb(0, 0, 0);
font-size:
16px;
font-family:
HelveticaNeue,
'Helvetica
Neue',
Helvetica,
Arial, 'Lucida
Grande',
sans-serif;
font-style:
normal;
background-color:
transparent;"><span
class="yiv3575213784" style="">I have output the RewriteBuffer to a new
file and then
I compiled it.</span></div>
<div
class="yiv3575213784"
style="color:
rgb(0, 0, 0);
font-size:
16px;
font-family:
HelveticaNeue,
'Helvetica
Neue',
Helvetica,
Arial, 'Lucida
Grande',
sans-serif;
font-style:
normal;
background-color:
transparent;">When
I run the
transformed
source, it
gives me the
expected
behavior.
However, this
requires me to
explicitly
create a new
file with the
changes.</div>
<div
class="yiv3575213784"
style="color:
rgb(0, 0, 0);
font-size:
16px;
font-family:
HelveticaNeue,
'Helvetica
Neue',
Helvetica,
Arial, 'Lucida
Grande',
sans-serif;
font-style:
normal;
background-color:
transparent;"><br
class="yiv3575213784" style="" clear="none">
</div>
<div
class="yiv3575213784"
style="color:
rgb(0, 0, 0);
font-size:
16px;
font-family:
HelveticaNeue,
'Helvetica
Neue',
Helvetica,
Arial, 'Lucida
Grande',
sans-serif;
font-style:
normal;
background-color:
transparent;">If
I do the same
thing with the
PluginASTAction
(with or
without
re-ordering
the
Consumers), I
only get the
behavior from
the original
source file.</div>
<div
class="yiv3575213784"
style="color:
rgb(0, 0, 0);
font-size:
16px;
font-family:
HelveticaNeue,
'Helvetica
Neue',
Helvetica,
Arial, 'Lucida
Grande',
sans-serif;
font-style:
normal;
background-color:
transparent;"><br
class="yiv3575213784" style="" clear="none">
</div>
<div
class="yiv3575213784"
style=""><br
class="yiv3575213784"
style=""
clear="none">
<br
class="yiv3575213784"
style=""
clear="none">
</div>
<div
class="yiv3575213784"
id="yiv3575213784yqt97309" style="">
<div
class="yiv3575213784"
style="display:block;">
<div
class="yiv3575213784"
style="font-family:
HelveticaNeue,
'Helvetica
Neue',
Helvetica,
Arial, 'Lucida
Grande',
sans-serif;
font-size:
12pt;">
<div
class="yiv3575213784"
style="font-family:
HelveticaNeue,
'Helvetica
Neue',
Helvetica,
Arial, 'Lucida
Grande',
sans-serif;
font-size:
12pt;">
<div
class="yiv3575213784"
dir="ltr"
style=""> <font
class="yiv3575213784" style="" face="Arial" size="2"> On Monday, August
11, 2014 9:59
AM, Vassil
Vassilev <a
moz-do-not-send="true"
rel="nofollow"
shape="rect"
class="yiv3575213784"
ymailto="mailto:vasil.georgiev.vasilev@cern.ch" target="_blank"
href="mailto:vasil.georgiev.vasilev@cern.ch"
style=""><vasil.georgiev.vasilev@cern.ch></a>
wrote:<br
class="yiv3575213784"
style=""
clear="none">
</font> </div>
<br
class="yiv3575213784"
style=""
clear="none">
<br
class="yiv3575213784"
style=""
clear="none">
<div
class="yiv3575213784"
style="">
<div
class="yiv3575213784"
id="yiv3575213784" style="">
<div
class="yiv3575213784"
style="">
<div
class="yiv3575213784"
style="">On
08/10/2014
11:02 AM,
Bogdan
Tabacaru
wrote:<br
class="yiv3575213784"
style=""
clear="none">
</div>
<blockquote
class="yiv3575213784"
type="cite"
style=""> </blockquote>
</div>
<div
class="yiv3575213784"
style="">
<div
class="yiv3575213784"
style="color:
rgb(0, 0, 0);
font-family:
HelveticaNeue,
'Helvetica
Neue',
Helvetica,
Arial, 'Lucida
Grande',
sans-serif;
font-size:
12pt;
background-color:
rgb(255, 255,
255);">
<div
class="yiv3575213784"
style=""><span
class="yiv3575213784" style="">Hi Vassil,</span></div>
<div
class="yiv3575213784"
style="color:
rgb(0, 0, 0);
font-size:
16px;
font-family:
HelveticaNeue,
'Helvetica
Neue',
Helvetica,
Arial, 'Lucida
Grande',
sans-serif;
font-style:
normal;
background-color:
transparent;"><span
class="yiv3575213784" style=""><br class="yiv3575213784" style=""
clear="none">
</span></div>
<div
class="yiv3575213784"
style="color:
rgb(0, 0, 0);
font-size:
16px;
font-family:
HelveticaNeue,
'Helvetica
Neue',
Helvetica,
Arial, 'Lucida
Grande',
sans-serif;
font-style:
normal;
background-color:
transparent;">thanks
for the
example and
the patch!</div>
<div
class="yiv3575213784"
style="color:
rgb(0, 0, 0);
font-size:
16px;
font-family:
HelveticaNeue,
'Helvetica
Neue',
Helvetica,
Arial, 'Lucida
Grande',
sans-serif;
font-style:
normal;
background-color:
transparent;"><br
class="yiv3575213784" style="" clear="none">
</div>
<div
class="yiv3575213784"
style="color:
rgb(0, 0, 0);
font-size:
16px;
font-family:
HelveticaNeue,
'Helvetica
Neue',
Helvetica,
Arial, 'Lucida
Grande',
sans-serif;
font-style:
normal;
background-color:
transparent;">I
have applied
both of them
successfully,
but somehow,
re-ordering
the consumers
still did not
give me the
expected
results. This
means, when I
call the
plugin it
executes
correctly, but
CodeGen still
only uses the
original file
(without the
changes made
by the
plugin).</div>
<div
class="yiv3575213784"
style="color:
rgb(0, 0, 0);
font-size:
16px;
font-family:
HelveticaNeue,
'Helvetica
Neue',
Helvetica,
Arial, 'Lucida
Grande',
sans-serif;
font-style:
normal;
background-color:
transparent;"><br
class="yiv3575213784" style="" clear="none">
</div>
<div
class="yiv3575213784"
style="color:
rgb(0, 0, 0);
font-size:
16px;
font-family:
HelveticaNeue,
'Helvetica
Neue',
Helvetica,
Arial, 'Lucida
Grande',
sans-serif;
font-style:
normal;
background-color:
transparent;">Is
there another
step which I
may have
forgotten?</div>
<div
class="yiv3575213784"
style="color:
rgb(0, 0, 0);
font-size:
16px;
font-family:
HelveticaNeue,
'Helvetica
Neue',
Helvetica,
Arial, 'Lucida
Grande',
sans-serif;
font-style:
normal;
background-color:
transparent;"><br
class="yiv3575213784" style="" clear="none">
</div>
</div>
If you
reorder the
consumers in
the
initialization,
it should
work. Are you
sure you have
the right
tests to check
for the
desired
behaviour? I.e
are you sure
you are making
a valid
AST-transformation?
<div
class="yiv3575213784"
id="yiv3575213784yqtfd61983" style=""><br class="yiv3575213784" style=""
clear="none">
Vassil<br
class="yiv3575213784"
style=""
clear="none">
<blockquote
class="yiv3575213784"
type="cite"
style="">
<div
class="yiv3575213784"
style="color:
rgb(0, 0, 0);
font-family:
HelveticaNeue,
'Helvetica
Neue',
Helvetica,
Arial, 'Lucida
Grande',
sans-serif;
font-size:
12pt;
background-color:
rgb(255, 255,
255);">
<div
class="yiv3575213784"
style="color:
rgb(0, 0, 0);
font-size:
16px;
font-family:
HelveticaNeue,
'Helvetica
Neue',
Helvetica,
Arial, 'Lucida
Grande',
sans-serif;
font-style:
normal;
background-color:
transparent;">Cheers,</div>
<div
class="yiv3575213784"
style="color:
rgb(0, 0, 0);
font-size:
16px;
font-family:
HelveticaNeue,
'Helvetica
Neue',
Helvetica,
Arial, 'Lucida
Grande',
sans-serif;
font-style:
normal;
background-color:
transparent;">Bogdan</div>
<div
class="yiv3575213784"
style=""><br
class="yiv3575213784"
style=""
clear="none">
<br
class="yiv3575213784"
style=""
clear="none">
</div>
<div
class="yiv3575213784"
style="display:block;">
<div
class="yiv3575213784"
style="font-family:
HelveticaNeue,
'Helvetica
Neue',
Helvetica,
Arial, 'Lucida
Grande',
sans-serif;
font-size:
12pt;">
<div
class="yiv3575213784"
style="font-family:
HelveticaNeue,
'Helvetica
Neue',
Helvetica,
Arial, 'Lucida
Grande',
sans-serif;
font-size:
12pt;">
<div
class="yiv3575213784"
dir="ltr"
style=""> <font
class="yiv3575213784" style="" face="Arial" size="2"> On Sunday, August
10, 2014 12:22
AM, Vassil
Vassilev <a
moz-do-not-send="true"
rel="nofollow"
shape="rect"
class="yiv3575213784"
ymailto="mailto:vvasilev@cern.ch" target="_blank"
href="mailto:vvasilev@cern.ch"
style=""><vvasilev@cern.ch></a>
wrote:<br
class="yiv3575213784"
style=""
clear="none">
</font> </div>
<br
class="yiv3575213784"
style=""
clear="none">
<br
class="yiv3575213784"
style=""
clear="none">
<div
class="yiv3575213784"
style="">
<div
class="yiv3575213784"
id="yiv3575213784" style="">
<div
class="yiv3575213784"
style="">
<div
class="yiv3575213784"
style="">Hi
Bogdan,<br
class="yiv3575213784"
style=""
clear="none">
After
applying the
attached
patch, I can
do:<br
class="yiv3575213784"
style=""
clear="none">
<br
class="yiv3575213784"
style=""
clear="none">
void
MyPlugin::Initialize(ASTContext&
Context) {<br
class="yiv3575213784" style="" clear="none">
</div>
</div>
<div
class="yiv3575213784"
style=""> //
We need to
reorder the
consumers in
the
MultiplexConsumer.<br
class="yiv3575213784" style="" clear="none">
MultiplexConsumer&
multiplex<br
class="yiv3575213784"
style=""
clear="none">
=
static_cast<MultiplexConsumer&>(m_CI.getASTConsumer());<br
class="yiv3575213784" style="" clear="none">
std::vector<ASTConsumer*>&
consumers =
multiplex.getConsumers();<br
class="yiv3575213784" style="" clear="none">
ASTConsumer*
lastConsumer =
consumers.back();<br class="yiv3575213784" style="" clear="none">
consumers.pop_back();<br class="yiv3575213784" style="" clear="none">
consumers.insert(consumers.begin(),
lastConsumer);<br
class="yiv3575213784" style="" clear="none">
}<br
class="yiv3575213784"
style=""
clear="none">
<br
class="yiv3575213784"
style=""
clear="none">
This allows me
to hook
MyPlugin
before clang's
codegen.<br
class="yiv3575213784"
style=""
clear="none">
<br
class="yiv3575213784"
style=""
clear="none">
Vassil<br
class="yiv3575213784"
style=""
clear="none">
On 09/08/14
21:24, Bogdan
Tabacaru
wrote:<br
class="yiv3575213784"
style=""
clear="none">
<blockquote
class="yiv3575213784"
type="cite"
style=""> </blockquote>
</div>
<div
class="yiv3575213784"
id="yiv3575213784yqt71669" style="">
<div
class="yiv3575213784"
style="">
<div
class="yiv3575213784"
style="color:
rgb(0, 0, 0);
font-family:
HelveticaNeue,
'Helvetica
Neue',
Helvetica,
Arial, 'Lucida
Grande',
sans-serif;
font-size:
12pt;
background-color:
rgb(255, 255,
255);">
<div
class="yiv3575213784"
style=""><span
class="yiv3575213784" style="">Hi Vassil,</span></div>
<div
class="yiv3575213784"
style="color:
rgb(0, 0, 0);
font-size:
16px;
font-family:
HelveticaNeue,
'Helvetica
Neue',
Helvetica,
Arial, 'Lucida
Grande',
sans-serif;
font-style:
normal;
background-color:
transparent;"><span
class="yiv3575213784" style=""><br class="yiv3575213784" style=""
clear="none">
</span></div>
<div
class="yiv3575213784"
style="color:
rgb(0, 0, 0);
font-size:
16px;
font-family:
HelveticaNeue,
'Helvetica
Neue',
Helvetica,
Arial, 'Lucida
Grande',
sans-serif;
font-style:
normal;
background-color:
transparent;"><span
class="yiv3575213784" style="">Is the patch available for the 3.4.2
version of
LLVM or must I
migrate to the
"current"
version ?</span></div>
<div
class="yiv3575213784"
style="color:
rgb(0, 0, 0);
font-size:
16px;
font-family:
HelveticaNeue,
'Helvetica
Neue',
Helvetica,
Arial, 'Lucida
Grande',
sans-serif;
font-style:
normal;
background-color:
transparent;"><span
class="yiv3575213784" style=""><br class="yiv3575213784" style=""
clear="none">
</span></div>
<div
class="yiv3575213784"
style="color:
rgb(0, 0, 0);
font-size:
16px;
font-family:
HelveticaNeue,
'Helvetica
Neue',
Helvetica,
Arial, 'Lucida
Grande',
sans-serif;
font-style:
normal;
background-color:
transparent;"><span
class="yiv3575213784" style="">Cheers,</span></div>
<div
class="yiv3575213784"
style="color:
rgb(0, 0, 0);
font-size:
16px;
font-family:
HelveticaNeue,
'Helvetica
Neue',
Helvetica,
Arial, 'Lucida
Grande',
sans-serif;
font-style:
normal;
background-color:
transparent;"><span
class="yiv3575213784" style="">Bogdan</span></div>
<div
class="yiv3575213784"
style=""><br
class="yiv3575213784"
style=""
clear="none">
<br
class="yiv3575213784"
style=""
clear="none">
</div>
<div
class="yiv3575213784"
style="display:block;">
<div
class="yiv3575213784"
style="font-family:
HelveticaNeue,
'Helvetica
Neue',
Helvetica,
Arial, 'Lucida
Grande',
sans-serif;
font-size:
12pt;">
<div
class="yiv3575213784"
style="font-family:
HelveticaNeue,
'Helvetica
Neue',
Helvetica,
Arial, 'Lucida
Grande',
sans-serif;
font-size:
12pt;">
<div
class="yiv3575213784"
dir="ltr"
style=""> <font
class="yiv3575213784" style="" face="Arial" size="2"> On Friday, August
8, 2014 6:16
PM, Vassil
Vassilev <a
moz-do-not-send="true"
rel="nofollow"
shape="rect"
class="yiv3575213784"
ymailto="mailto:vvasilev@cern.ch" target="_blank"
href="mailto:vvasilev@cern.ch"
style=""><vvasilev@cern.ch></a>
wrote:<br
class="yiv3575213784"
style=""
clear="none">
</font> </div>
<br
class="yiv3575213784"
style=""
clear="none">
<br
class="yiv3575213784"
style=""
clear="none">
<div
class="yiv3575213784"
style="">
<div
class="yiv3575213784"
id="yiv3575213784" style="">
<div
class="yiv3575213784"
style="">
<div
class="yiv3575213784"
style="">Hi,<br
class="yiv3575213784" style="" clear="none">
There is a
pending patch
on cfe-commits
about this
"[PATCH]
clang/Frontend/MultiplexConsumer.h".
With it you
could reorder
the
ASTConsumers
in clang and
get yours
before
codegen.<br
class="yiv3575213784"
style=""
clear="none">
Vassil<br
class="yiv3575213784"
style=""
clear="none">
On 08/08/14
16:48, Bogdan
Tabacaru
wrote:<br
class="yiv3575213784"
style=""
clear="none">
</div>
<blockquote
class="yiv3575213784"
type="cite"
style=""> </blockquote>
</div>
<div
class="yiv3575213784"
style="">
<div
class="yiv3575213784"
id="yiv3575213784yqt84664" style="">
<div
class="yiv3575213784"
style="color:
rgb(0, 0, 0);
font-family:
HelveticaNeue,
'Helvetica
Neue',
Helvetica,
Arial, 'Lucida
Grande',
sans-serif;
font-size:
12pt;
background-color:
rgb(255, 255,
255);">
<div
class="yiv3575213784"
style="">Hi
everyone,</div>
<div
class="yiv3575213784"
style=""><br
class="yiv3575213784"
style=""
clear="none">
</div>
<div
class="yiv3575213784"
style="color:
rgb(0, 0, 0);
font-size:
16px;
font-family:
HelveticaNeue,
'Helvetica
Neue',
Helvetica,
Arial, 'Lucida
Grande',
sans-serif;
font-style:
normal;
background-color:
transparent;">I
want to create
a plugin that
makes some
changes on the
parsed AST and
that directly
compiles the
changes made
on the AST. It
is important
that I do not
generate a new
file with the
changes on the
AST.</div>
<div
class="yiv3575213784"
style="color:
rgb(0, 0, 0);
font-size:
16px;
font-family:
HelveticaNeue,
'Helvetica
Neue',
Helvetica,
Arial, 'Lucida
Grande',
sans-serif;
font-style:
normal;
background-color:
transparent;">So,
in other
words, I want
to change the
AST in place,
and then
compile it in
the same run,
using a Clang
Plugin.</div>
<div
class="yiv3575213784"
style="color:
rgb(0, 0, 0);
font-size:
16px;
font-family:
HelveticaNeue,
'Helvetica
Neue',
Helvetica,
Arial, 'Lucida
Grande',
sans-serif;
font-style:
normal;
background-color:
transparent;"><br
class="yiv3575213784" style="" clear="none">
</div>
<div
class="yiv3575213784"
style="color:
rgb(0, 0, 0);
font-size:
16px;
font-family:
HelveticaNeue,
'Helvetica
Neue',
Helvetica,
Arial, 'Lucida
Grande',
sans-serif;
font-style:
normal;
background-color:
transparent;">I
am using llvm
3.4.2.</div>
<div
class="yiv3575213784"
style="color:
rgb(0, 0, 0);
font-size:
16px;
font-family:
HelveticaNeue,
'Helvetica
Neue',
Helvetica,
Arial, 'Lucida
Grande',
sans-serif;
font-style:
normal;
background-color:
transparent;"><br
class="yiv3575213784" style="" clear="none">
</div>
<div
class="yiv3575213784"
style="color:
rgb(0, 0, 0);
font-size:
16px;
font-family:
HelveticaNeue,
'Helvetica
Neue',
Helvetica,
Arial, 'Lucida
Grande',
sans-serif;
font-style:
normal;
background-color:
transparent;"><span
class="yiv3575213784" style="font-size:12pt;">By following the
RecursiveASTVisitor
example, </span>I
have written a
clang plugin
which modifies
the parsed
AST.</div>
<div
class="yiv3575213784"
style="color:
rgb(0, 0, 0);
font-size:
16px;
font-family:
HelveticaNeue,
'Helvetica
Neue',
Helvetica,
Arial, 'Lucida
Grande',
sans-serif;
font-style:
normal;
background-color:
transparent;"><br
class="yiv3575213784" style="" clear="none">
</div>
<div
class="yiv3575213784"
style="color:
rgb(0, 0, 0);
font-size:
16px;
font-family:
HelveticaNeue,
'Helvetica
Neue',
Helvetica,
Arial, 'Lucida
Grande',
sans-serif;
font-style:
normal;
background-color:
transparent;">I
am using the
Rewriter class
to ReplaceText
inside the
buffer.</div>
<div
class="yiv3575213784"
style="color:
rgb(0, 0, 0);
font-size:
16px;
font-family:
HelveticaNeue,
'Helvetica
Neue',
Helvetica,
Arial, 'Lucida
Grande',
sans-serif;
font-style:
normal;
background-color:
transparent;"><br
class="yiv3575213784" style="" clear="none">
</div>
<div
class="yiv3575213784"
style="color:
rgb(0, 0, 0);
font-size:
16px;
font-family:
HelveticaNeue,
'Helvetica
Neue',
Helvetica,
Arial, 'Lucida
Grande',
sans-serif;
font-style:
normal;
background-color:
transparent;">I
am also using
the
-add-plugin <span
class="yiv3575213784" style="font-size:12pt;">command</span><span
class="yiv3575213784"
style="font-size:12pt;"> </span><span class="yiv3575213784"
style="background-color:transparent;">(instead
the "standard"
-plugin
command) when
calling the
plugin.</span></div>
<div
class="yiv3575213784"
style="color:
rgb(0, 0, 0);
font-size:
16px;
font-family:
HelveticaNeue,
'Helvetica
Neue',
Helvetica,
Arial, 'Lucida
Grande',
sans-serif;
font-style:
normal;
background-color:
transparent;"><span
class="yiv3575213784" style="background-color:transparent;"><br
class="yiv3575213784"
style=""
clear="none">
</span></div>
<div
class="yiv3575213784"
style="color:
rgb(0, 0, 0);
font-size:
16px;
font-family:
HelveticaNeue,
'Helvetica
Neue',
Helvetica,
Arial, 'Lucida
Grande',
sans-serif;
font-style:
normal;
background-color:
transparent;"><span
class="yiv3575213784" style="background-color:transparent;">The
rewriting part
works
excellently.
However, when
I continue the
compilation,
clang only
compiles the
original file,
instead of the
original file
+ changes.</span></div>
<div
class="yiv3575213784"
style="color:
rgb(0, 0, 0);
font-size:
16px;
font-family:
HelveticaNeue,
'Helvetica
Neue',
Helvetica,
Arial, 'Lucida
Grande',
sans-serif;
font-style:
normal;
background-color:
transparent;"><span
class="yiv3575213784" style="background-color:transparent;">Is there a
way to tell
clang/llvm to
compile what I
have written
in the AST
(using the
Rewriter)
without
creating an
intermediate
file?</span></div>
<div
class="yiv3575213784"
style="color:
rgb(0, 0, 0);
font-size:
16px;
font-family:
HelveticaNeue,
'Helvetica
Neue',
Helvetica,
Arial, 'Lucida
Grande',
sans-serif;
font-style:
normal;
background-color:
transparent;"><span
class="yiv3575213784" style="background-color:transparent;"><br
class="yiv3575213784"
style=""
clear="none">
</span></div>
<div
class="yiv3575213784"
style="color:
rgb(0, 0, 0);
font-size:
16px;
font-family:
HelveticaNeue,
'Helvetica
Neue',
Helvetica,
Arial, 'Lucida
Grande',
sans-serif;
font-style:
normal;
background-color:
transparent;"><span
class="yiv3575213784" style="background-color:transparent;">Thanks a lot
for your help,</span></div>
<div
class="yiv3575213784"
style="color:
rgb(0, 0, 0);
font-size:
16px;
font-family:
HelveticaNeue,
'Helvetica
Neue',
Helvetica,
Arial, 'Lucida
Grande',
sans-serif;
font-style:
normal;
background-color:
transparent;"><span
class="yiv3575213784" style="background-color:transparent;">Bogdan</span></div>
<div
class="yiv3575213784"
style="color:
rgb(0, 0, 0);
font-size:
16px;
font-family:
HelveticaNeue,
'Helvetica
Neue',
Helvetica,
Arial, 'Lucida
Grande',
sans-serif;
font-style:
normal;
background-color:
transparent;"><br
class="yiv3575213784" style="" clear="none">
</div>
<div
class="yiv3575213784"
style="color:
rgb(0, 0, 0);
font-size:
16px;
font-family:
HelveticaNeue,
'Helvetica
Neue',
Helvetica,
Arial, 'Lucida
Grande',
sans-serif;
font-style:
normal;
background-color:
transparent;"><br
class="yiv3575213784" style="" clear="none">
</div>
</div>
</div>
<br
class="yiv3575213784"
style=""
clear="none">
<fieldset
class="yiv3575213784"
style=""></fieldset>
<br
class="yiv3575213784"
style=""
clear="none">
<pre class="yiv3575213784" style="">_______________________________________________
cfe-dev mailing list
<a moz-do-not-send="true" rel="nofollow" shape="rect" class="yiv3575213784" ymailto="mailto:cfe-dev@cs.uiuc.edu" target="_blank" href="mailto:cfe-dev@cs.uiuc.edu" style="">cfe-dev@cs.uiuc.edu</a>
<a moz-do-not-send="true" rel="nofollow" shape="rect" class="yiv3575213784" target="_blank" href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" style="">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a>
</pre>
<br
class="yiv3575213784"
style=""
clear="none">
</div>
</div>
<br
class="yiv3575213784"
style=""
clear="none">
<br
class="yiv3575213784"
style=""
clear="none">
</div>
</div>
</div>
</div>
</div>
<br
class="yiv3575213784"
style=""
clear="none">
</div>
</div>
</div>
<br
class="yiv3575213784"
style=""
clear="none">
<br
class="yiv3575213784"
style=""
clear="none">
</div>
</div>
</div>
</div>
</div>
</blockquote>
<br
class="yiv3575213784"
style=""
clear="none">
</div>
</div>
</div>
<br
class="yiv3575213784"
style=""
clear="none">
<br
class="yiv3575213784"
style=""
clear="none">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br
class="yiv3575213784"
style=""
clear="none">
<br
class="yiv3575213784"
style=""
clear="none">
</div>
</div>
</div>
</div>
</div>
<br
class="yiv3575213784"
style="" clear="none">
</div>
</div>
</div>
<br class="yiv3575213784"
style="" clear="none">
<br class="yiv3575213784"
style="" clear="none">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<br clear="none">
</div>
</div>
</div>
<br>
<br>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<br>
</body>
</html>