0

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?

Ruup
  • 177
  • 2
  • 8
  • I'm sure you mean `int a = 4;` as the first statement in the second compound statement? – 5gon12eder Nov 09 '15 at 16:22
  • @5gon12eder I don't know yet if I care. Maybe I will. For now, I just want to split that compound statement. – Ruup Nov 09 '15 at 16:28

0 Answers0