<div dir="ltr">I don't think you can do much better than using a regular expression and treating your file as plain text... But why are you trying to transform ill-formed code?</div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Tue, Jul 15, 2014 at 4:27 PM, Sourav Mukherjee <span dir="ltr"><<a href="mailto:sourav.mukherjee619@gmail.com" target="_blank">sourav.mukherjee619@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
replying to all :-<br>
<div class="">suppose i have a piece of code :-<br>
if(y) //y is not declared<br>
cout<<1;<br>
<br>
my code cannot transform it to:-<br>
if(y)<br>
{<br>
//entering if condition y<br>
<br>
//leaving if condition y<br>
}<br>
<br>
After debuging , the reason i can think for this is that it happens as<br>
the variable is undefined .<br>
how can i ensure this ? I have written my code inside visit if statement class .<br>
<br>
</div>Nikola Smiljanic's reply:-<br>
<br>
11:49 AM<br>
<br>
<br>
cfe-dev<br>
<div class="">You forgot to reply to all, adding cfe-dev<br>
<br>
I don't think that you can transform invalid code, there's no ast for<br>
it as you've noticed, but this is not surprising. You have to make<br>
sure your code compiles, someone will correct me if I'm wrong.<br>
<br>
<br>
</div>Is there any other approach with using clang that such kind of<br>
transformations can be done ?<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
On Tue, Jul 15, 2014 at 11:49 AM, Nikola Smiljanic <<a href="mailto:popizdeh@gmail.com">popizdeh@gmail.com</a>> wrote:<br>
> You forgot to reply to all, adding cfe-dev<br>
><br>
> I don't think that you can transform invalid code, there's no ast for it as<br>
> you've noticed, but this is not surprising. You have to make sure your code<br>
> compiles, someone will correct me if I'm wrong.<br>
><br>
><br>
> On Tue, Jul 15, 2014 at 4:13 PM, Sourav Mukherjee<br>
> <<a href="mailto:sourav.mukherjee619@gmail.com">sourav.mukherjee619@gmail.com</a>> wrote:<br>
>><br>
>> suppose i have a piece of code :-<br>
>> if(y) //y is not declared<br>
>> cout<<1;<br>
>><br>
>> my code cannot transform it to:-<br>
>> if(y)<br>
>> {<br>
>> //entering if condition y<br>
>><br>
>> //leaving if condition y<br>
>> }<br>
>><br>
>> After debuging , the reason i can think for this is that it happens as<br>
>> the variable is undefined .<br>
>> how can i ensure this ? I have written my code inside visit if statement<br>
>> class .<br>
>><br>
>> On Tue, Jul 15, 2014 at 11:16 AM, Nikola Smiljanic <<a href="mailto:popizdeh@gmail.com">popizdeh@gmail.com</a>><br>
>> wrote:<br>
>> > Disable something that doesn't happen? That sounds strange, wouldn't you<br>
>> > say<br>
>> > :)? What exactly are you trying to achieve?<br>
>> ><br>
>> > Nikola<br>
>> ><br>
>> ><br>
>> > On Tue, Jul 15, 2014 at 3:21 PM, Sourav Mukherjee<br>
>> > <<a href="mailto:sourav.mukherjee619@gmail.com">sourav.mukherjee619@gmail.com</a>> wrote:<br>
>> >><br>
>> >> As i have seen that parse trees segments are not created for segments<br>
>> >> that have errors. Is there any way to disable that ?<br>
>> >> _______________________________________________<br>
>> >> cfe-dev mailing list<br>
>> >> <a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
>> >> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
>> ><br>
>> ><br>
><br>
><br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
</div></div></blockquote></div><br></div>