diff options
author | Haojian Wu <hokein@google.com> | 2017-08-04 11:18:00 +0000 |
---|---|---|
committer | Haojian Wu <hokein@google.com> | 2017-08-04 11:18:00 +0000 |
commit | 115b707584ef942d7c52fd6226d140619e03fdd8 (patch) | |
tree | a7b3d44d2b86e1f319ff75fc3403e2652c6082e7 /clang-tools-extra/test/clang-tidy/modernize-make-unique.cpp | |
parent | 70ecb827b48957a6aeb3fe72930e824693a48c91 (diff) | |
download | bcm5719-llvm-115b707584ef942d7c52fd6226d140619e03fdd8.tar.gz bcm5719-llvm-115b707584ef942d7c52fd6226d140619e03fdd8.zip |
[clang-tidy] Ignore macros in make-unique check.
Summary:
The check doesn't fully support smart-ptr usages inside macros, which
may cause incorrect fixes, or even crashes, ignore them for now.
Reviewers: alexfh
Reviewed By: alexfh
Subscribers: JDevlieghere, xazax.hun, cfe-commits
Differential Revision: https://reviews.llvm.org/D36264
llvm-svn: 310050
Diffstat (limited to 'clang-tools-extra/test/clang-tidy/modernize-make-unique.cpp')
-rw-r--r-- | clang-tools-extra/test/clang-tidy/modernize-make-unique.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/clang-tools-extra/test/clang-tidy/modernize-make-unique.cpp b/clang-tools-extra/test/clang-tidy/modernize-make-unique.cpp index cd4d057dac2..f1264cbb607 100644 --- a/clang-tools-extra/test/clang-tidy/modernize-make-unique.cpp +++ b/clang-tools-extra/test/clang-tidy/modernize-make-unique.cpp @@ -404,3 +404,14 @@ void reset() { // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: use std::make_unique instead // CHECK-FIXES: *Q = std::make_unique<int>(); } + +#define DEFINE(...) __VA_ARGS__ +template<typename T> +void g2(std::unique_ptr<Foo> *t) { + DEFINE(auto p = std::unique_ptr<Foo>(new Foo); t->reset(new Foo);); +} +void macro() { + std::unique_ptr<Foo> *t; + g2<bar::Bar>(t); +} +#undef DEFINE |