diff --git a/clang-tools-extra/clang-tidy/modernize/UseEmplaceCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseEmplaceCheck.cpp --- a/clang-tools-extra/clang-tidy/modernize/UseEmplaceCheck.cpp +++ b/clang-tools-extra/clang-tidy/modernize/UseEmplaceCheck.cpp @@ -134,15 +134,21 @@ // + match for emplace calls that should be replaced with insertion auto CallPushBack = cxxMemberCallExpr( hasDeclaration(functionDecl(hasName("push_back"))), - on(hasType(cxxRecordDecl(hasAnyName(ContainersWithPushBack))))); + on(anyOf(hasType(cxxRecordDecl(hasAnyName(ContainersWithPushBack))), + hasType(hasCanonicalType(hasDeclaration( + namedDecl(hasAnyName(ContainersWithPushBack)))))))); auto CallPush = cxxMemberCallExpr( hasDeclaration(functionDecl(hasName("push"))), - on(hasType(cxxRecordDecl(hasAnyName(ContainersWithPush))))); + on(anyOf(hasType(cxxRecordDecl(hasAnyName(ContainersWithPush))), + hasType(hasCanonicalType(hasDeclaration( + namedDecl(hasAnyName(ContainersWithPush)))))))); auto CallPushFront = cxxMemberCallExpr( hasDeclaration(functionDecl(hasName("push_front"))), - on(hasType(cxxRecordDecl(hasAnyName(ContainersWithPushFront))))); + on(anyOf(hasType(cxxRecordDecl(hasAnyName(ContainersWithPushFront))), + hasType(hasCanonicalType(hasDeclaration( + namedDecl(hasAnyName(ContainersWithPushFront)))))))); auto CallEmplacy = cxxMemberCallExpr( hasDeclaration(