[cfe-users] how to clang Replacements

Valerio via cfe-users cfe-users at lists.llvm.org
Thu Oct 26 02:20:03 PDT 2017


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
-- 

Valerio Costamagna
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-users/attachments/20171026/5b1fad6b/attachment.html>


More information about the cfe-users mailing list