From b9ea09c4451cb8f33ffd41d22b7dd10e8a68c5c8 Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date: Thu, 17 Sep 2015 13:31:25 +0000 Subject: Refactors AST matching code to use the new AST matcher names. This patch correlates to r247885 which performs the AST matcher rename in Clang. llvm-svn: 247886 --- .../clang-tidy/modernize/LoopConvertCheck.cpp | 35 +++++++++++----------- 1 file changed, 18 insertions(+), 17 deletions(-) (limited to 'clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp') diff --git a/clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp b/clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp index 73d93e33ce0..15ca113f6da 100644 --- a/clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp +++ b/clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp @@ -112,7 +112,8 @@ StatementMatcher makeArrayLoopMatcher() { /// - If the end iterator variable 'g' is defined, it is the same as 'f'. StatementMatcher makeIteratorLoopMatcher() { StatementMatcher BeginCallMatcher = - memberCallExpr(argumentCountIs(0), callee(methodDecl(hasName("begin")))) + cxxMemberCallExpr(argumentCountIs(0), + callee(cxxMethodDecl(hasName("begin")))) .bind(BeginCallName); DeclarationMatcher InitDeclMatcher = @@ -125,8 +126,8 @@ StatementMatcher makeIteratorLoopMatcher() { DeclarationMatcher EndDeclMatcher = varDecl(hasInitializer(anything())).bind(EndVarName); - StatementMatcher EndCallMatcher = - memberCallExpr(argumentCountIs(0), callee(methodDecl(hasName("end")))); + StatementMatcher EndCallMatcher = cxxMemberCallExpr( + argumentCountIs(0), callee(cxxMethodDecl(hasName("end")))); StatementMatcher IteratorBoundMatcher = expr(anyOf(ignoringParenImpCasts( @@ -139,15 +140,15 @@ StatementMatcher makeIteratorLoopMatcher() { ignoringParenImpCasts(declRefExpr(to(varDecl().bind(ConditionVarName))))); StatementMatcher OverloadedNEQMatcher = - operatorCallExpr(hasOverloadedOperatorName("!="), argumentCountIs(2), - hasArgument(0, IteratorComparisonMatcher), - hasArgument(1, IteratorBoundMatcher)); + cxxOperatorCallExpr(hasOverloadedOperatorName("!="), argumentCountIs(2), + hasArgument(0, IteratorComparisonMatcher), + hasArgument(1, IteratorBoundMatcher)); // This matcher tests that a declaration is a CXXRecordDecl that has an // overloaded operator*(). If the operator*() returns by value instead of by // reference then the return type is tagged with DerefByValueResultName. internal::Matcher TestDerefReturnsByValue = - hasType(recordDecl(hasMethod(allOf( + hasType(cxxRecordDecl(hasMethod(allOf( hasOverloadedOperatorName("*"), anyOf( // Tag the return type if it's by value. @@ -178,7 +179,7 @@ StatementMatcher makeIteratorLoopMatcher() { hasUnaryOperand(declRefExpr( to(varDecl(hasType(pointsTo(AnyType))) .bind(IncrementVarName))))), - operatorCallExpr( + cxxOperatorCallExpr( hasOverloadedOperatorName("++"), hasArgument( 0, declRefExpr(to(varDecl(TestDerefReturnsByValue) @@ -229,20 +230,20 @@ StatementMatcher makePseudoArrayLoopMatcher() { // are also allowed. TypeMatcher RecordWithBeginEnd = qualType( anyOf(qualType(isConstQualified(), - hasDeclaration(recordDecl( - hasMethod(methodDecl(hasName("begin"), isConst())), - hasMethod(methodDecl(hasName("end"), - isConst())))) // hasDeclaration - ), // qualType + hasDeclaration(cxxRecordDecl( + hasMethod(cxxMethodDecl(hasName("begin"), isConst())), + hasMethod(cxxMethodDecl(hasName("end"), + isConst())))) // hasDeclaration + ), // qualType qualType(unless(isConstQualified()), hasDeclaration( - recordDecl(hasMethod(hasName("begin")), - hasMethod(hasName("end"))))) // qualType + cxxRecordDecl(hasMethod(hasName("begin")), + hasMethod(hasName("end"))))) // qualType )); - StatementMatcher SizeCallMatcher = memberCallExpr( + StatementMatcher SizeCallMatcher = cxxMemberCallExpr( argumentCountIs(0), - callee(methodDecl(anyOf(hasName("size"), hasName("length")))), + callee(cxxMethodDecl(anyOf(hasName("size"), hasName("length")))), on(anyOf(hasType(pointsTo(RecordWithBeginEnd)), hasType(RecordWithBeginEnd)))); -- cgit v1.2.3