From b61d087d4044a4c53bffc7072b4adb9306bd0466 Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Mon, 18 Feb 2013 19:04:16 +0000 Subject: [PATCH] Clean up last use of dyn_cast on TypeLoc in ASTMatchers llvm-svn: 175454 --- clang/include/clang/ASTMatchers/ASTMatchersMacros.h | 6 +++--- clang/unittests/ASTMatchers/ASTMatchersTest.cpp | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/clang/include/clang/ASTMatchers/ASTMatchersMacros.h b/clang/include/clang/ASTMatchers/ASTMatchersMacros.h index b2629c6..f5ca26b 100644 --- a/clang/include/clang/ASTMatchers/ASTMatchersMacros.h +++ b/clang/include/clang/ASTMatchers/ASTMatchersMacros.h @@ -273,9 +273,9 @@ /// \brief Creates a variadic matcher for both a specific \c Type as well as /// the corresponding \c TypeLoc. #define AST_TYPE_MATCHER(NodeType, MatcherName) \ - const internal::VariadicDynCastAllOfMatcher MatcherName; \ - const internal::VariadicDynCastAllOfMatcher MatcherName##Loc + const internal::VariadicDynCastAllOfMatcher MatcherName +// FIXME: add a matcher for TypeLoc derived classes using its custom casting +// API (no longer dyn_cast) if/when we need such matching /// \brief AST_TYPE_TRAVERSE_MATCHER(MatcherName, FunctionName) defines /// the matcher \c MatcherName that can be used to traverse from one \c Type diff --git a/clang/unittests/ASTMatchers/ASTMatchersTest.cpp b/clang/unittests/ASTMatchers/ASTMatchersTest.cpp index 129f90f..608e747 100644 --- a/clang/unittests/ASTMatchers/ASTMatchersTest.cpp +++ b/clang/unittests/ASTMatchers/ASTMatchersTest.cpp @@ -673,7 +673,7 @@ TEST(HasDescendant, MatchesDescendantsOfTypes) { qualType(hasDescendant( pointerType(pointee(builtinType())))))); EXPECT_TRUE(matches("void f() { int*** i; }", - typeLoc(hasDescendant(builtinTypeLoc())))); + typeLoc(hasDescendant(loc(builtinType()))))); EXPECT_TRUE(matchAndVerifyResultTrue( "void f() { int*** i; }", @@ -3279,7 +3279,7 @@ TEST(TypeMatching, PointerTypes) { // new VerifyIdIsBoundTo("loc", 1))); EXPECT_TRUE(matches( "int** a;", - pointerTypeLoc(pointeeLoc(loc(qualType()))))); + loc(pointerType(pointee(qualType()))))); EXPECT_TRUE(matches( "int** a;", loc(pointerType(pointee(pointerType()))))); @@ -3324,7 +3324,7 @@ TEST(TypeMatching, PointeeTypes) { EXPECT_TRUE(matches("int *a;", pointerType(pointee(builtinType())))); EXPECT_TRUE(matches("int *a;", - pointerTypeLoc(pointeeLoc(loc(builtinType()))))); + loc(pointerType(pointee(builtinType()))))); EXPECT_TRUE(matches( "int const *A;", @@ -3338,10 +3338,10 @@ TEST(TypeMatching, MatchesPointersToConstTypes) { EXPECT_TRUE(matches("int b; int * const a = &b;", loc(pointerType()))); EXPECT_TRUE(matches("int b; int * const a = &b;", - pointerTypeLoc())); + loc(pointerType()))); EXPECT_TRUE(matches( "int b; const int * a = &b;", - pointerTypeLoc(pointeeLoc(builtinTypeLoc())))); + loc(pointerType(pointee(builtinType()))))); EXPECT_TRUE(matches( "int b; const int * a = &b;", pointerType(pointee(builtinType())))); -- 2.7.4