diff options
| author | Angel Garcia Gomez <angelgarcia@google.com> | 2015-10-05 12:20:17 +0000 |
|---|---|---|
| committer | Angel Garcia Gomez <angelgarcia@google.com> | 2015-10-05 12:20:17 +0000 |
| commit | b9f3059509c32f31d03b016b550ed0421aa4dbb7 (patch) | |
| tree | 74df5d58a29530f8e739051460b348e80de063e6 /clang-tools-extra/clang-tidy/modernize/MakeUniqueCheck.cpp | |
| parent | 057f0a68cc6698a37208508f609b3dd5d45fb537 (diff) | |
| download | bcm5719-llvm-b9f3059509c32f31d03b016b550ed0421aa4dbb7.tar.gz bcm5719-llvm-b9f3059509c32f31d03b016b550ed0421aa4dbb7.zip | |
Use better mocks in modernize-make-unique, and fix matcher.
Summary: Add the second template argument to the unique_ptr mock, and update the matcher so that it only matches against cases where the second argument is the default.
Reviewers: klimek
Subscribers: alexfh, cfe-commits
Differential Revision: http://reviews.llvm.org/D13433
llvm-svn: 249305
Diffstat (limited to 'clang-tools-extra/clang-tidy/modernize/MakeUniqueCheck.cpp')
| -rw-r--r-- | clang-tools-extra/clang-tidy/modernize/MakeUniqueCheck.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/clang-tools-extra/clang-tidy/modernize/MakeUniqueCheck.cpp b/clang-tools-extra/clang-tidy/modernize/MakeUniqueCheck.cpp index 77c684984de..bdf5538a59c 100644 --- a/clang-tools-extra/clang-tidy/modernize/MakeUniqueCheck.cpp +++ b/clang-tools-extra/clang-tidy/modernize/MakeUniqueCheck.cpp @@ -29,10 +29,18 @@ void MakeUniqueCheck::registerMatchers(MatchFinder *Finder) { cxxConstructExpr( hasType(qualType(hasDeclaration(classTemplateSpecializationDecl( matchesName("::std::unique_ptr"), - templateArgumentCountIs(1), + templateArgumentCountIs(2), + hasTemplateArgument(0, templateArgument(refersToType( + qualType().bind(PointerType)))), hasTemplateArgument( - 0, templateArgument( - refersToType(qualType().bind(PointerType)))))))), + 1, templateArgument(refersToType(qualType( + hasDeclaration(classTemplateSpecializationDecl( + matchesName("::std::default_delete"), + templateArgumentCountIs(1), + hasTemplateArgument( + 0, templateArgument(refersToType( + qualType(equalsBoundNode( + PointerType))))))))))))))), argumentCountIs(1), hasArgument(0, cxxNewExpr(hasType(pointsTo(qualType( equalsBoundNode(PointerType))))) |

