I am currently writing a new refactoring action rule under this bug:
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 :
- What does the function SourceChangeRefactoringRule::initiate does? I can’t find documentation that talks about it
- 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.