<div dir="ltr">Looking at the source some more, it looks like I can probably just write my own version of <a class="" href="http://clang.llvm.org/doxygen/namespaceclang_1_1tooling.html#ae49d080572e151d36fbcc1cd830694ec" style="color:rgb(70,101,162);font-weight:bold;font-family:'Lucida Grande',Verdana,Geneva,Arial,sans-serif;font-size:13px;line-height:16px;white-space:nowrap">clang::tooling::deduplicate</a> (line <a href="http://clang.llvm.org/doxygen/Replacement_8cpp_source.html#l00176">176</a>)</div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Mar 29, 2015 at 5:45 PM, Manuel Klimek <span dir="ltr"><<a href="mailto:klimek@google.com" target="_blank">klimek@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><span class="">On Sat, Mar 28, 2015 at 11:50 PM Steven Lu <<a href="mailto:stevenlu443@gmail.com" target="_blank">stevenlu443@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><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" target="_blank">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></blockquote><div><br></div></span><div>applyAllReplacements from include/clang/Tooling/Core/Replacement.h? </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><div dir="ltr"><div><br></div><div>Now I have found in here: (<a href="http://clang.llvm.org/doxygen/namespaceclang_1_1tooling.html" target="_blank">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 style="white-space:pre-wrap">  </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></span>
______________________________<u></u>_________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/cfe-dev</a><br>
</blockquote></div></div>
</blockquote></div><br></div>