summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/test/clang-tidy/modernize-make-unique.cpp
diff options
context:
space:
mode:
authorHaojian Wu <hokein@google.com>2017-08-04 11:18:00 +0000
committerHaojian Wu <hokein@google.com>2017-08-04 11:18:00 +0000
commit115b707584ef942d7c52fd6226d140619e03fdd8 (patch)
treea7b3d44d2b86e1f319ff75fc3403e2652c6082e7 /clang-tools-extra/test/clang-tidy/modernize-make-unique.cpp
parent70ecb827b48957a6aeb3fe72930e824693a48c91 (diff)
downloadbcm5719-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.cpp11
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
OpenPOWER on IntegriCloud