Author: djasper Date: Wed Sep 12 16:14:15 2012 New Revision: 163740 URL: http://llvm.org/viewvc/llvm-project?rev=163740&view=rev Log: Rename isA to isSameOrDerivedFrom.
There are two evils we can choose from: - Name overlap between isA-matcher and llvm::isa<>() - Bad name for what the isA-matcher currently does After some discussion we have agreed to go with the latter evil. Review: http://llvm-reviews.chandlerc.com/D40 Modified: cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp Modified: cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h?rev=163740&r1=163739&r2=163740&view=diff ============================================================================== --- cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h (original) +++ cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h Wed Sep 12 16:14:15 2012 @@ -1139,14 +1139,17 @@ /// \brief Similar to \c isDerivedFrom(), but also matches classes that directly /// match \c Base. -inline internal::Matcher<CXXRecordDecl> isA(internal::Matcher<NamedDecl> Base) { +inline internal::Matcher<CXXRecordDecl> isSameOrDerivedFrom( + internal::Matcher<NamedDecl> Base) { return anyOf(Base, isDerivedFrom(Base)); } -/// \brief Overloaded method as shortcut for \c isA(hasName(...)). -inline internal::Matcher<CXXRecordDecl> isA(StringRef BaseName) { +/// \brief Overloaded method as shortcut for +/// \c isSameOrDerivedFrom(hasName(...)). +inline internal::Matcher<CXXRecordDecl> isSameOrDerivedFrom( + StringRef BaseName) { assert(!BaseName.empty()); - return isA(hasName(BaseName)); + return isSameOrDerivedFrom(hasName(BaseName)); } /// \brief Matches AST nodes that have child AST nodes that match the Modified: cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp?rev=163740&r1=163739&r2=163740&view=diff ============================================================================== --- cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp (original) +++ cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp Wed Sep 12 16:14:15 2012 @@ -106,7 +106,7 @@ EXPECT_TRUE(notMatches("class Y;", IsDerivedFromX)); EXPECT_TRUE(notMatches("", IsDerivedFromX)); - DeclarationMatcher IsAX = recordDecl(isA("X")); + DeclarationMatcher IsAX = recordDecl(isSameOrDerivedFrom("X")); EXPECT_TRUE(matches("class X {}; class Y : public X {};", IsAX)); EXPECT_TRUE(matches("class X {};", IsAX)); _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
