From c159aa6aeb56c9e08c7a6b47b97906d1c7634261 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Tue, 23 Jan 2018 11:43:18 +0000 Subject: [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 --- clang-tools-extra/test/clang-tidy/modernize-make-unique.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'clang-tools-extra/test/clang-tidy/modernize-make-unique.cpp') 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(new struct Base); + // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: use std::make_unique instead + // CHECK-FIXES: auto T = std::unique_ptr(new struct Base); +} -- cgit v1.2.3