summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/test/clang-tidy/modernize-make-unique.cpp
diff options
context:
space:
mode:
authorHaojian Wu <hokein@google.com>2018-01-23 11:43:18 +0000
committerHaojian Wu <hokein@google.com>2018-01-23 11:43:18 +0000
commitc159aa6aeb56c9e08c7a6b47b97906d1c7634261 (patch)
tree214a299ffdbb28fae8f084c8115ac8960c7fc7f9 /clang-tools-extra/test/clang-tidy/modernize-make-unique.cpp
parent8ea1a0c690ec17d7aa4505b5dcbb32f8298912e4 (diff)
downloadbcm5719-llvm-c159aa6aeb56c9e08c7a6b47b97906d1c7634261.tar.gz
bcm5719-llvm-c159aa6aeb56c9e08c7a6b47b97906d1c7634261.zip
[clang-tidy] Don't generate fixes for invalid new expr location in modernize-make-unique.
Reviewers: ilya-biryukov Reviewed By: ilya-biryukov Subscribers: klimek, xazax.hun, cfe-commits Differential Revision: https://reviews.llvm.org/D42363 llvm-svn: 323191
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.cpp9
1 files changed, 9 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 2fdcc752c58..b50404b922c 100644
--- a/clang-tools-extra/test/clang-tidy/modernize-make-unique.cpp
+++ b/clang-tools-extra/test/clang-tidy/modernize-make-unique.cpp
@@ -498,3 +498,12 @@ void invoke_template() {
Foo* foo;
template_fun(foo);
}
+
+void no_fix_for_invalid_new_loc() {
+ // FIXME: Although the code is valid, the end location of `new struct Base` is
+ // invalid. Correct it once https://bugs.llvm.org/show_bug.cgi?id=35952 is
+ // fixed.
+ auto T = std::unique_ptr<Base>(new struct Base);
+ // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: use std::make_unique instead
+ // CHECK-FIXES: auto T = std::unique_ptr<Base>(new struct Base);
+}
OpenPOWER on IntegriCloud