blob: 3e6f184b58b808833a911c54a255d909475db6cc [file] [log] [blame]
Samuel Benzaquendaef1632015-10-19 21:49:51 +00001//===--- UniqueptrDeleteReleaseCheck.h - clang-tidy--------------*- C++ -*-===//
2//
Chandler Carruth2946cd72019-01-19 08:50:56 +00003// 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-exception
Samuel Benzaquendaef1632015-10-19 21:49:51 +00006//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_UNIQUEPTR_DELETE_RELEASE_H
10#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_UNIQUEPTR_DELETE_RELEASE_H
11
Alexander Kornienko478fc5c2019-03-25 12:38:26 +000012#include "../ClangTidyCheck.h"
Samuel Benzaquendaef1632015-10-19 21:49:51 +000013
14namespace clang {
15namespace tidy {
Etienne Bergeron456177b2016-05-02 18:00:29 +000016namespace readability {
Samuel Benzaquendaef1632015-10-19 21:49:51 +000017
Alexander Kornienkoc9c82902016-06-17 11:43:33 +000018/// Flags statements of the form ``delete <unique_ptr expr>.release();`` and
19/// replaces them with: ``<unique_ptr expr> = nullptr;``
Samuel Benzaquendaef1632015-10-19 21:49:51 +000020///
21/// For the user-facing documentation see:
22/// http://clang.llvm.org/extra/clang-tidy/checks/readability-uniqueptr-delete-release.html
23class UniqueptrDeleteReleaseCheck : public ClangTidyCheck {
24public:
25 UniqueptrDeleteReleaseCheck(StringRef Name, ClangTidyContext *Context)
26 : ClangTidyCheck(Name, Context) {}
27 void registerMatchers(ast_matchers::MatchFinder *Finder) override;
28 void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
29};
30
Etienne Bergeron456177b2016-05-02 18:00:29 +000031} // namespace readability
Samuel Benzaquendaef1632015-10-19 21:49:51 +000032} // namespace tidy
33} // namespace clang
34
35#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_UNIQUEPTR_DELETE_RELEASE_H