From: Alexander Kornienko Date: Tue, 13 Dec 2016 16:19:34 +0000 (+0000) Subject: Remove deprecated methods ast_matchers::BoundNodes::{getStmtAs,getDeclAs} X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3924dfd7cf94e9d57f9bbb64b1ca34d0fafeac1a;p=clang Remove deprecated methods ast_matchers::BoundNodes::{getStmtAs,getDeclAs} git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289543 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/ASTMatchers/ASTMatchers.h b/include/clang/ASTMatchers/ASTMatchers.h index ce01f45333..f2c649aca0 100644 --- a/include/clang/ASTMatchers/ASTMatchers.h +++ b/include/clang/ASTMatchers/ASTMatchers.h @@ -75,18 +75,6 @@ public: return MyBoundNodes.getNodeAs(ID); } - /// \brief Deprecated. Please use \c getNodeAs instead. - /// @{ - template - const T *getDeclAs(StringRef ID) const { - return getNodeAs(ID); - } - template - const T *getStmtAs(StringRef ID) const { - return getNodeAs(ID); - } - /// @} - /// \brief Type of mapping from binding identifiers to bound nodes. This type /// is an associative container with a key type of \c std::string and a value /// type of \c clang::ast_type_traits::DynTypedNode diff --git a/lib/Tooling/RefactoringCallbacks.cpp b/lib/Tooling/RefactoringCallbacks.cpp index af25fd87b2..ccc67c44ae 100644 --- a/lib/Tooling/RefactoringCallbacks.cpp +++ b/lib/Tooling/RefactoringCallbacks.cpp @@ -39,7 +39,7 @@ ReplaceStmtWithText::ReplaceStmtWithText(StringRef FromId, StringRef ToText) void ReplaceStmtWithText::run( const ast_matchers::MatchFinder::MatchResult &Result) { - if (const Stmt *FromMatch = Result.Nodes.getStmtAs(FromId)) { + if (const Stmt *FromMatch = Result.Nodes.getNodeAs(FromId)) { auto Err = Replace.add(tooling::Replacement( *Result.SourceManager, CharSourceRange::getTokenRange(FromMatch->getSourceRange()), ToText)); @@ -56,8 +56,8 @@ ReplaceStmtWithStmt::ReplaceStmtWithStmt(StringRef FromId, StringRef ToId) void ReplaceStmtWithStmt::run( const ast_matchers::MatchFinder::MatchResult &Result) { - const Stmt *FromMatch = Result.Nodes.getStmtAs(FromId); - const Stmt *ToMatch = Result.Nodes.getStmtAs(ToId); + const Stmt *FromMatch = Result.Nodes.getNodeAs(FromId); + const Stmt *ToMatch = Result.Nodes.getNodeAs(ToId); if (FromMatch && ToMatch) { auto Err = Replace.add( replaceStmtWithStmt(*Result.SourceManager, *FromMatch, *ToMatch)); @@ -75,7 +75,7 @@ ReplaceIfStmtWithItsBody::ReplaceIfStmtWithItsBody(StringRef Id, void ReplaceIfStmtWithItsBody::run( const ast_matchers::MatchFinder::MatchResult &Result) { - if (const IfStmt *Node = Result.Nodes.getStmtAs(Id)) { + if (const IfStmt *Node = Result.Nodes.getNodeAs(Id)) { const Stmt *Body = PickTrueBranch ? Node->getThen() : Node->getElse(); if (Body) { auto Err = diff --git a/unittests/AST/DeclPrinterTest.cpp b/unittests/AST/DeclPrinterTest.cpp index dc4f914560..e5a09a31f6 100644 --- a/unittests/AST/DeclPrinterTest.cpp +++ b/unittests/AST/DeclPrinterTest.cpp @@ -45,7 +45,7 @@ public: PrintMatch() : NumFoundDecls(0) {} void run(const MatchFinder::MatchResult &Result) override { - const Decl *D = Result.Nodes.getDeclAs("id"); + const Decl *D = Result.Nodes.getNodeAs("id"); if (!D || D->isImplicit()) return; NumFoundDecls++; diff --git a/unittests/AST/StmtPrinterTest.cpp b/unittests/AST/StmtPrinterTest.cpp index bc7fd54e4a..12b203236c 100644 --- a/unittests/AST/StmtPrinterTest.cpp +++ b/unittests/AST/StmtPrinterTest.cpp @@ -45,7 +45,7 @@ public: PrintMatch() : NumFoundStmts(0) {} void run(const MatchFinder::MatchResult &Result) override { - const Stmt *S = Result.Nodes.getStmtAs("id"); + const Stmt *S = Result.Nodes.getNodeAs("id"); if (!S) return; NumFoundStmts++;