<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:12pt"><div id="yiv7895624452"><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 id="yiv7895624452yui_3_16_0_9_1407867329136_8"><span id="yiv7895624452yui_3_16_0_9_1407867329136_14">Thank you Vassil,</span></div><div id="yiv7895624452yui_3_16_0_9_1407867329136_8" 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 id="yiv7895624452yui_3_16_0_9_1407867329136_17"><br clear="none"></span></div><div id="yiv7895624452yui_3_16_0_9_1407867329136_8" 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;">It is a very nice tool. Sadly, it differs slightly from my requirements, as you do not use the Rewriter at all.</div><div id="yiv7895624452yui_3_16_0_9_1407867329136_8" 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 been reading through your code and I noticed you you are Creating Declarations and adding them to the Decl Context.</div><div id="yiv7895624452yui_3_16_0_9_1407867329136_8" 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;" class="yui_3_16_0_1_1407922330074_17326"><br></div><div id="yiv7895624452yui_3_16_0_9_1407867329136_8" 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;" class="yui_3_16_0_1_1407922330074_17326">I tried the same thing, and although I could successfully call Declaration->dump() an observe the changes, the resulting executable was still unaffected.</div><div id="yiv7895624452yui_3_16_0_9_1407867329136_8" 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;" class="yui_3_16_0_1_1407922330074_17326"><br></div><div id="yiv7895624452yui_3_16_0_9_1407867329136_8" 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;" class="yui_3_16_0_1_1407922330074_17326">I also called Declaration->setDeclName() and
directly overrode all members in a class. This should have at least given an error during initialization, but no, everything still compiled with the original code.</div><div id="yiv7895624452yui_3_16_0_9_1407867329136_8" 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;" class="yui_3_16_0_1_1407922330074_17326"><br></div><div id="yiv7895624452yui_3_16_0_9_1407867329136_8" 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;" class="yui_3_16_0_1_1407922330074_17326">I think I am running out of options. :(</div><div id="yiv7895624452yui_3_16_0_9_1407867329136_8" 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;" class="yui_3_16_0_1_1407922330074_17326">Any suggestions?</div> <div class="qtdSeparateBR"><br><br></div><div class="yiv7895624452yqt9101742919" id="yiv7895624452yqt14513"><div class="yiv7895624452yahoo_quoted" id="yiv7895624452yui_3_16_0_9_1407867329136_11" style="display: block;"> <div class="yiv7895624452yui_3_16_0_1_1407867329136_32692" style="font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12pt;"> <div class="yiv7895624452yui_3_16_0_1_1407867329136_32693" style="font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12pt;"> <div dir="ltr"> <font size="2" face="Arial"> On Tuesday, August 12, 2014 10:11 PM, Vassil Vassilev <vvasilev@cern.ch> wrote:<br clear="none"> </font> </div> <br clear="none"><br clear="none"> <div class="yiv7895624452y_msg_container"><div id="yiv7895624452">
<div>
<div class="yiv7895624452moz-cite-prefix">On 12/08/14 21:47, Bogdan Tabacaru
wrote:<br clear="none">
</div>
<blockquote type="cite">
<div class="yiv7895624452yui_3_16_0_1_1407867329136_32695" 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><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 clear="none">
</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 rel="nofollow" shape="rect" class="yiv7895624452moz-txt-link-freetext" target="_blank" href="https://github.com/vgvassilev/clad/tree/master/tools">https://github.com/vgvassilev/clad/tree/master/tools</a><br clear="none">
<br clear="none">
I hope it helps.<br clear="none">
Vassil<br clear="none">
<blockquote type="cite">
<div class="yiv7895624452yui_3_16_0_1_1407867329136_32699" 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 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 clear="none">
</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="yiv7895624452qtdSeparateBR"><br clear="none">
<br clear="none">
</div>
<div class="yiv7895624452yahoo_quoted" style="display:block;">
<div class="yiv7895624452yui_3_16_0_1_1407867329136_32703" style="font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12pt;">
<div class="yiv7895624452yui_3_16_0_1_1407867329136_32704" 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 rel="nofollow" shape="rect" class="yiv7895624452moz-txt-link-rfc2396E" ymailto="mailto:vvasilev@cern.ch" target="_blank" href="mailto:vvasilev@cern.ch"><vvasilev@cern.ch></a> wrote:<br clear="none">
</font> </div>
<br clear="none">
<br clear="none">
<div class="yiv7895624452y_msg_container">
<div id="yiv7895624452">
<div>
<div class="yiv7895624452moz-cite-prefix">On
12/08/14 21:18, Bogdan Tabacaru wrote:<br clear="none">
</div>
<blockquote type="cite"> </blockquote>
</div>
<div>
<div class="yiv7895624452yui_3_16_0_1_1407867329136_32706" 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="yiv7895624452" id="yiv7895624452" style="">
<div class="yiv7895624452" style="">
<div class="yiv7895624452" 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="yiv7895624452" id="yiv7895624452yui_3_16_0_6_1407867329136_4" style=""><span class="yiv7895624452" id="yiv7895624452yui_3_16_0_6_1407867329136_13" style="">Hi Vassil,</span></div>
<div class="yiv7895624452 yiv7895624452yui_3_16_0_1_1407867329136_32712" id="yiv7895624452yui_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="yiv7895624452" id="yiv7895624452yui_3_16_0_6_1407867329136_16" style=""><br clear="none" style="">
</span></div>
<div class="yiv7895624452 yiv7895624452yui_3_16_0_1_1407867329136_32715" id="yiv7895624452yui_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="yiv7895624452" 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="yiv7895624452 yiv7895624452yui_3_16_0_1_1407867329136_32717" id="yiv7895624452yui_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="yiv7895624452" style="">With or
without the Visitor, calling the
HandleTopLevelDecl instead of
HandleTranslationUnit did not give me
the desired effect.</span></div>
<div class="yiv7895624452 yiv7895624452yui_3_16_0_1_1407867329136_32719" id="yiv7895624452yui_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="yiv7895624452yqt1479094748" id="yiv7895624452yqtfd86574"><br clear="none">
Vassil<br clear="none">
<blockquote type="cite">
<div class="yiv7895624452yui_3_16_0_1_1407867329136_32720" 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="yiv7895624452" id="yiv7895624452" style="">
<div class="yiv7895624452" style="">
<div class="yiv7895624452 yiv7895624452yui_3_16_0_1_1407867329136_32723" 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="yiv7895624452 yiv7895624452yui_3_16_0_1_1407867329136_32724" id="yiv7895624452yui_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="yiv7895624452 yiv7895624452yui_3_16_0_1_1407867329136_32725" id="yiv7895624452yui_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="yiv7895624452 yiv7895624452yui_3_16_0_1_1407867329136_32726" id="yiv7895624452yui_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="yiv7895624452" id="yiv7895624452yqt28115" style="">
<div class="yiv7895624452" id="yiv7895624452yui_3_16_0_6_1407867329136_7" style="display:none;">
<div class="yiv7895624452 yiv7895624452yui_3_16_0_1_1407867329136_32729" style="font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12pt;">
<div class="yiv7895624452" style="font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12pt;">
<div class="yiv7895624452" dir="ltr" style=""> <font class="yiv7895624452" style="" face="Arial" size="2"> On Tuesday, August
12, 2014 7:19 PM, Vassil
Vassilev <a rel="nofollow" shape="rect" class="yiv7895624452moz-txt-link-rfc2396E" ymailto="mailto:vvasilev@cern.ch" target="_blank" href="mailto:vvasilev@cern.ch"><vvasilev@cern.ch></a>
wrote:<br clear="none" class="yiv7895624452" style="">
</font> </div>
<br clear="none" class="yiv7895624452" style="">
<br clear="none" class="yiv7895624452" style="">
<div class="yiv7895624452" style="">
<div class="yiv7895624452" id="yiv7895624452" style="">
<div class="yiv7895624452" style="">
<div class="yiv7895624452" style="">Hi Bogdan,<br clear="none" class="yiv7895624452" style="">
It seems that your
visitor is called too
late, i.e on
HandleTranslationUnit.
You should override
HandleTopLevelDecl
instead.<br clear="none" class="yiv7895624452" style="">
Cheers,<br clear="none" class="yiv7895624452" style="">
Vassil<br clear="none" class="yiv7895624452" style="">
On 12/08/14 10:53,
Bogdan Tabacaru wrote:<br clear="none" class="yiv7895624452" style="">
</div>
<blockquote class="yiv7895624452" type="cite" style=""> </blockquote>
</div>
<div class="yiv7895624452" id="yiv7895624452yqt48551" style="">
<div class="yiv7895624452" style="">
<div class="yiv7895624452 yiv7895624452yui_3_16_0_1_1407867329136_32748" 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="yiv7895624452" style=""><span class="yiv7895624452" style="">Hi
Vassil,</span></div>
<div class="yiv7895624452 yiv7895624452yui_3_16_0_1_1407867329136_32751" 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="yiv7895624452" style=""><br clear="none" class="yiv7895624452" style="">
</span></div>
<div class="yiv7895624452 yiv7895624452yui_3_16_0_1_1407867329136_32754" 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="yiv7895624452" 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="yiv7895624452 yiv7895624452yui_3_16_0_1_1407867329136_32756" 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="yiv7895624452" style=""><br clear="none" class="yiv7895624452" style="">
</span></div>
<div class="yiv7895624452 yiv7895624452yui_3_16_0_1_1407867329136_32759" 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="yiv7895624452 yiv7895624452yui_3_16_0_1_1407867329136_32760" 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" class="yiv7895624452" style="">
</div>
<div class="yiv7895624452 yiv7895624452yui_3_16_0_1_1407867329136_32762" 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="yiv7895624452 yiv7895624452yui_3_16_0_1_1407867329136_32763" 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="yiv7895624452" style=""><br clear="none" class="yiv7895624452" style="">
<br clear="none" class="yiv7895624452" style="">
</div>
<div class="yiv7895624452" style="display:block;">
<div class="yiv7895624452 yiv7895624452yui_3_16_0_1_1407867329136_32768" style="font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12pt;">
<div class="yiv7895624452" style="font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12pt;">
<div class="yiv7895624452" dir="ltr" style=""> <font class="yiv7895624452" style="" face="Arial" size="2"> On Monday, August
11, 2014 11:18
AM, Bogdan
Tabacaru <a rel="nofollow" shape="rect" class="yiv7895624452" ymailto="mailto:bogdan.tabacaru88@yahoo.com" target="_blank" href="mailto:bogdan.tabacaru88@yahoo.com" style=""><bogdan.tabacaru88@yahoo.com></a>
wrote:<br clear="none" class="yiv7895624452" style="">
</font> </div>
<br clear="none" class="yiv7895624452" style="">
<br clear="none" class="yiv7895624452" style="">
<div class="yiv7895624452" style="">
<div class="yiv7895624452" id="yiv7895624452" style="">
<div class="yiv7895624452" style="">
<div class="yiv7895624452" 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="yiv7895624452" style=""><span class="yiv7895624452" style="">That is a good question.</span></div>
<div class="yiv7895624452" 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="yiv7895624452" style=""><br clear="none" class="yiv7895624452" style="">
</span></div>
<div class="yiv7895624452" 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="yiv7895624452" style="">I have written a libTool with the same
visitor and
consumer.</span></div>
<div class="yiv7895624452" 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="yiv7895624452" style="">I called my_Rewriter.ReplaceText() to
make my
AST-transformations.</span></div>
<div class="yiv7895624452" 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="yiv7895624452" style="">I have output the RewriteBuffer to a new
file and then
I compiled it.</span></div>
<div class="yiv7895624452" 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="yiv7895624452" 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" class="yiv7895624452" style="">
</div>
<div class="yiv7895624452" 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="yiv7895624452" 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" class="yiv7895624452" style="">
</div>
<div class="yiv7895624452" style=""><br clear="none" class="yiv7895624452" style="">
<br clear="none" class="yiv7895624452" style="">
</div>
<div class="yiv7895624452" id="yiv7895624452yqt97309" style="">
<div class="yiv7895624452" style="display:block;">
<div class="yiv7895624452" style="font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12pt;">
<div class="yiv7895624452" style="font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12pt;">
<div class="yiv7895624452" dir="ltr" style=""> <font class="yiv7895624452" style="" face="Arial" size="2"> On Monday, August
11, 2014 9:59
AM, Vassil
Vassilev <a rel="nofollow" shape="rect" class="yiv7895624452" 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 clear="none" class="yiv7895624452" style="">
</font> </div>
<br clear="none" class="yiv7895624452" style="">
<br clear="none" class="yiv7895624452" style="">
<div class="yiv7895624452" style="">
<div class="yiv7895624452" id="yiv7895624452" style="">
<div class="yiv7895624452" style="">
<div class="yiv7895624452" style="">On
08/10/2014
11:02 AM,
Bogdan
Tabacaru
wrote:<br clear="none" class="yiv7895624452" style="">
</div>
<blockquote class="yiv7895624452" type="cite" style=""> </blockquote>
</div>
<div class="yiv7895624452" style="">
<div class="yiv7895624452" 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="yiv7895624452" style=""><span class="yiv7895624452" style="">Hi Vassil,</span></div>
<div class="yiv7895624452" 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="yiv7895624452" style=""><br clear="none" class="yiv7895624452" style="">
</span></div>
<div class="yiv7895624452" 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="yiv7895624452" 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" class="yiv7895624452" style="">
</div>
<div class="yiv7895624452" 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="yiv7895624452" 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" class="yiv7895624452" style="">
</div>
<div class="yiv7895624452" 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="yiv7895624452" 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" class="yiv7895624452" style="">
</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="yiv7895624452" id="yiv7895624452yqtfd61983" style=""><br clear="none" class="yiv7895624452" style="">
Vassil<br clear="none" class="yiv7895624452" style="">
<blockquote class="yiv7895624452" type="cite" style="">
<div class="yiv7895624452" 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="yiv7895624452" 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="yiv7895624452" 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="yiv7895624452" style=""><br clear="none" class="yiv7895624452" style="">
<br clear="none" class="yiv7895624452" style="">
</div>
<div class="yiv7895624452" style="display:block;">
<div class="yiv7895624452" style="font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12pt;">
<div class="yiv7895624452" style="font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12pt;">
<div class="yiv7895624452" dir="ltr" style=""> <font class="yiv7895624452" style="" face="Arial" size="2"> On Sunday, August
10, 2014 12:22
AM, Vassil
Vassilev <a rel="nofollow" shape="rect" class="yiv7895624452" ymailto="mailto:vvasilev@cern.ch" target="_blank" href="mailto:vvasilev@cern.ch" style=""><vvasilev@cern.ch></a>
wrote:<br clear="none" class="yiv7895624452" style="">
</font> </div>
<br clear="none" class="yiv7895624452" style="">
<br clear="none" class="yiv7895624452" style="">
<div class="yiv7895624452" style="">
<div class="yiv7895624452" id="yiv7895624452" style="">
<div class="yiv7895624452" style="">
<div class="yiv7895624452" style="">Hi
Bogdan,<br clear="none" class="yiv7895624452" style="">
After
applying the
attached
patch, I can
do:<br clear="none" class="yiv7895624452" style="">
<br clear="none" class="yiv7895624452" style="">
void
MyPlugin::Initialize(ASTContext&
Context) {<br clear="none" class="yiv7895624452" style="">
</div>
</div>
<div class="yiv7895624452" style=""> //
We need to
reorder the
consumers in
the
MultiplexConsumer.<br clear="none" class="yiv7895624452" style="">
MultiplexConsumer&
multiplex<br clear="none" class="yiv7895624452" style="">
=
static_cast<MultiplexConsumer&>(m_CI.getASTConsumer());<br clear="none" class="yiv7895624452" style="">
std::vector<ASTConsumer*>&
consumers =
multiplex.getConsumers();<br clear="none" class="yiv7895624452" style="">
ASTConsumer*
lastConsumer =
consumers.back();<br clear="none" class="yiv7895624452" style="">
consumers.pop_back();<br clear="none" class="yiv7895624452" style="">
consumers.insert(consumers.begin(),
lastConsumer);<br clear="none" class="yiv7895624452" style="">
}<br clear="none" class="yiv7895624452" style="">
<br clear="none" class="yiv7895624452" style="">
This allows me
to hook
MyPlugin
before clang's
codegen.<br clear="none" class="yiv7895624452" style="">
<br clear="none" class="yiv7895624452" style="">
Vassil<br clear="none" class="yiv7895624452" style="">
On 09/08/14
21:24, Bogdan
Tabacaru
wrote:<br clear="none" class="yiv7895624452" style="">
<blockquote class="yiv7895624452" type="cite" style=""> </blockquote>
</div>
<div class="yiv7895624452" id="yiv7895624452yqt71669" style="">
<div class="yiv7895624452" style="">
<div class="yiv7895624452" 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="yiv7895624452" style=""><span class="yiv7895624452" style="">Hi Vassil,</span></div>
<div class="yiv7895624452" 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="yiv7895624452" style=""><br clear="none" class="yiv7895624452" style="">
</span></div>
<div class="yiv7895624452" 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="yiv7895624452" 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="yiv7895624452" 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="yiv7895624452" style=""><br clear="none" class="yiv7895624452" style="">
</span></div>
<div class="yiv7895624452" 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="yiv7895624452" style="">Cheers,</span></div>
<div class="yiv7895624452" 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="yiv7895624452" style="">Bogdan</span></div>
<div class="yiv7895624452" style=""><br clear="none" class="yiv7895624452" style="">
<br clear="none" class="yiv7895624452" style="">
</div>
<div class="yiv7895624452" style="display:block;">
<div class="yiv7895624452" style="font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12pt;">
<div class="yiv7895624452" style="font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12pt;">
<div class="yiv7895624452" dir="ltr" style=""> <font class="yiv7895624452" style="" face="Arial" size="2"> On Friday, August
8, 2014 6:16
PM, Vassil
Vassilev <a rel="nofollow" shape="rect" class="yiv7895624452" ymailto="mailto:vvasilev@cern.ch" target="_blank" href="mailto:vvasilev@cern.ch" style=""><vvasilev@cern.ch></a>
wrote:<br clear="none" class="yiv7895624452" style="">
</font> </div>
<br clear="none" class="yiv7895624452" style="">
<br clear="none" class="yiv7895624452" style="">
<div class="yiv7895624452" style="">
<div class="yiv7895624452" id="yiv7895624452" style="">
<div class="yiv7895624452" style="">
<div class="yiv7895624452" style="">Hi,<br clear="none" class="yiv7895624452" style="">
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 clear="none" class="yiv7895624452" style="">
Vassil<br clear="none" class="yiv7895624452" style="">
On 08/08/14
16:48, Bogdan
Tabacaru
wrote:<br clear="none" class="yiv7895624452" style="">
</div>
<blockquote class="yiv7895624452" type="cite" style=""> </blockquote>
</div>
<div class="yiv7895624452" style="">
<div class="yiv7895624452" id="yiv7895624452yqt84664" style="">
<div class="yiv7895624452" 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="yiv7895624452" style="">Hi
everyone,</div>
<div class="yiv7895624452" style=""><br clear="none" class="yiv7895624452" style="">
</div>
<div class="yiv7895624452" 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="yiv7895624452" 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="yiv7895624452" 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" class="yiv7895624452" style="">
</div>
<div class="yiv7895624452" 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="yiv7895624452" 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" class="yiv7895624452" style="">
</div>
<div class="yiv7895624452" 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="yiv7895624452" style="font-size:12pt;">By following the
RecursiveASTVisitor
example, </span>I
have written a
clang plugin
which modifies
the parsed
AST.</div>
<div class="yiv7895624452" 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" class="yiv7895624452" style="">
</div>
<div class="yiv7895624452" 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="yiv7895624452" 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" class="yiv7895624452" style="">
</div>
<div class="yiv7895624452" 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="yiv7895624452" style="font-size:12pt;">command</span><span class="yiv7895624452" style="font-size:12pt;"> </span><span class="yiv7895624452" style="background-color:transparent;">(instead
the "standard"
-plugin
command) when
calling the
plugin.</span></div>
<div class="yiv7895624452" 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="yiv7895624452" style="background-color:transparent;"><br clear="none" class="yiv7895624452" style="">
</span></div>
<div class="yiv7895624452" 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="yiv7895624452" 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="yiv7895624452" 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="yiv7895624452" 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="yiv7895624452" 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="yiv7895624452" style="background-color:transparent;"><br clear="none" class="yiv7895624452" style="">
</span></div>
<div class="yiv7895624452" 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="yiv7895624452" style="background-color:transparent;">Thanks a lot
for your help,</span></div>
<div class="yiv7895624452" 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="yiv7895624452" style="background-color:transparent;">Bogdan</span></div>
<div class="yiv7895624452" 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" class="yiv7895624452" style="">
</div>
<div class="yiv7895624452" 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" class="yiv7895624452" style="">
</div>
</div>
</div>
<br clear="none" class="yiv7895624452" style="">
<fieldset class="yiv7895624452" style=""></fieldset>
<br clear="none" class="yiv7895624452" style="">
<pre class="yiv7895624452" style="">_______________________________________________
cfe-dev mailing list
<a rel="nofollow" shape="rect" class="yiv7895624452" ymailto="mailto:cfe-dev@cs.uiuc.edu" target="_blank" href="mailto:cfe-dev@cs.uiuc.edu" style="">cfe-dev@cs.uiuc.edu</a>
<a rel="nofollow" shape="rect" class="yiv7895624452" 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 clear="none" class="yiv7895624452" style="">
</div>
</div>
<br clear="none" class="yiv7895624452" style="">
<br clear="none" class="yiv7895624452" style="">
</div>
</div>
</div>
</div>
</div>
<br clear="none" class="yiv7895624452" style="">
</div>
</div>
</div>
<br clear="none" class="yiv7895624452" style="">
<br clear="none" class="yiv7895624452" style="">
</div>
</div>
</div>
</div>
</div>
</blockquote>
<br clear="none" class="yiv7895624452" style="">
</div>
</div>
</div>
<br clear="none" class="yiv7895624452" style="">
<br clear="none" class="yiv7895624452" style="">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br clear="none" class="yiv7895624452" style="">
<br clear="none" class="yiv7895624452" style="">
</div>
</div>
</div>
</div>
</div>
<br clear="none" class="yiv7895624452" style="">
</div>
</div>
</div>
<br clear="none" class="yiv7895624452" style="">
<br clear="none" class="yiv7895624452" style="">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<br clear="none">
</div>
</div>
</div>
<br clear="none">
<br clear="none">
</div>
</div>
</div>
</div>
</div>
</blockquote>
<br clear="none">
</div>
</div><br clear="none"><br clear="none"></div> </div> </div> </div></div> </div></div></div></div></body></html>