Any way to disable typechecking while creating parse-tree for libtooling

As i have seen that parse trees segments are not created for segments
that have errors. Is there any way to disable that ?

Disable something that doesn’t happen? That sounds strange, wouldn’t you say :)? What exactly are you trying to achieve?

Nikola

You forgot to reply to all, adding cfe-dev

I don’t think that you can transform invalid code, there’s no ast for it as you’ve noticed, but this is not surprising. You have to make sure your code compiles, someone will correct me if I’m wrong.

replying to all :-
suppose i have a piece of code :-
if(y) //y is not declared
    cout<<1;

my code cannot transform it to:-
if(y)
{
     //entering if condition y

    //leaving if condition y
}

After debuging , the reason i can think for this is that it happens as
the variable is undefined .
how can i ensure this ? I have written my code inside visit if statement class .

Nikola Smiljanic's reply:-

11:49 AM

cfe-dev
You forgot to reply to all, adding cfe-dev

I don't think that you can transform invalid code, there's no ast for
it as you've noticed, but this is not surprising. You have to make
sure your code compiles, someone will correct me if I'm wrong.

Is there any other approach with using clang that such kind of
transformations can be done ?

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?

The header files are not there that is why it is transforming some
functions and not transforming some . That is the problem I am facing
as the incorrect portions are not there in the parse tree. Is there
any work around ?