<div dir="ltr">I am creating a source instrumentation tool, and although the primary mode of operation is additive in nature (which is quite a comfortable subset of general C++ source-to-source transformation), I would like to get a better handle on where things stand. <div><br></div><div>I am looking at <a href="http://clang.llvm.org/extra/doxygen/namespaceclang_1_1replace.html">http://clang.llvm.org/extra/doxygen/namespaceclang_1_1replace.html</a> and I see that this appears to have friendly code that maybe I could use to help me get helpful structures to browse and reveal any conflicts in my tool. The tool is a RecursiveASTVisitor based tool that uses AST Matchers. </div><div><br></div><div>However I find in my checked-out source tree that ApplyReplacements.h lives here: tools/clang/tools/extra/clang-apply-replacements/include/clang-apply-replacements/Tooling/ApplyReplacements.h</div><div><br></div><div>This seems kind of secluded and I am unable to find examples that use ApplyReplacements.h along with a workflow that seems to use clang tooling Replacements. </div><div><br></div><div>So at this point my deduction is that ApplyReplacements.h might be old, or some one-off code for another example tool or unit tests. Maybe Replacements is newer and I have to find something else to use with my Replacements. </div><div><br></div><div>Now I have found in here: (<a href="http://clang.llvm.org/doxygen/namespaceclang_1_1tooling.html">http://clang.llvm.org/doxygen/namespaceclang_1_1tooling.html</a>) the function </div><div><br></div><div>void clang::tooling::deduplicate(std::vector< Replacement > & Replaces, std::vector< Range > & <span class="" style="white-space:pre">      </span>Conflicts)</div><div><br></div><div>This seems promising... So I grep the llvm source tree once again for references to this function and -- lo and behold -- I am staring at the guts of ApplyReplacements.h again!! </div><div><br></div><div>Maybe I need some hints about how I can fit these puzzle pieces together. I have found that FileToReplacementMap and TUReplacements are just typedefs and I eventually traced it back to collectReplacementsFromDirectory which seems to be infiltrating replacements stored in YAML (or something to this effect). This is cool, but I guess I'm more interested in how to get to use the ApplyReplacements code with my non-YAML Replacements that are generated on the fly with my RecursiveASTVisitor.</div><div><br></div><div>Thanks for reading my question.</div><div><br></div><div>Steven</div></div>