<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:18, Bogdan Tabacaru
      wrote:<br>
    </div>
    <blockquote
      cite="mid:1407871103.91824.YahooMailNeo@web120005.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 id="yiv4430163137" class="" style="">
          <div class="" style="">
            <div
              style="color:#000;background-color:#fff;font-family:HelveticaNeue,
              Helvetica Neue, Helvetica, Arial, Lucida Grande,
              sans-serif;font-size:12pt;" class="">
              <div id="yiv4430163137yui_3_16_0_6_1407867329136_4"
                class="" style=""><span
                  id="yiv4430163137yui_3_16_0_6_1407867329136_13"
                  class="" style="">Hi Vassil,</span></div>
              <div id="yiv4430163137yui_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;"
                class=""><span
                  id="yiv4430163137yui_3_16_0_6_1407867329136_16"
                  class="" style=""><br style="" clear="none">
                </span></div>
              <div id="yiv4430163137yui_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;"
                class=""><span class="" 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 id="yiv4430163137yui_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;"
                class=""><span class="" style="">With or without the
                  Visitor, calling the HandleTopLevelDecl instead of
                  HandleTranslationUnit did not give me the desired
                  effect.</span></div>
              <div id="yiv4430163137yui_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;"
                class="">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>
    </blockquote>
    I don't know. I haven't used the Rewriter in such scenario. We
    transform the AST with regular Stmt or Decl Visitors.<br>
    Vassil<br>
    <blockquote
      cite="mid:1407871103.91824.YahooMailNeo@web120005.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 id="yiv4430163137" class="" style="">
          <div class="" style="">
            <div
              style="color:#000;background-color:#fff;font-family:HelveticaNeue,
              Helvetica Neue, Helvetica, Arial, Lucida Grande,
              sans-serif;font-size:12pt;" class="">
              <div id="yiv4430163137yui_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;"
                class=""><br>
              </div>
              <div id="yiv4430163137yui_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;"
                class="">Cheers,</div>
              <div id="yiv4430163137yui_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;"
                class="">Bogdan</div>
              <div class="" id="yiv4430163137yqt28115" style="">
                <div class=""
                  id="yiv4430163137yui_3_16_0_6_1407867329136_7"
                  style="display: none;">
                  <div class="" style="font-family:HelveticaNeue,
                    Helvetica Neue, Helvetica, Arial, Lucida Grande,
                    sans-serif;font-size:12pt;">
                    <div class="" style="font-family:HelveticaNeue,
                      Helvetica Neue, Helvetica, Arial, Lucida Grande,
                      sans-serif;font-size:12pt;">
                      <div dir="ltr" class="" style=""> <font class=""
                          style="" face="Arial" size="2"> On Tuesday,
                          August 12, 2014 7:19 PM, Vassil Vassilev
                          <a class="moz-txt-link-rfc2396E" href="mailto:vvasilev@cern.ch"><vvasilev@cern.ch></a> wrote:<br class=""
                            style="" clear="none">
                        </font> </div>
                      <br class="" style="" clear="none">
                      <br class="" style="" clear="none">
                      <div class="" style="">
                        <div id="yiv4430163137" class="" style="">
                          <div class="" style="">
                            <div class="" style="">Hi Bogdan,<br
                                class="" style="" clear="none">
                                It seems that your visitor is called too
                              late, i.e on HandleTranslationUnit. You
                              should override HandleTopLevelDecl
                              instead.<br class="" style="" clear="none">
                              Cheers,<br class="" style="" clear="none">
                              Vassil<br class="" style="" clear="none">
                              On 12/08/14 10:53, Bogdan Tabacaru wrote:<br
                                class="" style="" clear="none">
                            </div>
                            <blockquote type="cite" class="" style=""> </blockquote>
                          </div>
                          <div class="" id="yiv4430163137yqt48551"
                            style="">
                            <div class="" style="">
                              <div class=""
                                style="color:#000;background-color:#fff;font-family:HelveticaNeue,
                                Helvetica Neue, Helvetica, Arial, Lucida
                                Grande, sans-serif;font-size:12pt;">
                                <div class="" style=""><span class=""
                                    style="">Hi Vassil,</span></div>
                                <div class="" 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="" style=""><br class=""
                                      style="" clear="none">
                                  </span></div>
                                <div class="" 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="" 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="" 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="" style=""><br class=""
                                      style="" clear="none">
                                  </span></div>
                                <div class="" 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="" 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="" style="" clear="none">
                                </div>
                                <div class="" 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="" 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="" style=""><br class=""
                                    style="" clear="none">
                                  <br class="" style="" clear="none">
                                </div>
                                <div class="" style="display:block;">
                                  <div class=""
                                    style="font-family:HelveticaNeue,
                                    'Helvetica Neue', Helvetica, Arial,
                                    'Lucida Grande',
                                    sans-serif;font-size:12pt;">
                                    <div class=""
                                      style="font-family:HelveticaNeue,
                                      'Helvetica Neue', Helvetica,
                                      Arial, 'Lucida Grande',
                                      sans-serif;font-size:12pt;">
                                      <div dir="ltr" class="" style="">
                                        <font class="" 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=""
                                            ymailto="mailto:bogdan.tabacaru88@yahoo.com"
                                            target="_blank"
                                            href="mailto:bogdan.tabacaru88@yahoo.com"
                                            style=""><bogdan.tabacaru88@yahoo.com></a>
                                          wrote:<br class="" style=""
                                            clear="none">
                                        </font> </div>
                                      <br class="" style="" clear="none">
                                      <br class="" style="" clear="none">
                                      <div class="" style="">
                                        <div id="yiv4430163137" class=""
                                          style="">
                                          <div class="" style="">
                                            <div class=""
                                              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="" style=""><span
                                                  class="" style="">That
                                                  is a good question.</span></div>
                                              <div class=""
                                                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="" style=""><br
                                                    class="" style=""
                                                    clear="none">
                                                </span></div>
                                              <div class=""
                                                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="" style="">I
                                                  have written a libTool
                                                  with the same visitor
                                                  and consumer.</span></div>
                                              <div class=""
                                                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="" style="">I
                                                  called
                                                  my_Rewriter.ReplaceText()
                                                  to make my
                                                  AST-transformations.</span></div>
                                              <div class=""
                                                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="" style="">I
                                                  have output the
                                                  RewriteBuffer to a new
                                                  file and then I
                                                  compiled it.</span></div>
                                              <div class=""
                                                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=""
                                                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="" style=""
                                                  clear="none">
                                              </div>
                                              <div class=""
                                                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=""
                                                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="" style=""
                                                  clear="none">
                                              </div>
                                              <div class="" style=""><br
                                                  class="" style=""
                                                  clear="none">
                                                <br class="" style=""
                                                  clear="none">
                                              </div>
                                              <div class=""
                                                id="yiv4430163137yqt97309"
                                                style="">
                                                <div class=""
                                                  style="display:block;">
                                                  <div class=""
                                                    style="font-family:HelveticaNeue,
                                                    'Helvetica Neue',
                                                    Helvetica, Arial,
                                                    'Lucida Grande',
                                                    sans-serif;font-size:12pt;">
                                                    <div class=""
                                                      style="font-family:HelveticaNeue,
                                                      'Helvetica Neue',
                                                      Helvetica, Arial,
                                                      'Lucida Grande',
                                                      sans-serif;font-size:12pt;">
                                                      <div dir="ltr"
                                                        class=""
                                                        style=""> <font
                                                          class=""
                                                          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=""
                                                          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=""
                                                          style=""
                                                          clear="none">
                                                        </font> </div>
                                                      <br class=""
                                                        style=""
                                                        clear="none">
                                                      <br class=""
                                                        style=""
                                                        clear="none">
                                                      <div class=""
                                                        style="">
                                                        <div
                                                          id="yiv4430163137"
                                                          class=""
                                                          style="">
                                                          <div class=""
                                                          style="">
                                                          <div class=""
                                                          style="">On
                                                          08/10/2014
                                                          11:02 AM,
                                                          Bogdan
                                                          Tabacaru
                                                          wrote:<br
                                                          class=""
                                                          style=""
                                                          clear="none">
                                                          </div>
                                                          <blockquote
                                                          type="cite"
                                                          class=""
                                                          style=""> </blockquote>
                                                          </div>
                                                          <div class=""
                                                          style="">
                                                          <div class=""
                                                          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=""
                                                          style=""><span
                                                          class=""
                                                          style="">Hi
                                                          Vassil,</span></div>
                                                          <div class=""
                                                          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=""
                                                          style=""><br
                                                          class=""
                                                          style=""
                                                          clear="none">
                                                          </span></div>
                                                          <div class=""
                                                          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=""
                                                          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=""
                                                          style=""
                                                          clear="none">
                                                          </div>
                                                          <div class=""
                                                          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=""
                                                          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=""
                                                          style=""
                                                          clear="none">
                                                          </div>
                                                          <div class=""
                                                          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=""
                                                          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=""
                                                          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=""
id="yiv4430163137yqtfd61983" style=""><br class="" style="" clear="none">
                                                          Vassil<br
                                                          class=""
                                                          style=""
                                                          clear="none">
                                                          <blockquote
                                                          type="cite"
                                                          class=""
                                                          style="">
                                                          <div class=""
                                                          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=""
                                                          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=""
                                                          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=""
                                                          style=""><br
                                                          class=""
                                                          style=""
                                                          clear="none">
                                                          <br class=""
                                                          style=""
                                                          clear="none">
                                                          </div>
                                                          <div class=""
style="display:block;">
                                                          <div class=""
                                                          style="font-family:HelveticaNeue,
                                                          'Helvetica
                                                          Neue',
                                                          Helvetica,
                                                          Arial, 'Lucida
                                                          Grande',
                                                          sans-serif;font-size:12pt;">
                                                          <div class=""
                                                          style="font-family:HelveticaNeue,
                                                          'Helvetica
                                                          Neue',
                                                          Helvetica,
                                                          Arial, 'Lucida
                                                          Grande',
                                                          sans-serif;font-size:12pt;">
                                                          <div dir="ltr"
                                                          class=""
                                                          style=""> <font
                                                          class=""
                                                          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=""
                                                          ymailto="mailto:vvasilev@cern.ch"
target="_blank" href="mailto:vvasilev@cern.ch" style=""><vvasilev@cern.ch></a>
                                                          wrote:<br
                                                          class=""
                                                          style=""
                                                          clear="none">
                                                          </font> </div>
                                                          <br class=""
                                                          style=""
                                                          clear="none">
                                                          <br class=""
                                                          style=""
                                                          clear="none">
                                                          <div class=""
                                                          style="">
                                                          <div
                                                          id="yiv4430163137"
                                                          class=""
                                                          style="">
                                                          <div class=""
                                                          style="">
                                                          <div class=""
                                                          style="">Hi
                                                          Bogdan,<br
                                                          class=""
                                                          style=""
                                                          clear="none">
                                                            After
                                                          applying the
                                                          attached
                                                          patch, I can
                                                          do:<br
                                                          class=""
                                                          style=""
                                                          clear="none">
                                                          <br class=""
                                                          style=""
                                                          clear="none">
                                                          void
                                                          MyPlugin::Initialize(ASTContext&
                                                          Context) {<br
                                                          class=""
                                                          style=""
                                                          clear="none">
                                                            </div>
                                                          </div>
                                                          <div class=""
                                                          style=""> //
                                                          We need to
                                                          reorder the
                                                          consumers in
                                                          the
                                                          MultiplexConsumer.<br
                                                          class=""
                                                          style=""
                                                          clear="none">
                                                          MultiplexConsumer&

                                                          multiplex<br
                                                          class=""
                                                          style=""
                                                          clear="none">
                                                          =
                                                          static_cast<MultiplexConsumer&>(m_CI.getASTConsumer());<br
                                                          class=""
                                                          style=""
                                                          clear="none">
                                                          std::vector<ASTConsumer*>&

                                                          consumers =
                                                          multiplex.getConsumers();<br
                                                          class=""
                                                          style=""
                                                          clear="none">
                                                          ASTConsumer*
                                                          lastConsumer =
consumers.back();<br class="" style="" clear="none">
consumers.pop_back();<br class="" style="" clear="none">
                                                          consumers.insert(consumers.begin(),

                                                          lastConsumer);<br
                                                          class=""
                                                          style=""
                                                          clear="none">
                                                          }<br class=""
                                                          style=""
                                                          clear="none">
                                                          <br class=""
                                                          style=""
                                                          clear="none">
                                                          This allows me
                                                          to hook
                                                          MyPlugin
                                                          before clang's
                                                          codegen.<br
                                                          class=""
                                                          style=""
                                                          clear="none">
                                                          <br class=""
                                                          style=""
                                                          clear="none">
                                                          Vassil<br
                                                          class=""
                                                          style=""
                                                          clear="none">
                                                          On 09/08/14
                                                          21:24, Bogdan
                                                          Tabacaru
                                                          wrote:<br
                                                          class=""
                                                          style=""
                                                          clear="none">
                                                          <blockquote
                                                          type="cite"
                                                          class=""
                                                          style=""> </blockquote>
                                                          </div>
                                                          <div class=""
id="yiv4430163137yqt71669" style="">
                                                          <div class=""
                                                          style="">
                                                          <div class=""
                                                          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=""
                                                          style=""><span
                                                          class=""
                                                          style="">Hi
                                                          Vassil,</span></div>
                                                          <div class=""
                                                          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=""
                                                          style=""><br
                                                          class=""
                                                          style=""
                                                          clear="none">
                                                          </span></div>
                                                          <div class=""
                                                          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=""
                                                          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=""
                                                          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=""
                                                          style=""><br
                                                          class=""
                                                          style=""
                                                          clear="none">
                                                          </span></div>
                                                          <div class=""
                                                          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=""
                                                          style="">Cheers,</span></div>
                                                          <div class=""
                                                          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=""
                                                          style="">Bogdan</span></div>
                                                          <div class=""
                                                          style=""><br
                                                          class=""
                                                          style=""
                                                          clear="none">
                                                          <br class=""
                                                          style=""
                                                          clear="none">
                                                          </div>
                                                          <div class=""
style="display:block;">
                                                          <div class=""
                                                          style="font-family:HelveticaNeue,
                                                          'Helvetica
                                                          Neue',
                                                          Helvetica,
                                                          Arial, 'Lucida
                                                          Grande',
                                                          sans-serif;font-size:12pt;">
                                                          <div class=""
                                                          style="font-family:HelveticaNeue,
                                                          'Helvetica
                                                          Neue',
                                                          Helvetica,
                                                          Arial, 'Lucida
                                                          Grande',
                                                          sans-serif;font-size:12pt;">
                                                          <div dir="ltr"
                                                          class=""
                                                          style=""> <font
                                                          class=""
                                                          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=""
                                                          ymailto="mailto:vvasilev@cern.ch"
target="_blank" href="mailto:vvasilev@cern.ch" style=""><vvasilev@cern.ch></a>
                                                          wrote:<br
                                                          class=""
                                                          style=""
                                                          clear="none">
                                                          </font> </div>
                                                          <br class=""
                                                          style=""
                                                          clear="none">
                                                          <br class=""
                                                          style=""
                                                          clear="none">
                                                          <div class=""
                                                          style="">
                                                          <div
                                                          id="yiv4430163137"
                                                          class=""
                                                          style="">
                                                          <div class=""
                                                          style="">
                                                          <div class=""
                                                          style="">Hi,<br
                                                          class=""
                                                          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=""
                                                          style=""
                                                          clear="none">
                                                          Vassil<br
                                                          class=""
                                                          style=""
                                                          clear="none">
                                                          On 08/08/14
                                                          16:48, Bogdan
                                                          Tabacaru
                                                          wrote:<br
                                                          class=""
                                                          style=""
                                                          clear="none">
                                                          </div>
                                                          <blockquote
                                                          type="cite"
                                                          class=""
                                                          style=""> </blockquote>
                                                          </div>
                                                          <div class=""
                                                          style="">
                                                          <div class=""
id="yiv4430163137yqt84664" style="">
                                                          <div class=""
                                                          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=""
                                                          style="">Hi
                                                          everyone,</div>
                                                          <div class=""
                                                          style=""><br
                                                          class=""
                                                          style=""
                                                          clear="none">
                                                          </div>
                                                          <div class=""
                                                          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=""
                                                          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=""
                                                          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=""
                                                          style=""
                                                          clear="none">
                                                          </div>
                                                          <div class=""
                                                          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=""
                                                          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=""
                                                          style=""
                                                          clear="none">
                                                          </div>
                                                          <div class=""
                                                          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=""
                                                          style="font-size:12pt;">By
                                                          following the
                                                          RecursiveASTVisitor

                                                          example, </span>I
                                                          have written a
                                                          clang plugin
                                                          which modifies
                                                          the parsed
                                                          AST.</div>
                                                          <div class=""
                                                          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=""
                                                          style=""
                                                          clear="none">
                                                          </div>
                                                          <div class=""
                                                          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=""
                                                          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=""
                                                          style=""
                                                          clear="none">
                                                          </div>
                                                          <div class=""
                                                          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=""
                                                          style="font-size:12pt;">command</span><span
                                                          class=""
                                                          style="font-size:12pt;"> </span><span
                                                          class=""
                                                          style="background-color:transparent;">(instead



                                                          the "standard"
                                                          -plugin
                                                          command) when
                                                          calling the
                                                          plugin.</span></div>
                                                          <div class=""
                                                          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=""
                                                          style="background-color:transparent;"><br
                                                          class=""
                                                          style=""
                                                          clear="none">
                                                          </span></div>
                                                          <div class=""
                                                          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=""
                                                          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=""
                                                          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=""
                                                          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=""
                                                          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=""
                                                          style="background-color:transparent;"><br
                                                          class=""
                                                          style=""
                                                          clear="none">
                                                          </span></div>
                                                          <div class=""
                                                          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=""
                                                          style="background-color:transparent;">Thanks
                                                          a lot for your
                                                          help,</span></div>
                                                          <div class=""
                                                          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=""
                                                          style="background-color:transparent;">Bogdan</span></div>
                                                          <div class=""
                                                          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=""
                                                          style=""
                                                          clear="none">
                                                          </div>
                                                          <div class=""
                                                          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=""
                                                          style=""
                                                          clear="none">
                                                          </div>
                                                          </div>
                                                          </div>
                                                          <br class=""
                                                          style=""
                                                          clear="none">
                                                          <fieldset
                                                          class=""
                                                          style=""></fieldset>
                                                          <br class=""
                                                          style=""
                                                          clear="none">
                                                          <pre class="" style="">_______________________________________________
cfe-dev mailing list
<a moz-do-not-send="true" rel="nofollow" shape="rect" class="" 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="" 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=""
                                                          style=""
                                                          clear="none">
                                                          </div>
                                                          </div>
                                                          <br class=""
                                                          style=""
                                                          clear="none">
                                                          <br class=""
                                                          style=""
                                                          clear="none">
                                                          </div>
                                                          </div>
                                                          </div>
                                                          </div>
                                                          </div>
                                                          <br class=""
                                                          style=""
                                                          clear="none">
                                                          </div>
                                                          </div>
                                                          </div>
                                                          <br class=""
                                                          style=""
                                                          clear="none">
                                                          <br class=""
                                                          style=""
                                                          clear="none">
                                                          </div>
                                                          </div>
                                                          </div>
                                                          </div>
                                                          </div>
                                                          </blockquote>
                                                          <br class=""
                                                          style=""
                                                          clear="none">
                                                          </div>
                                                          </div>
                                                        </div>
                                                        <br class=""
                                                          style=""
                                                          clear="none">
                                                        <br class=""
                                                          style=""
                                                          clear="none">
                                                      </div>
                                                    </div>
                                                  </div>
                                                </div>
                                              </div>
                                            </div>
                                          </div>
                                        </div>
                                        <br class="" style=""
                                          clear="none">
                                        <br class="" style=""
                                          clear="none">
                                      </div>
                                    </div>
                                  </div>
                                </div>
                              </div>
                              <br class="" style="" clear="none">
                            </div>
                          </div>
                        </div>
                        <br class="" style="" clear="none">
                        <br class="" style="" clear="none">
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
  </body>
</html>