]> granicus.if.org Git - clang/commitdiff
Rename isA to isSameOrDerivedFrom.
authorDaniel Jasper <djasper@google.com>
Wed, 12 Sep 2012 21:14:15 +0000 (21:14 +0000)
committerDaniel Jasper <djasper@google.com>
Wed, 12 Sep 2012 21:14:15 +0000 (21:14 +0000)
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163740 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/ASTMatchers/ASTMatchers.h
unittests/ASTMatchers/ASTMatchersTest.cpp

index 91a3ecfd492798f3cef2ca5e7dd360044d493023..19fac18ef2c20386568e1c4718a22b3434c441cd 100644 (file)
@@ -1139,14 +1139,17 @@ inline internal::Matcher<CXXRecordDecl> isDerivedFrom(StringRef BaseName) {
 
 /// \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
index 55e22e927a0a5151a4a3b2fbf8d98fcf902223aa..8b41c969ba7d387197212b2f5591bffba3006089 100644 (file)
@@ -106,7 +106,7 @@ TEST(DeclarationMatcher, ClassIsDerived) {
   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));