<div dir="ltr">I'm interested in writing a simple refactor that will find all uses of a symbol Foo and replace it with either true or false, then simplify the conditional constructs in which they appeared.  For example, if I have some code:<div><br></div><div>if (!Foo)</div><div>{</div><div>   // Do thing A</div><div>}</div><div>else</div><div>{</div><div>    // Do thing B</div><div>}</div><div><br></div><div>And I run the tool to replace Foo with True, I would expect my refactor to transform the above block into:</div><div><br></div><div>// Do thing B</div><div><br></div><div>Similarly, if the code was:</div><div><br></div><div>if (Foo || Bar)</div><div>{</div><div>    // Do thing</div><div>}</div><div><br></div><div>and I replace Foo with true, I would expect it to transform the code into:</div><div><br></div><div>if (Bar)</div><div>{</div><div>    // Do thing</div><div>}</div><div><br></div><div><br></div><div>I've got a simple refactoring command integrated into clang-refactor, but it currently doesn't do anything other than appear in the --help output.   I've got a couple of questions:</div><div><br></div><div>1. What is the difference between clang-tidy and clang-refactor?  Conceptually I get it, clang-refactor is for "larger" stuff, but *why*?  What about clang-refactor makes it more suitable for large refactors?  I'm already a little familiar with the ASTMatcher interface, and it seems like clang-refactor doesn't make use of it, so using clang-refactor I'm sort of at ground 0 with very few examples to go off of, whereas if I were using clang-tidy I would be able to make faster progress because I'm already a little familiar with it.</div><div><br></div><div>2. What does USR mean?  I see references to this acronym all over the place in the implementation of the local-rename command, but it's not explained anywhere.  </div><div><br></div><div>3. Does the refactoring tooling in general contain sufficient information for me be able to accomplish the specific refactor I'm looking into?  And are there any other examples of refactors people have written besides local-rename and extract?</div></div>