aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2012-09-12 21:14:15 +0000
committerDaniel Jasper <djasper@google.com>2012-09-12 21:14:15 +0000
commit63d88728d862f8a69b3291e533d193d1d8513f5a (patch)
tree4f68ae434cbc71dcd927789db884efc05dac7e6b
parent00024796eaa29055e76fc99ffdc668c702e6fe9d (diff)
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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163740 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/ASTMatchers/ASTMatchers.h11
-rw-r--r--unittests/ASTMatchers/ASTMatchersTest.cpp2
2 files changed, 8 insertions, 5 deletions
diff --git a/include/clang/ASTMatchers/ASTMatchers.h b/include/clang/ASTMatchers/ASTMatchers.h
index 91a3ecfd49..19fac18ef2 100644
--- a/include/clang/ASTMatchers/ASTMatchers.h
+++ b/include/clang/ASTMatchers/ASTMatchers.h
@@ -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
diff --git a/unittests/ASTMatchers/ASTMatchersTest.cpp b/unittests/ASTMatchers/ASTMatchersTest.cpp
index 55e22e927a..8b41c969ba 100644
--- a/unittests/ASTMatchers/ASTMatchersTest.cpp
+++ b/unittests/ASTMatchers/ASTMatchersTest.cpp
@@ -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));