llvm-project/clang-tools-extra/test/clang-tidy/modernize-make-shared-heade...

18 lines
679 B
C++
Raw Normal View History

// RUN: %check_clang_tidy %s modernize-make-shared %t -- \
// RUN: -config="{CheckOptions: \
// RUN: [{key: modernize-make-shared.MakeSmartPtrFunction, \
// RUN: value: 'my::MakeShared'}, \
// RUN: {key: modernize-make-shared.MakeSmartPtrFunctionHeader, \
// RUN: value: 'make_shared_util.h'} \
// RUN: ]}" \
// RUN: -- -std=c++11 -I%S/Inputs/modernize-smart-ptr
#include "shared_ptr.h"
// CHECK-FIXES: #include "make_shared_util.h"
void f() {
std::shared_ptr<int> P1 = std::shared_ptr<int>(new int());
// CHECK-MESSAGES: :[[@LINE-1]]:29: warning: use my::MakeShared instead
// CHECK-FIXES: std::shared_ptr<int> P1 = my::MakeShared<int>();
}