clang 20.0.0git
|
Replace an if-statement bound to Id
with the outdented text of its body, choosing the consequent or the alternative based on whether PickTrueBranch
is true.
More...
#include "clang/Tooling/RefactoringCallbacks.h"
Public Member Functions | |
ReplaceIfStmtWithItsBody (StringRef Id, bool PickTrueBranch) | |
void | run (const ast_matchers::MatchFinder::MatchResult &Result) override |
Called on every match by the MatchFinder . | |
Public Member Functions inherited from clang::tooling::RefactoringCallback | |
RefactoringCallback () | |
Replacements & | getReplacements () |
Public Member Functions inherited from clang::ast_matchers::MatchFinder::MatchCallback | |
virtual | ~MatchCallback () |
virtual void | run (const MatchResult &Result)=0 |
Called on every match by the MatchFinder . | |
virtual void | onStartOfTranslationUnit () |
Called at the start of each translation unit. | |
virtual void | onEndOfTranslationUnit () |
Called at the end of each translation unit. | |
virtual StringRef | getID () const |
An id used to group the matchers. | |
virtual std::optional< TraversalKind > | getCheckTraversalKind () const |
TraversalKind to use while matching and processing the result nodes. | |
Additional Inherited Members | |
Protected Attributes inherited from clang::tooling::RefactoringCallback | |
Replacements | Replace |
Replace an if-statement bound to Id
with the outdented text of its body, choosing the consequent or the alternative based on whether PickTrueBranch
is true.
Definition at line 126 of file RefactoringCallbacks.h.
clang::tooling::ReplaceIfStmtWithItsBody::ReplaceIfStmtWithItsBody | ( | StringRef | Id, |
bool | PickTrueBranch | ||
) |
Definition at line 122 of file RefactoringCallbacks.cpp.
|
overridevirtual |
Called on every match by the MatchFinder
.
Implements clang::ast_matchers::MatchFinder::MatchCallback.
Definition at line 126 of file RefactoringCallbacks.cpp.
References clang::tooling::Replacements::add(), Node, clang::tooling::RefactoringCallback::Replace, clang::tooling::replaceStmtWithStmt(), clang::tooling::replaceStmtWithText(), and clang::Result.