41 lines · c
1//===----------------------------------------------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8 9#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_MAKEUNIQUECHECK_H10#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_MAKEUNIQUECHECK_H11 12#include "MakeSmartPtrCheck.h"13 14namespace clang::tidy::modernize {15 16/// Replace the pattern:17/// \code18/// std::unique_ptr<type>(new type(args...))19/// \endcode20///21/// With the C++14 version:22/// \code23/// std::make_unique<type>(args...)24/// \endcode25class MakeUniqueCheck : public MakeSmartPtrCheck {26public:27 MakeUniqueCheck(StringRef Name, ClangTidyContext *Context);28 29protected:30 SmartPtrTypeMatcher getSmartPointerTypeMatcher() const override;31 32 bool isLanguageVersionSupported(const LangOptions &LangOpts) const override;33 34private:35 const bool RequireCPlusPlus14;36};37 38} // namespace clang::tidy::modernize39 40#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_MAKEUNIQUECHECK_H41