Samuel Benzaquen | daef163 | 2015-10-19 21:49:51 +0000 | [diff] [blame] | 1 | //===--- 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 | |
| 15 | namespace clang { |
| 16 | namespace tidy { |
Etienne Bergeron | 456177b | 2016-05-02 18:00:29 +0000 | [diff] [blame] | 17 | namespace readability { |
Samuel Benzaquen | daef163 | 2015-10-19 21:49:51 +0000 | [diff] [blame] | 18 | |
Alexander Kornienko | c9c8290 | 2016-06-17 11:43:33 +0000 | [diff] [blame^] | 19 | /// Flags statements of the form ``delete <unique_ptr expr>.release();`` and |
| 20 | /// replaces them with: ``<unique_ptr expr> = nullptr;`` |
Samuel Benzaquen | daef163 | 2015-10-19 21:49:51 +0000 | [diff] [blame] | 21 | /// |
| 22 | /// For the user-facing documentation see: |
| 23 | /// http://clang.llvm.org/extra/clang-tidy/checks/readability-uniqueptr-delete-release.html |
| 24 | class UniqueptrDeleteReleaseCheck : public ClangTidyCheck { |
| 25 | public: |
| 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 Bergeron | 456177b | 2016-05-02 18:00:29 +0000 | [diff] [blame] | 32 | } // namespace readability |
Samuel Benzaquen | daef163 | 2015-10-19 21:49:51 +0000 | [diff] [blame] | 33 | } // namespace tidy |
| 34 | } // namespace clang |
| 35 | |
| 36 | #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_UNIQUEPTR_DELETE_RELEASE_H |
| 37 | |