r289543 - Remove deprecated methods ast_matchers::BoundNodes::{getStmtAs, getDeclAs}

Alexander Kornienko via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 13 08:19:35 PST 2016


Author: alexfh
Date: Tue Dec 13 10:19:34 2016
New Revision: 289543

URL: http://llvm.org/viewvc/llvm-project?rev=289543&view=rev
Log:
Remove deprecated methods ast_matchers::BoundNodes::{getStmtAs,getDeclAs}

Modified:
    cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
    cfe/trunk/lib/Tooling/RefactoringCallbacks.cpp
    cfe/trunk/unittests/AST/DeclPrinterTest.cpp
    cfe/trunk/unittests/AST/StmtPrinterTest.cpp

Modified: cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h?rev=289543&r1=289542&r2=289543&view=diff
==============================================================================
--- cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h (original)
+++ cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h Tue Dec 13 10:19:34 2016
@@ -75,18 +75,6 @@ public:
     return MyBoundNodes.getNodeAs<T>(ID);
   }
 
-  /// \brief Deprecated. Please use \c getNodeAs instead.
-  /// @{
-  template <typename T>
-  const T *getDeclAs(StringRef ID) const {
-    return getNodeAs<T>(ID);
-  }
-  template <typename T>
-  const T *getStmtAs(StringRef ID) const {
-    return getNodeAs<T>(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

Modified: cfe/trunk/lib/Tooling/RefactoringCallbacks.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/RefactoringCallbacks.cpp?rev=289543&r1=289542&r2=289543&view=diff
==============================================================================
--- cfe/trunk/lib/Tooling/RefactoringCallbacks.cpp (original)
+++ cfe/trunk/lib/Tooling/RefactoringCallbacks.cpp Tue Dec 13 10:19:34 2016
@@ -39,7 +39,7 @@ ReplaceStmtWithText::ReplaceStmtWithText
 
 void ReplaceStmtWithText::run(
     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(
         *Result.SourceManager,
         CharSourceRange::getTokenRange(FromMatch->getSourceRange()), ToText));
@@ -56,8 +56,8 @@ ReplaceStmtWithStmt::ReplaceStmtWithStmt
 
 void ReplaceStmtWithStmt::run(
     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) {
     auto Err = Replace.add(
         replaceStmtWithStmt(*Result.SourceManager, *FromMatch, *ToMatch));
@@ -75,7 +75,7 @@ ReplaceIfStmtWithItsBody::ReplaceIfStmtW
 
 void ReplaceIfStmtWithItsBody::run(
     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();
     if (Body) {
       auto Err =

Modified: cfe/trunk/unittests/AST/DeclPrinterTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/AST/DeclPrinterTest.cpp?rev=289543&r1=289542&r2=289543&view=diff
==============================================================================
--- cfe/trunk/unittests/AST/DeclPrinterTest.cpp (original)
+++ cfe/trunk/unittests/AST/DeclPrinterTest.cpp Tue Dec 13 10:19:34 2016
@@ -45,7 +45,7 @@ public:
   PrintMatch() : NumFoundDecls(0) {}
 
   void run(const MatchFinder::MatchResult &Result) override {
-    const Decl *D = Result.Nodes.getDeclAs<Decl>("id");
+    const Decl *D = Result.Nodes.getNodeAs<Decl>("id");
     if (!D || D->isImplicit())
       return;
     NumFoundDecls++;

Modified: cfe/trunk/unittests/AST/StmtPrinterTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/AST/StmtPrinterTest.cpp?rev=289543&r1=289542&r2=289543&view=diff
==============================================================================
--- cfe/trunk/unittests/AST/StmtPrinterTest.cpp (original)
+++ cfe/trunk/unittests/AST/StmtPrinterTest.cpp Tue Dec 13 10:19:34 2016
@@ -45,7 +45,7 @@ public:
   PrintMatch() : NumFoundStmts(0) {}
 
   void run(const MatchFinder::MatchResult &Result) override {
-    const Stmt *S = Result.Nodes.getStmtAs<Stmt>("id");
+    const Stmt *S = Result.Nodes.getNodeAs<Stmt>("id");
     if (!S)
       return;
     NumFoundStmts++;




More information about the cfe-commits mailing list