Samuel Benzaquen | 3a57101 | 2014-03-27 17:42:26 +0000 | [diff] [blame] | 1 | //===--- RedundantSmartptrGet.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_MISC_REDUNDANT_SMARTPTR_GET_H |
| 11 | #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_REDUNDANT_SMARTPTR_GET_H |
| 12 | |
| 13 | #include "../ClangTidy.h" |
| 14 | |
| 15 | namespace clang { |
| 16 | namespace tidy { |
| 17 | |
| 18 | /// \brief Find and remove redundant calls to smart pointer's .get() method. |
| 19 | /// |
| 20 | /// Examples: |
| 21 | /// ptr.get()->Foo() ==> ptr->Foo() |
| 22 | /// *ptr.get() ==> *ptr |
| 23 | /// *ptr->get() ==> **ptr |
| 24 | class RedundantSmartptrGet : public ClangTidyCheck { |
| 25 | public: |
| 26 | void registerMatchers(ast_matchers::MatchFinder *Finder) override; |
| 27 | void check(const ast_matchers::MatchFinder::MatchResult &Result) override; |
| 28 | }; |
| 29 | |
| 30 | } // namespace tidy |
| 31 | } // namespace clang |
| 32 | |
| 33 | #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_REDUNDANT_SMARTPTR_GET_H |
| 34 | |