Samuel Benzaquen | daef163 | 2015-10-19 21:49:51 +0000 | [diff] [blame] | 1 | //===--- UniqueptrDeleteReleaseCheck.h - clang-tidy--------------*- C++ -*-===// |
| 2 | // |
Chandler Carruth | 2946cd7 | 2019-01-19 08:50:56 +0000 | [diff] [blame] | 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-exception |
Samuel Benzaquen | daef163 | 2015-10-19 21:49:51 +0000 | [diff] [blame] | 6 | // |
| 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 Kornienko | 478fc5c | 2019-03-25 12:38:26 +0000 | [diff] [blame] | 12 | #include "../ClangTidyCheck.h" |
Samuel Benzaquen | daef163 | 2015-10-19 21:49:51 +0000 | [diff] [blame] | 13 | |
| 14 | namespace clang { |
| 15 | namespace tidy { |
Etienne Bergeron | 456177b | 2016-05-02 18:00:29 +0000 | [diff] [blame] | 16 | namespace readability { |
Samuel Benzaquen | daef163 | 2015-10-19 21:49:51 +0000 | [diff] [blame] | 17 | |
Alexander Kornienko | c9c8290 | 2016-06-17 11:43:33 +0000 | [diff] [blame] | 18 | /// Flags statements of the form ``delete <unique_ptr expr>.release();`` and |
| 19 | /// replaces them with: ``<unique_ptr expr> = nullptr;`` |
Samuel Benzaquen | daef163 | 2015-10-19 21:49:51 +0000 | [diff] [blame] | 20 | /// |
| 21 | /// For the user-facing documentation see: |
| 22 | /// http://clang.llvm.org/extra/clang-tidy/checks/readability-uniqueptr-delete-release.html |
| 23 | class UniqueptrDeleteReleaseCheck : public ClangTidyCheck { |
| 24 | public: |
| 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 Bergeron | 456177b | 2016-05-02 18:00:29 +0000 | [diff] [blame] | 31 | } // namespace readability |
Samuel Benzaquen | daef163 | 2015-10-19 21:49:51 +0000 | [diff] [blame] | 32 | } // namespace tidy |
| 33 | } // namespace clang |
| 34 | |
| 35 | #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_UNIQUEPTR_DELETE_RELEASE_H |