xref: /llvm-project/clang-tools-extra/test/clang-tidy/checkers/modernize/make-unique-header.cpp (revision e8a3ddafe063c970df9c23e803812369abde4c82)
189a1d03eSRichard // RUN: %check_clang_tidy %s modernize-make-unique %t -- \
289a1d03eSRichard // RUN:   -config="{CheckOptions: \
3*e8a3ddafSNathan James // RUN:     {modernize-make-unique.MakeSmartPtrFunction: 'my::MakeUnique', \
4*e8a3ddafSNathan James // RUN:      modernize-make-unique.MakeSmartPtrFunctionHeader: 'make_unique_util.h' \
5*e8a3ddafSNathan James // RUN:     }}" \
689a1d03eSRichard // RUN:   -- -I %S/Inputs/smart-ptr
789a1d03eSRichard 
889a1d03eSRichard #include "unique_ptr.h"
989a1d03eSRichard // CHECK-FIXES: #include "make_unique_util.h"
1089a1d03eSRichard 
f()1189a1d03eSRichard void f() {
1289a1d03eSRichard   std::unique_ptr<int> P1 = std::unique_ptr<int>(new int());
1389a1d03eSRichard   // CHECK-MESSAGES: :[[@LINE-1]]:29: warning: use my::MakeUnique instead
1489a1d03eSRichard   // CHECK-FIXES: std::unique_ptr<int> P1 = my::MakeUnique<int>();
1589a1d03eSRichard }
16