Questions about writing refactoring actions with LLVM

Hi,

I am currently writing a new refactoring action rule under this bug:

https://bugs.llvm.org/show_bug.cgi?id=35000

The idea is to write a new refactor action for clang-refactor that can convert a ternary operator into an if statement.

I have used LLVM and Clang before but this is my first time writing a small feature for the actual code base, so I have a few questions :

  1. What does the function SourceChangeRefactoringRule::initiate does? I can’t find documentation that talks about it
  2. How can I traverse through the whole file to find the ternary operators? Where should this traversal take place, or do the APIs already take care of it. I looked up AST matchers and I am confused as to how it can be incorporated into the refactoring action.

Thanks!
Brenda