Suggestion on how to accomplish a "function porting"

I'm a newbie with libtooling and I managed to "tweak" a cpp function (let's
call it function1()) through Preprocessor and ASFrontEnd actions. Now the
function is ready and I'd like to have a second cpp function (function2())
which resides into another cpp file, call it.

I'm thinking how I might do this: the solutions I see for now are either
"text-pasting" the entire file which contains function1() right before
function2() (I don't quite like this solution, plus there are no guarantees
that things won't conflict with each other if there's something static) or
find the include directives and types for function1(), insert them right
before function2() and have function2() call function1() through an external
declaration.

Not sure if I explained my tricky goal, if not I'll try to make it simpler.