Alexander Kornienko | 276fc64 | 2014-06-29 22:19:53 +0000 | [diff] [blame] | 1 | //===--- AvoidCStyleCastsCheck.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 | |
Alexander Kornienko | 6658055 | 2015-03-09 16:52:33 +0000 | [diff] [blame] | 10 | #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_GOOGLE_AVOIDCSTYLECASTSCHECK_H |
| 11 | #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_GOOGLE_AVOIDCSTYLECASTSCHECK_H |
Alexander Kornienko | 276fc64 | 2014-06-29 22:19:53 +0000 | [diff] [blame] | 12 | |
| 13 | #include "../ClangTidy.h" |
| 14 | |
| 15 | namespace clang { |
| 16 | namespace tidy { |
Alexander Kornienko | ed824e0 | 2015-03-05 13:46:14 +0000 | [diff] [blame] | 17 | namespace google { |
Alexander Kornienko | 276fc64 | 2014-06-29 22:19:53 +0000 | [diff] [blame] | 18 | namespace readability { |
| 19 | |
Alexander Kornienko | f8ed0a8 | 2015-08-27 18:01:58 +0000 | [diff] [blame] | 20 | /// Finds usages of C-style casts. |
Alexander Kornienko | 276fc64 | 2014-06-29 22:19:53 +0000 | [diff] [blame] | 21 | /// |
| 22 | /// http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml?showone=Casting#Casting |
Alexander Kornienko | f8ed0a8 | 2015-08-27 18:01:58 +0000 | [diff] [blame] | 23 | /// |
Alexander Kornienko | 276fc64 | 2014-06-29 22:19:53 +0000 | [diff] [blame] | 24 | /// Corresponding cpplint.py check name: 'readability/casting'. |
Alexander Kornienko | e3b7839 | 2014-06-30 09:54:12 +0000 | [diff] [blame] | 25 | /// |
Alexander Kornienko | f8ed0a8 | 2015-08-27 18:01:58 +0000 | [diff] [blame] | 26 | /// This check is similar to `-Wold-style-cast`, but it suggests automated fixes |
| 27 | /// in some cases. The reported locations should not be different from the |
| 28 | /// ones generated by `-Wold-style-cast`. |
Alexander Kornienko | 276fc64 | 2014-06-29 22:19:53 +0000 | [diff] [blame] | 29 | class AvoidCStyleCastsCheck : public ClangTidyCheck { |
| 30 | public: |
Alexander Kornienko | 6e0cbc8 | 2014-09-12 08:53:36 +0000 | [diff] [blame] | 31 | AvoidCStyleCastsCheck(StringRef Name, ClangTidyContext *Context) |
| 32 | : ClangTidyCheck(Name, Context) {} |
Alexander Kornienko | 276fc64 | 2014-06-29 22:19:53 +0000 | [diff] [blame] | 33 | void registerMatchers(ast_matchers::MatchFinder *Finder) override; |
| 34 | void check(const ast_matchers::MatchFinder::MatchResult &Result) override; |
| 35 | }; |
| 36 | |
| 37 | } // namespace readability |
Alexander Kornienko | ed824e0 | 2015-03-05 13:46:14 +0000 | [diff] [blame] | 38 | } // namespace google |
Alexander Kornienko | 276fc64 | 2014-06-29 22:19:53 +0000 | [diff] [blame] | 39 | } // namespace tidy |
| 40 | } // namespace clang |
| 41 | |
Alexander Kornienko | 6658055 | 2015-03-09 16:52:33 +0000 | [diff] [blame] | 42 | #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_GOOGLE_AVOIDCSTYLECASTSCHECK_H |