<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body 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>
<br>
BTW: Your presentation at the EURO LLVM was very helpful!<br>
<br>
Greetings from Munich<br>
<br>
Marcel<br>
<br>
<br>
<br>
<div class="moz-cite-prefix">Am 01.08.2017 um 12:16 schrieb Manuel
Klimek:<br>
</div>
<blockquote type="cite"
cite="mid:CAOsfVvnBLbf9=OhRs5wO+q116EBX8nSXnv8TwmQoSrViQszEKQ@mail.gmail.com">
<div dir="ltr">
<div>You'll probably want to take a look at libtooling:</div>
<a href="https://clang.llvm.org/docs/LibTooling.html"
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"
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>
</body>
</html>