<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    At the moment I am using the ASTConsumer/ASTVisitor interface. But I
    am planing to switch to AST matchers asap.<br>
    After scratching my head for a while I found the solution for my
    problem. It was just a misunderstanding of the inheritance tree.<br>
    <br>
    Thanks for your help<br>
    <br>
    Marcel<br>
    <div class="moz-cite-prefix">Am 01.08.2017 um 13:48 schrieb Manuel
      Klimek:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAOsfVvntFpbLQrmr43QoMm9bXvEUOgE4nvZHCDPyS83eNy=3tA@mail.gmail.com">
      <div dir="ltr">
        <div class="gmail_quote">
          <div dir="ltr">On Tue, Aug 1, 2017 at 12:35 PM Marcel Schaible
            <<a href="mailto:marcel@schaible-consulting.de"
              moz-do-not-send="true">marcel@schaible-consulting.de</a>>
            wrote:<br>
          </div>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div text="#000000" bgcolor="#FFFFFF"> Manuel, thanks for
              your help. Of course I went already through a bunch of
              documentation including libtooling.<br>
              My tool is performing now the basic setup and can
              transform some simple cases.<br>
              <br>
              Do you know by chance how to retrieve the ASTContext from
              a ReturnStmt and a FuncDecl?<br>
            </div>
          </blockquote>
          <div><br>
          </div>
          <div>Generally, if you use AST matchers you'll have the
            ASTContext in the callback. What exactly is the problem
            you're running into?</div>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div text="#000000" bgcolor="#FFFFFF"><br>
              BTW: Your presentation at the EURO LLVM was very helpful!<br>
            </div>
          </blockquote>
          <div><br>
          </div>
          <div>Thanks! :)</div>
          <div> </div>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div text="#000000" bgcolor="#FFFFFF"> <br>
              Greetings from Munich</div>
            <div text="#000000" bgcolor="#FFFFFF"><br>
              <br>
              Marcel</div>
            <div text="#000000" bgcolor="#FFFFFF"><br>
              <br>
              <br>
              <br>
              <div class="m_1533006104724532659moz-cite-prefix">Am
                01.08.2017 um 12:16 schrieb Manuel Klimek:<br>
              </div>
              <blockquote type="cite">
                <div dir="ltr">
                  <div>You'll probably want to take a look at
                    libtooling:</div>
                  <a href="https://clang.llvm.org/docs/LibTooling.html"
                    target="_blank" moz-do-not-send="true">https://clang.llvm.org/docs/LibTooling.html</a><br>
                </div>
                <br>
                <div class="gmail_quote">
                  <div dir="ltr">On Fri, Jul 28, 2017 at 4:54 PM Marcel
                    Schaible via cfe-dev <<a
                      href="mailto:cfe-dev@lists.llvm.org"
                      target="_blank" moz-do-not-send="true">cfe-dev@lists.llvm.org</a>>
                    wrote:<br>
                  </div>
                  <blockquote class="gmail_quote" style="margin:0 0 0
                    .8ex;border-left:1px #ccc solid;padding-left:1ex">
                    <div text="#000000" bgcolor="#FFFFFF">
                      <p>Hi everyone,</p>
                      let's consider the example:
                      <p><font face="Courier New, Courier, monospace">int
                          foo(int p) {</font></p>
                      <p><font face="Courier New, Courier, monospace">   
                          if ( p)</font></p>
                      <p><font face="Courier New, Courier, monospace">      
                          /* code path#1 */<br>
                        </font></p>
                      <p><font face="Courier New, Courier, monospace">   
                              return 0;</font></p>
                      <p><font face="Courier New, Courier, monospace">    
                          else    {</font></p>
                      <p><font face="Courier New, Courier, monospace">       
                          /* code path#2 */<br>
                        </font></p>
                      <p><font face="Courier New, Courier, monospace">   
                              return 1;<br>
                        </font></p>
                      <p><font face="Courier New, Courier, monospace">   
                          }</font></p>
                      <p><font face="Courier New, Courier, monospace">}<br>
                        </font></p>
                      <p>1. What is the best solution to get the string
                        representation of the expression of a return
                        statement?</p>
                      <p>2. Because I want to perform some
                        transformation with return statements I have to
                        figure out if they are enclosed in a block? <br>
                      </p>
                      <p>The example above should be transformed in
                        something like<br>
                      </p>
                      <p><font face="Courier New, Courier, monospace">int
                          foo(int p) {</font></p>
                      <p><font face="Courier New, Courier, monospace">   
                          if ( p) { /* <---- */<br>
                        </font></p>
                      <p><font face="Courier New, Courier, monospace">      
                          /* do some processing ... */<br>
                        </font></p>
                      <p><font face="Courier New, Courier, monospace">     
                            return 0;</font></p>
                      <p><font face="Courier New, Courier, monospace">    
                          } /* <--- */<br>
                        </font></p>
                      <p><font face="Courier New, Courier, monospace">    
                          else    {</font></p>
                      <p><font face="Courier New, Courier, monospace">      
                          /* do some processing ... */<br>
                        </font></p>
                      <font face="Courier New, Courier, monospace">   
                            return 1;<br>
                      </font>
                      <p><font face="Courier New, Courier, monospace">   
                          }</font></p>
                      <p><font face="Courier New, Courier, monospace">}<br>
                        </font></p>
                      Any hints or pointers are welcome.<br>
                      <p>Thanks</p>
                      <p>Marcel<br>
                      </p>
                    </div>
                    _______________________________________________<br>
                    cfe-dev mailing list<br>
                    <a href="mailto:cfe-dev@lists.llvm.org"
                      target="_blank" moz-do-not-send="true">cfe-dev@lists.llvm.org</a><br>
                    <a
                      href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev"
                      rel="noreferrer" target="_blank"
                      moz-do-not-send="true">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
                  </blockquote>
                </div>
              </blockquote>
              <br>
            </div>
          </blockquote>
        </div>
      </div>
    </blockquote>
    <br>
  </body>
</html>