blob: 43ca22d822bd994620647d4aec841110d3cbedb8 [file] [log] [blame]
Samuel Benzaquendaef1632015-10-19 21:49:51 +00001//===--- UniqueptrDeleteReleaseCheck.h - clang-tidy--------------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_UNIQUEPTR_DELETE_RELEASE_H
11#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_UNIQUEPTR_DELETE_RELEASE_H
12
13#include "../ClangTidy.h"
14
15namespace clang {
16namespace tidy {
Etienne Bergeron456177b2016-05-02 18:00:29 +000017namespace readability {
Samuel Benzaquendaef1632015-10-19 21:49:51 +000018
Alexander Kornienkoc9c82902016-06-17 11:43:33 +000019/// Flags statements of the form ``delete <unique_ptr expr>.release();`` and
20/// replaces them with: ``<unique_ptr expr> = nullptr;``
Samuel Benzaquendaef1632015-10-19 21:49:51 +000021///
22/// For the user-facing documentation see:
23/// http://clang.llvm.org/extra/clang-tidy/checks/readability-uniqueptr-delete-release.html
24class UniqueptrDeleteReleaseCheck : public ClangTidyCheck {
25public:
26 UniqueptrDeleteReleaseCheck(StringRef Name, ClangTidyContext *Context)
27 : ClangTidyCheck(Name, Context) {}
28 void registerMatchers(ast_matchers::MatchFinder *Finder) override;
29 void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
30};
31
Etienne Bergeron456177b2016-05-02 18:00:29 +000032} // namespace readability
Samuel Benzaquendaef1632015-10-19 21:49:51 +000033} // namespace tidy
34} // namespace clang
35
36#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_UNIQUEPTR_DELETE_RELEASE_H
37