diff options
author | Edwin Vane <edwin.vane@intel.com> | 2013-02-25 14:09:28 +0000 |
---|---|---|
committer | Edwin Vane <edwin.vane@intel.com> | 2013-02-25 14:09:28 +0000 |
commit | 1b354b868c1aa227619d81e299fe6e384e1999b7 (patch) | |
tree | 41184cdfddd2b7a9fea5f685e84ba56fd9f2ecad | |
parent | 0b6f23a23c55b7024e7a0edca1fecf9bd4c380a1 (diff) |
Reverting r176019. Corrupt patch.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176021 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/clang/ASTMatchers/ASTMatchersInternal.h | 32 | ||||
-rw-r--r-- | unittests/ASTMatchers/ASTMatchersTest.cpp | 6 |
2 files changed, 2 insertions, 36 deletions
diff --git a/include/clang/ASTMatchers/ASTMatchersInternal.h b/include/clang/ASTMatchers/ASTMatchersInternal.h index cdbde76247..e18e325942 100644 --- a/include/clang/ASTMatchers/ASTMatchersInternal.h +++ b/include/clang/ASTMatchers/ASTMatchersInternal.h @@ -353,23 +353,6 @@ inline Matcher<T> makeMatcher(MatcherInterface<T> *Implementation) { return Matcher<T>(Implementation); } -/// \brief Metafunction to determine if type T has a member called getDecl. -template <typename T> struct has_getDecl { - struct Default { int getDecl; }; - struct Derived : T, Default { }; - - template<typename C, C> struct CheckT; - - // If T::getDecl exists, an ambiguity arises and CheckT will - // not be instantiable. This makes f(...) the only available - // overload. - template<typename C> - static char (&f(CheckT<int Default::*, &C::getDecl>*))[1]; - template<typename C> static char (&f(...))[2]; - - static bool const value = sizeof(f<Derived>(0)) == 2; -}; - /// \brief Matches declarations for QualType and CallExpr. /// /// Type argument DeclMatcherT is required by PolymorphicMatcherWithParam1 but @@ -393,13 +376,11 @@ private: /// \brief If getDecl exists as a member of U, returns whether the inner /// matcher matches Node.getDecl(). template <typename U> - bool matchesSpecialized( - const U &Node, ASTMatchFinder *Finder, BoundNodesTreeBuilder *Builder, - typename llvm::enable_if<has_getDecl<U>, int>::type = 0) const { + bool matchesSpecialized(const U &Node, ASTMatchFinder *Finder, + BoundNodesTreeBuilder *Builder) const { return matchesDecl(Node.getDecl(), Finder, Builder); } - /// \brief Extracts the CXXRecordDecl or EnumDecl of a QualType and returns /// whether the inner matcher matches on it. bool matchesSpecialized(const QualType &Node, ASTMatchFinder *Finder, @@ -412,15 +393,6 @@ private: return matchesDecl(Node->getAsCXXRecordDecl(), Finder, Builder); } - /// \brief Gets the TemplateDecl from a TemplateSpecializationType - /// and returns whether the inner matches on it. - bool matchesSpecialized(const TemplateSpecializationType &Node, - ASTMatchFinder *Finder, - BoundNodesTreeBuilder *Builder) const { - return matchesDecl(Node.getTemplateName().getAsTemplateDecl(), - Finder, Buidler); - } - /// \brief Extracts the Decl of the callee of a CallExpr and returns whether /// the inner matcher matches on it. bool matchesSpecialized(const CallExpr &Node, ASTMatchFinder *Finder, diff --git a/unittests/ASTMatchers/ASTMatchersTest.cpp b/unittests/ASTMatchers/ASTMatchersTest.cpp index a759df9070..63017473f4 100644 --- a/unittests/ASTMatchers/ASTMatchersTest.cpp +++ b/unittests/ASTMatchers/ASTMatchersTest.cpp @@ -818,12 +818,6 @@ TEST(HasDeclaration, HasDeclarationOfEnumType) { qualType(hasDeclaration(enumDecl(hasName("X"))))))))); } -TEST(HasDeclaration, HasGetDeclTraitTest) { - EXPECT_TRUE(internal::has_getDecl<TypedefType>::value); - EXPECT_TRUE(internal::has_getDecl<RecordType>::value); - EXPECT_FALSE(internal::has_getDecl<TemplateSpecializationType>::value); -} - TEST(HasDeclaration, HasDeclarationOfTypeWithDecl) { EXPECT_TRUE(matches("typedef int X; X a;", varDecl(hasName("a"), |