<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 08/10/2014 11:02 AM, Bogdan Tabacaru
      wrote:<br>
    </div>
    <blockquote
      cite="mid:1407661375.62316.YahooMailNeo@web120005.mail.ne1.yahoo.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=windows-1252">
      <div style="color:#000; background-color:#fff;
        font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial,
        Lucida Grande, sans-serif;font-size:12pt">
        <div><span>Hi Vassil,</span></div>
        <div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
          HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida
          Grande', sans-serif; font-style: normal; background-color:
          transparent;"><span><br>
          </span></div>
        <div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
          HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida
          Grande', sans-serif; font-style: normal; background-color:
          transparent;">thanks for the example and the patch!</div>
        <div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
          HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida
          Grande', sans-serif; font-style: normal; background-color:
          transparent;"><br>
        </div>
        <div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
          HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida
          Grande', sans-serif; font-style: normal; background-color:
          transparent;">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 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>
        </div>
        <div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
          HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida
          Grande', sans-serif; font-style: normal; background-color:
          transparent;">Is there another step which I may have
          forgotten?</div>
        <div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
          HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida
          Grande', sans-serif; font-style: normal; background-color:
          transparent;"><br>
        </div>
      </div>
    </blockquote>
      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?<br>
    Vassil<br>
    <blockquote
      cite="mid:1407661375.62316.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 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 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="qtdSeparateBR"><br>
          <br>
        </div>
        <div class="yahoo_quoted" style="display: block;">
          <div style="font-family: HelveticaNeue, 'Helvetica Neue',
            Helvetica, Arial, 'Lucida Grande', sans-serif; font-size:
            12pt;">
            <div style="font-family: HelveticaNeue, 'Helvetica Neue',
              Helvetica, Arial, 'Lucida Grande', sans-serif; font-size:
              12pt;">
              <div dir="ltr"> <font face="Arial" size="2"> On Sunday,
                  August 10, 2014 12:22 AM, Vassil Vassilev
                  <a class="moz-txt-link-rfc2396E" href="mailto:vvasilev@cern.ch"><vvasilev@cern.ch></a> wrote:<br>
                </font> </div>
              <br>
              <br>
              <div class="y_msg_container">
                <div id="yiv0811446855">
                  <div>
                    <div class="yiv0811446855moz-cite-prefix">Hi Bogdan,<br
                        clear="none">
                        After applying the attached patch, I can do:<br
                        clear="none">
                      <br clear="none">
                      void MyPlugin::Initialize(ASTContext& Context)
                      {<br clear="none">
                        </div>
                  </div>
                  <div> // We need to reorder the consumers in the
                    MultiplexConsumer.<br clear="none">
                    MultiplexConsumer& multiplex<br clear="none">
                    =
                    static_cast<MultiplexConsumer&>(m_CI.getASTConsumer());<br
                      clear="none">
                    std::vector<ASTConsumer*>& consumers =
                    multiplex.getConsumers();<br clear="none">
                    ASTConsumer* lastConsumer = consumers.back();<br
                      clear="none">
                    consumers.pop_back();<br clear="none">
                    consumers.insert(consumers.begin(), lastConsumer);<br
                      clear="none">
                    }<br clear="none">
                    <br clear="none">
                    This allows me to hook MyPlugin before clang's
                    codegen.<br clear="none">
                    <br clear="none">
                    Vassil<br clear="none">
                    On 09/08/14 21:24, Bogdan Tabacaru wrote:<br
                      clear="none">
                    <blockquote type="cite"> </blockquote>
                  </div>
                  <div class="yiv0811446855yqt7004341515"
                    id="yiv0811446855yqt71669">
                    <div>
                      <div style="color: rgb(0, 0, 0); font-family:
                        HelveticaNeue, 'Helvetica Neue', Helvetica,
                        Arial, 'Lucida Grande', sans-serif; font-size:
                        12pt; background-color: rgb(255, 255, 255);">
                        <div><span>Hi Vassil,</span></div>
                        <div style="color: rgb(0, 0, 0); font-size:
                          16px; font-family: HelveticaNeue, 'Helvetica
                          Neue', Helvetica, Arial, 'Lucida Grande',
                          sans-serif; font-style: normal;
                          background-color: transparent;"><span><br
                              clear="none">
                          </span></div>
                        <div style="color: rgb(0, 0, 0); font-size:
                          16px; font-family: HelveticaNeue, 'Helvetica
                          Neue', Helvetica, Arial, 'Lucida Grande',
                          sans-serif; font-style: normal;
                          background-color: transparent;"><span>Is the
                            patch available for the 3.4.2 version of
                            LLVM or must I migrate to the "current"
                            version ?</span></div>
                        <div style="color: rgb(0, 0, 0); font-size:
                          16px; font-family: HelveticaNeue, 'Helvetica
                          Neue', Helvetica, Arial, 'Lucida Grande',
                          sans-serif; font-style: normal;
                          background-color: transparent;"><span><br
                              clear="none">
                          </span></div>
                        <div style="color: rgb(0, 0, 0); font-size:
                          16px; font-family: HelveticaNeue, 'Helvetica
                          Neue', Helvetica, Arial, 'Lucida Grande',
                          sans-serif; font-style: normal;
                          background-color: transparent;"><span>Cheers,</span></div>
                        <div style="color: rgb(0, 0, 0); font-size:
                          16px; font-family: HelveticaNeue, 'Helvetica
                          Neue', Helvetica, Arial, 'Lucida Grande',
                          sans-serif; font-style: normal;
                          background-color: transparent;"><span>Bogdan</span></div>
                        <div class="yiv0811446855qtdSeparateBR"><br
                            clear="none">
                          <br clear="none">
                        </div>
                        <div class="yiv0811446855yahoo_quoted"
                          style="display: block;">
                          <div style="font-family: HelveticaNeue,
                            'Helvetica Neue', Helvetica, Arial, 'Lucida
                            Grande', sans-serif; font-size: 12pt;">
                            <div style="font-family: HelveticaNeue,
                              'Helvetica Neue', Helvetica, Arial,
                              'Lucida Grande', sans-serif; font-size:
                              12pt;">
                              <div dir="ltr"> <font face="Arial"
                                  size="2"> On Friday, August 8, 2014
                                  6:16 PM, Vassil Vassilev <a
                                    moz-do-not-send="true"
                                    rel="nofollow" shape="rect"
                                    class="yiv0811446855moz-txt-link-rfc2396E"
                                    ymailto="mailto:vvasilev@cern.ch"
                                    target="_blank"
                                    href="mailto:vvasilev@cern.ch"><vvasilev@cern.ch></a>
                                  wrote:<br clear="none">
                                </font> </div>
                              <br clear="none">
                              <br clear="none">
                              <div class="yiv0811446855y_msg_container">
                                <div id="yiv0811446855">
                                  <div>
                                    <div
                                      class="yiv0811446855moz-cite-prefix">Hi,<br
                                        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
                                        clear="none">
                                      Vassil<br clear="none">
                                      On 08/08/14 16:48, Bogdan Tabacaru
                                      wrote:<br clear="none">
                                    </div>
                                    <blockquote type="cite"> </blockquote>
                                  </div>
                                  <div>
                                    <div
                                      class="yiv0811446855yqt9700857600"
                                      id="yiv0811446855yqt84664">
                                      <div style="color: rgb(0, 0, 0);
                                        font-family: HelveticaNeue,
                                        'Helvetica Neue', Helvetica,
                                        Arial, 'Lucida Grande',
                                        sans-serif; font-size: 12pt;
                                        background-color: rgb(255, 255,
                                        255);">
                                        <div class="yiv0811446855"
                                          style="">Hi everyone,</div>
                                        <div class="yiv0811446855"
                                          style=""><br
                                            class="yiv0811446855"
                                            style="" clear="none">
                                        </div>
                                        <div class="yiv0811446855"
                                          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="yiv0811446855"
                                          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="yiv0811446855"
                                          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="yiv0811446855"
                                            style="" clear="none">
                                        </div>
                                        <div class="yiv0811446855"
                                          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="yiv0811446855"
                                          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="yiv0811446855"
                                            style="" clear="none">
                                        </div>
                                        <div class="yiv0811446855"
                                          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="yiv0811446855"
                                            style="font-size:12pt;">By
                                            following the
                                            RecursiveASTVisitor
                                            example, </span>I have
                                          written a clang plugin which
                                          modifies the parsed AST.</div>
                                        <div class="yiv0811446855"
                                          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="yiv0811446855"
                                            style="" clear="none">
                                        </div>
                                        <div class="yiv0811446855"
                                          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="yiv0811446855"
                                          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="yiv0811446855"
                                            style="" clear="none">
                                        </div>
                                        <div class="yiv0811446855"
                                          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="yiv0811446855"
                                            style="font-size:12pt;">command</span><span
                                            class="yiv0811446855"
                                            style="font-size:12pt;"> </span><span
                                            class="yiv0811446855"
                                            style="background-color:transparent;">(instead

                                            the "standard" -plugin
                                            command) when calling the
                                            plugin.</span></div>
                                        <div class="yiv0811446855"
                                          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="yiv0811446855"
                                            style="background-color:transparent;"><br
                                              class="yiv0811446855"
                                              style="" clear="none">
                                          </span></div>
                                        <div class="yiv0811446855"
                                          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="yiv0811446855"
                                            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="yiv0811446855"
                                          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="yiv0811446855"
                                            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="yiv0811446855"
                                          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="yiv0811446855"
                                            style="background-color:transparent;"><br
                                              class="yiv0811446855"
                                              style="" clear="none">
                                          </span></div>
                                        <div class="yiv0811446855"
                                          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="yiv0811446855"
                                            style="background-color:transparent;">Thanks

                                            a lot for your help,</span></div>
                                        <div class="yiv0811446855"
                                          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="yiv0811446855"
                                            style="background-color:transparent;">Bogdan</span></div>
                                        <div class="yiv0811446855"
                                          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="yiv0811446855"
                                            style="" clear="none">
                                        </div>
                                        <div class="yiv0811446855"
                                          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="yiv0811446855"
                                            style="" clear="none">
                                        </div>
                                      </div>
                                    </div>
                                    <br clear="none">
                                    <fieldset
                                      class="yiv0811446855mimeAttachmentHeader"></fieldset>
                                    <br clear="none">
                                    <pre>_______________________________________________
cfe-dev mailing list
<a moz-do-not-send="true" rel="nofollow" shape="rect" class="yiv0811446855moz-txt-link-abbreviated" ymailto="mailto:cfe-dev@cs.uiuc.edu" target="_blank" href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a>
<a moz-do-not-send="true" rel="nofollow" shape="rect" class="yiv0811446855moz-txt-link-freetext" target="_blank" href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a>
</pre>
                                    <br clear="none">
                                  </div>
                                </div>
                                <br clear="none">
                                <br clear="none">
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                      <br clear="none">
                    </div>
                  </div>
                </div>
                <br>
                <br>
              </div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
  </body>
</html>