I have a compound statement representing the following block of code
{
int a = 3;
foo(a);
a = 4;
foo(a);
a = 5;
}
I want to create another compound statement which contains the first 2 statements of the original one and looks like this:
{
int a = 3;
foo(a);
}
And then another one containing the following 2 statements:
{
a = 4;
foo(a);
}
I have the call to foo(a)
as clang::CallExpr
.
The only idea I have so far is too iterate over the original compound statement and fill the other compound statement until foo(a)
is found. But the API doesn't seem to have a possibility to compare statements.
Any better ideas?