how to clang Replacements

Hi *,
I am working on a tool allowing to modify C++ source code (refactoring). I read in [1] that RefactoringTools is not the best choice in terms of performance, my codebase is quite huge. So I ended up with an implementation leveraging on clang Replacements, w/o RefactoringTools.
I have read code in [2] to figure out how to use such Replacements in ClangTool but I didn’t get so much.
Could anyone point me out an example of how to use Replacements to rewrite/insert code (i.e., adding an include line at the beginning) without leveraging on RefactoringTool? I posted my demo code here [3]

thank you and happy hacking!

[1] https://chromium.googlesource.com/chromium/src/+/lkcr/docs/clang_tool_refactoring.md
[2] https://github.com/llvm-mirror/clang-tools-extra/blob/master/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp

[3] https://gist.github.com/vaioco/3ba0fbf2b0389eac47bb8c9012e83abf