clang 10.0.0git

Public Member Functions | List of all members
clang::tooling::ReplaceStmtWithText Class Reference

Replace the text of the statement bound to `FromId` with the text in `ToText`. More...

`#include "clang/Tooling/RefactoringCallbacks.h"`

Inheritance diagram for clang::tooling::ReplaceStmtWithText:
[legend]
Collaboration diagram for clang::tooling::ReplaceStmtWithText:
[legend]

## Public Member Functions
| ReplaceStmtWithText (StringRef FromId, StringRef ToText)
void | run (const ast_matchers::MatchFinder::MatchResult &Result) override
| Called on every match by the `MatchFinder`. More...
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 | onStartOfTranslationUnit ()
| Called at the start of each translation unit. More...
virtual void | onEndOfTranslationUnit ()
| Called at the end of each translation unit. More...
virtual StringRef | getID () const
| An id used to group the matchers. More...

## Additional Inherited Members
Protected Attributes inherited from clang::tooling::RefactoringCallback
Replacements | Replace

## Detailed Description

Replace the text of the statement bound to `FromId` with the text in `ToText`.

Definition at line 78 of file RefactoringCallbacks.h.

## Constructor & Destructor Documentation

## ◆ ReplaceStmtWithText()

clang::tooling::ReplaceStmtWithText::ReplaceStmtWithText | ( | StringRef | FromId,
|  | StringRef | ToText
| ) |  |

Definition at line 85 of file RefactoringCallbacks.cpp.

## Member Function Documentation

## ◆ run()

void clang::tooling::ReplaceStmtWithText::run | ( | const ast_matchers::MatchFinder::MatchResult & | Result | ) |
| override virtual

Called on every match by the `MatchFinder`.

Implements clang::ast_matchers::MatchFinder::MatchCallback.

Definition at line 88 of file RefactoringCallbacks.cpp.

References clang::tooling::Replacements::add(), clang::ast_matchers::BoundNodes::getNodeAs(), clang::CharSourceRange::getTokenRange(), clang::ast_matchers::MatchFinder::MatchResult::Nodes, clang::tooling::RefactoringCallback::Replace, clang::ast_matchers::MatchFinder::MatchResult::SourceManager, and toString().

The documentation for this class was generated from the following files:

- include/clang/Tooling/RefactoringCallbacks.h
- lib/Tooling/RefactoringCallbacks.cpp