|
@@ -39,7 +39,7 @@ ReplaceStmtWithText::ReplaceStmtWithText(StringRef FromId, StringRef ToText)
|
|
|
|
|
|
void ReplaceStmtWithText::run(
|
|
void ReplaceStmtWithText::run(
|
|
const ast_matchers::MatchFinder::MatchResult &Result) {
|
|
const ast_matchers::MatchFinder::MatchResult &Result) {
|
|
- if (const Stmt *FromMatch = Result.Nodes.getStmtAs<Stmt>(FromId)) {
|
|
|
|
|
|
+ if (const Stmt *FromMatch = Result.Nodes.getNodeAs<Stmt>(FromId)) {
|
|
auto Err = Replace.add(tooling::Replacement(
|
|
auto Err = Replace.add(tooling::Replacement(
|
|
*Result.SourceManager,
|
|
*Result.SourceManager,
|
|
CharSourceRange::getTokenRange(FromMatch->getSourceRange()), ToText));
|
|
CharSourceRange::getTokenRange(FromMatch->getSourceRange()), ToText));
|
|
@@ -56,8 +56,8 @@ ReplaceStmtWithStmt::ReplaceStmtWithStmt(StringRef FromId, StringRef ToId)
|
|
|
|
|
|
void ReplaceStmtWithStmt::run(
|
|
void ReplaceStmtWithStmt::run(
|
|
const ast_matchers::MatchFinder::MatchResult &Result) {
|
|
const ast_matchers::MatchFinder::MatchResult &Result) {
|
|
- const Stmt *FromMatch = Result.Nodes.getStmtAs<Stmt>(FromId);
|
|
|
|
- const Stmt *ToMatch = Result.Nodes.getStmtAs<Stmt>(ToId);
|
|
|
|
|
|
+ const Stmt *FromMatch = Result.Nodes.getNodeAs<Stmt>(FromId);
|
|
|
|
+ const Stmt *ToMatch = Result.Nodes.getNodeAs<Stmt>(ToId);
|
|
if (FromMatch && ToMatch) {
|
|
if (FromMatch && ToMatch) {
|
|
auto Err = Replace.add(
|
|
auto Err = Replace.add(
|
|
replaceStmtWithStmt(*Result.SourceManager, *FromMatch, *ToMatch));
|
|
replaceStmtWithStmt(*Result.SourceManager, *FromMatch, *ToMatch));
|
|
@@ -75,7 +75,7 @@ ReplaceIfStmtWithItsBody::ReplaceIfStmtWithItsBody(StringRef Id,
|
|
|
|
|
|
void ReplaceIfStmtWithItsBody::run(
|
|
void ReplaceIfStmtWithItsBody::run(
|
|
const ast_matchers::MatchFinder::MatchResult &Result) {
|
|
const ast_matchers::MatchFinder::MatchResult &Result) {
|
|
- if (const IfStmt *Node = Result.Nodes.getStmtAs<IfStmt>(Id)) {
|
|
|
|
|
|
+ if (const IfStmt *Node = Result.Nodes.getNodeAs<IfStmt>(Id)) {
|
|
const Stmt *Body = PickTrueBranch ? Node->getThen() : Node->getElse();
|
|
const Stmt *Body = PickTrueBranch ? Node->getThen() : Node->getElse();
|
|
if (Body) {
|
|
if (Body) {
|
|
auto Err =
|
|
auto Err =
|