Index: clang-tools-extra/trunk/clang-tidy/google/StringReferenceMemberCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/google/StringReferenceMemberCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/google/StringReferenceMemberCheck.cpp @@ -27,8 +27,8 @@ return; // Look for const references to std::string or ::string. - auto String = anyOf(recordDecl(hasName("::std::basic_string")), - recordDecl(hasName("::string"))); + auto String = anyOf(namedDecl(hasName("::std::string")), + namedDecl(hasName("::string"))); auto ConstString = qualType(isConstQualified(), hasDeclaration(String)); // Ignore members in template instantiations. Index: clang-tools-extra/trunk/clang-tidy/misc/DanglingHandleCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/misc/DanglingHandleCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/misc/DanglingHandleCheck.cpp @@ -71,11 +71,13 @@ // For sequences: assign, push_back, resize. cxxMemberCallExpr( callee(functionDecl(hasAnyName("assign", "push_back", "resize"))), - on(expr(hasType(recordDecl(isASequence()))))), + on(expr(hasType(hasUnqualifiedDesugaredType( + recordType(hasDeclaration(recordDecl(isASequence())))))))), // For sequences and sets: insert. - cxxMemberCallExpr( - callee(functionDecl(hasName("insert"))), - on(expr(hasType(recordDecl(anyOf(isASequence(), isASet())))))), + cxxMemberCallExpr(callee(functionDecl(hasName("insert"))), + on(expr(hasType(hasUnqualifiedDesugaredType( + recordType(hasDeclaration(recordDecl( + anyOf(isASequence(), isASet()))))))))), // For maps: operator[]. cxxOperatorCallExpr(callee(cxxMethodDecl(ofClass(isAMap()))), hasOverloadedOperatorName("[]")))); @@ -103,7 +105,8 @@ // Find 'Handle foo(ReturnsAValue());' Finder->addMatcher( - varDecl(hasType(cxxRecordDecl(IsAHandle)), + varDecl(hasType(hasUnqualifiedDesugaredType( + recordType(hasDeclaration(cxxRecordDecl(IsAHandle))))), hasInitializer( exprWithCleanups(has(ignoringParenImpCasts(ConvertedHandle))) .bind("bad_stmt"))), @@ -112,7 +115,9 @@ // Find 'Handle foo = ReturnsAValue();' Finder->addMatcher( varDecl( - hasType(cxxRecordDecl(IsAHandle)), unless(parmVarDecl()), + hasType(hasUnqualifiedDesugaredType( + recordType(hasDeclaration(cxxRecordDecl(IsAHandle))))), + unless(parmVarDecl()), hasInitializer(exprWithCleanups(has(ignoringParenImpCasts(handleFrom( IsAHandle, ConvertedHandle)))) .bind("bad_stmt"))), @@ -139,13 +144,15 @@ // We have to match both. has(ignoringImplicit(handleFrom( IsAHandle, - handleFrom(IsAHandle, declRefExpr(to(varDecl( - // Is function scope ... - hasAutomaticStorageDuration(), - // ... and it is a local array or Value. - anyOf(hasType(arrayType()), - hasType(recordDecl( - unless(IsAHandle))))))))))), + handleFrom(IsAHandle, + declRefExpr(to(varDecl( + // Is function scope ... + hasAutomaticStorageDuration(), + // ... and it is a local array or Value. + anyOf(hasType(arrayType()), + hasType(hasUnqualifiedDesugaredType( + recordType(hasDeclaration(recordDecl( + unless(IsAHandle)))))))))))))), // Temporary fix for false positives inside lambdas. unless(hasAncestor(lambdaExpr()))) .bind("bad_stmt"), Index: clang-tools-extra/trunk/clang-tidy/misc/InaccurateEraseCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/misc/InaccurateEraseCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/misc/InaccurateEraseCheck.cpp @@ -39,7 +39,8 @@ anything()))) .bind("alg"); - const auto DeclInStd = decl(isInStdNamespace()); + const auto DeclInStd = type(hasUnqualifiedDesugaredType( + tagType(hasDeclaration(decl(isInStdNamespace()))))); Finder->addMatcher( cxxMemberCallExpr( on(anyOf(hasType(DeclInStd), hasType(pointsTo(DeclInStd)))), Index: clang-tools-extra/trunk/clang-tidy/misc/UseAfterMoveCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/misc/UseAfterMoveCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/misc/UseAfterMoveCheck.cpp @@ -271,15 +271,17 @@ auto DeclRefMatcher = declRefExpr(hasDeclaration(equalsNode(MovedVariable))).bind("declref"); - auto StandardContainerTypeMatcher = hasType(cxxRecordDecl( - hasAnyName("::std::basic_string", "::std::vector", "::std::deque", - "::std::forward_list", "::std::list", "::std::set", - "::std::map", "::std::multiset", "::std::multimap", - "::std::unordered_set", "::std::unordered_map", - "::std::unordered_multiset", "::std::unordered_multimap"))); - - auto StandardSmartPointerTypeMatcher = hasType(cxxRecordDecl( - hasAnyName("::std::unique_ptr", "::std::shared_ptr", "::std::weak_ptr"))); + auto StandardContainerTypeMatcher = hasType(hasUnqualifiedDesugaredType( + recordType(hasDeclaration(cxxRecordDecl(hasAnyName( + "::std::basic_string", "::std::vector", "::std::deque", + "::std::forward_list", "::std::list", "::std::set", "::std::map", + "::std::multiset", "::std::multimap", "::std::unordered_set", + "::std::unordered_map", "::std::unordered_multiset", + "::std::unordered_multimap")))))); + + auto StandardSmartPointerTypeMatcher = hasType(hasUnqualifiedDesugaredType( + recordType(hasDeclaration(cxxRecordDecl(hasAnyName( + "::std::unique_ptr", "::std::shared_ptr", "::std::weak_ptr")))))); // Matches different types of reinitialization. auto ReinitMatcher = Index: clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertCheck.cpp @@ -161,17 +161,18 @@ // overloaded operator*(). If the operator*() returns by value instead of by // reference then the return type is tagged with DerefByValueResultName. internal::Matcher TestDerefReturnsByValue = - hasType(cxxRecordDecl(hasMethod(allOf( - hasOverloadedOperatorName("*"), - anyOf( - // Tag the return type if it's by value. - returns(qualType(unless(hasCanonicalType(referenceType()))) - .bind(DerefByValueResultName)), - returns( - // Skip loops where the iterator's operator* returns an - // rvalue reference. This is just weird. - qualType(unless(hasCanonicalType(rValueReferenceType()))) - .bind(DerefByRefResultName))))))); + hasType(hasUnqualifiedDesugaredType( + recordType(hasDeclaration(cxxRecordDecl(hasMethod(allOf( + hasOverloadedOperatorName("*"), + anyOf( + // Tag the return type if it's by value. + returns(qualType(unless(hasCanonicalType(referenceType()))) + .bind(DerefByValueResultName)), + returns( + // Skip loops where the iterator's operator* returns an + // rvalue reference. This is just weird. + qualType(unless(hasCanonicalType(rValueReferenceType()))) + .bind(DerefByRefResultName)))))))))); return forStmt( unless(isInTemplateInstantiation()), @@ -242,16 +243,17 @@ // functions called begin() and end() taking the container as an argument // are also allowed. TypeMatcher RecordWithBeginEnd = qualType(anyOf( - qualType(isConstQualified(), - hasDeclaration(cxxRecordDecl( - hasMethod(cxxMethodDecl(hasName("begin"), isConst())), - hasMethod(cxxMethodDecl(hasName("end"), - isConst())))) // hasDeclaration - ), // qualType qualType( - unless(isConstQualified()), - hasDeclaration(cxxRecordDecl(hasMethod(hasName("begin")), - hasMethod(hasName("end"))))) // qualType + isConstQualified(), + hasUnqualifiedDesugaredType(recordType(hasDeclaration(cxxRecordDecl( + hasMethod(cxxMethodDecl(hasName("begin"), isConst())), + hasMethod(cxxMethodDecl(hasName("end"), + isConst())))) // hasDeclaration + ))), // qualType + qualType(unless(isConstQualified()), + hasUnqualifiedDesugaredType(recordType(hasDeclaration( + cxxRecordDecl(hasMethod(hasName("begin")), + hasMethod(hasName("end"))))))) // qualType )); StatementMatcher SizeCallMatcher = cxxMemberCallExpr( Index: clang-tools-extra/trunk/clang-tidy/modernize/MakeSharedCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/modernize/MakeSharedCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/modernize/MakeSharedCheck.cpp @@ -20,10 +20,11 @@ MakeSharedCheck::SmartPtrTypeMatcher MakeSharedCheck::getSmartPointerTypeMatcher() const { - return qualType(hasDeclaration(classTemplateSpecializationDecl( - hasName("::std::shared_ptr"), templateArgumentCountIs(1), - hasTemplateArgument( - 0, templateArgument(refersToType(qualType().bind(PointerType))))))); + return qualType(hasUnqualifiedDesugaredType( + recordType(hasDeclaration(classTemplateSpecializationDecl( + hasName("::std::shared_ptr"), templateArgumentCountIs(1), + hasTemplateArgument(0, templateArgument(refersToType( + qualType().bind(PointerType))))))))); } } // namespace modernize Index: clang-tools-extra/trunk/clang-tidy/modernize/MakeUniqueCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/modernize/MakeUniqueCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/modernize/MakeUniqueCheck.cpp @@ -21,18 +21,19 @@ MakeUniqueCheck::SmartPtrTypeMatcher MakeUniqueCheck::getSmartPointerTypeMatcher() const { - return qualType(hasDeclaration(classTemplateSpecializationDecl( - hasName("::std::unique_ptr"), templateArgumentCountIs(2), - hasTemplateArgument( - 0, templateArgument(refersToType(qualType().bind(PointerType)))), - hasTemplateArgument( - 1, - templateArgument(refersToType( - qualType(hasDeclaration(classTemplateSpecializationDecl( - hasName("::std::default_delete"), templateArgumentCountIs(1), - hasTemplateArgument( - 0, templateArgument(refersToType( - qualType(equalsBoundNode(PointerType)))))))))))))); + return qualType(hasUnqualifiedDesugaredType( + recordType(hasDeclaration(classTemplateSpecializationDecl( + hasName("::std::unique_ptr"), templateArgumentCountIs(2), + hasTemplateArgument( + 0, templateArgument(refersToType(qualType().bind(PointerType)))), + hasTemplateArgument( + 1, templateArgument(refersToType( + qualType(hasDeclaration(classTemplateSpecializationDecl( + hasName("::std::default_delete"), + templateArgumentCountIs(1), + hasTemplateArgument( + 0, templateArgument(refersToType(qualType( + equalsBoundNode(PointerType)))))))))))))))); } } // namespace modernize Index: clang-tools-extra/trunk/clang-tidy/performance/FasterStringFindCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/performance/FasterStringFindCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/performance/FasterStringFindCheck.cpp @@ -74,9 +74,11 @@ callee(functionDecl(StringFindFunctions).bind("func")), anyOf(argumentCountIs(1), argumentCountIs(2)), hasArgument(0, SingleChar), - on(expr(hasType(recordDecl(hasAnyName(SmallVector( - StringLikeClasses.begin(), StringLikeClasses.end())))), - unless(hasSubstitutedType())))), + on(expr( + hasType(hasUnqualifiedDesugaredType(recordType(hasDeclaration( + recordDecl(hasAnyName(SmallVector( + StringLikeClasses.begin(), StringLikeClasses.end()))))))), + unless(hasSubstitutedType())))), this); } Index: clang-tools-extra/trunk/clang-tidy/performance/InefficientStringConcatenationCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/performance/InefficientStringConcatenationCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/performance/InefficientStringConcatenationCheck.cpp @@ -33,7 +33,8 @@ return; const auto BasicStringType = - hasType(cxxRecordDecl(hasName("::std::basic_string"))); + hasType(qualType(hasUnqualifiedDesugaredType(recordType( + hasDeclaration(cxxRecordDecl(hasName("::std::basic_string"))))))); const auto BasicStringPlusOperator = cxxOperatorCallExpr( hasOverloadedOperatorName("+"), Index: clang-tools-extra/trunk/clang-tidy/readability/ContainerSizeEmptyCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/readability/ContainerSizeEmptyCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/readability/ContainerSizeEmptyCheck.cpp @@ -32,16 +32,18 @@ if (!getLangOpts().CPlusPlus) return; - const auto ValidContainer = cxxRecordDecl(isSameOrDerivedFrom( - namedDecl( - has(cxxMethodDecl( - isConst(), parameterCountIs(0), isPublic(), hasName("size"), - returns(qualType(isInteger(), unless(booleanType())))) - .bind("size")), - has(cxxMethodDecl(isConst(), parameterCountIs(0), isPublic(), - hasName("empty"), returns(booleanType())) - .bind("empty"))) - .bind("container"))); + const auto ValidContainer = qualType(hasUnqualifiedDesugaredType( + recordType(hasDeclaration(cxxRecordDecl(isSameOrDerivedFrom( + namedDecl( + has(cxxMethodDecl( + isConst(), parameterCountIs(0), isPublic(), + hasName("size"), + returns(qualType(isInteger(), unless(booleanType())))) + .bind("size")), + has(cxxMethodDecl(isConst(), parameterCountIs(0), isPublic(), + hasName("empty"), returns(booleanType())) + .bind("empty"))) + .bind("container"))))))); const auto WrongUse = anyOf( hasParent(binaryOperator( Index: clang-tools-extra/trunk/clang-tidy/readability/RedundantStringCStrCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/readability/RedundantStringCStrCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/readability/RedundantStringCStrCheck.cpp @@ -77,7 +77,8 @@ return; // Match expressions of type 'string' or 'string*'. - const auto StringDecl = cxxRecordDecl(hasName("::std::basic_string")); + const auto StringDecl = type(hasUnqualifiedDesugaredType(recordType( + hasDeclaration(cxxRecordDecl(hasName("::std::basic_string")))))); const auto StringExpr = expr(anyOf(hasType(StringDecl), hasType(qualType(pointsTo(StringDecl))))); Index: clang-tools-extra/trunk/clang-tidy/readability/RedundantStringInitCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/readability/RedundantStringInitCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/readability/RedundantStringInitCheck.cpp @@ -47,7 +47,8 @@ // string bar(""); Finder->addMatcher( namedDecl( - varDecl(hasType(cxxRecordDecl(hasName("basic_string"))), + varDecl(hasType(hasUnqualifiedDesugaredType(recordType( + hasDeclaration(cxxRecordDecl(hasName("basic_string")))))), hasInitializer(expr(ignoringImplicit(anyOf( EmptyStringCtorExpr, EmptyStringCtorExprWithTemporaries))) Index: clang-tools-extra/trunk/include-fixer/find-all-symbols/FindAllSymbols.cpp =================================================================== --- clang-tools-extra/trunk/include-fixer/find-all-symbols/FindAllSymbols.cpp +++ clang-tools-extra/trunk/include-fixer/find-all-symbols/FindAllSymbols.cpp @@ -230,7 +230,8 @@ MatchFinder->addMatcher( typeLoc(isExpansionInMainFile(), loc(templateSpecializationType(hasDeclaration( - classTemplateDecl(has(CXXRecords.bind("use"))))))), + classTemplateSpecializationDecl(hasSpecializedTemplate( + classTemplateDecl(has(CXXRecords.bind("use"))))))))), this); }