[cfe-dev] Serializing conflicting replacements

Roman Popov via cfe-dev cfe-dev at lists.llvm.org
Wed Sep 27 11:06:43 PDT 2017


Hi all,
I need to write a tool that will convert stackful coroutine to stackless.
One of the required refactorings is inlining all functions that call yield
into a coroutine body.

Here is an example of required refactoring:

Input source code:

void foo() { /*foo*/ yield(); }

void bar() { /*bar*/  foo(); }

void coroutine_body() {
  bar();
}

Expected output code from tool:

void coroutine_body() {
   /*bar*/
   /*foo*/
   yield();
}


So when I run the tool it will create two conflicting replacements:

   - inline foo into bar
   - inline bar into coroutine_body


Is it possible to apply them one after another using current Clang
libraries?  Or it is not supported out-of-the-box and I should better run
tool N times to inline all functions one-by-one without generating
conflicting replacements?

Thanks,
Roman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170927/8fb4bf51/attachment.html>


More information about the cfe-dev mailing list