blob: aa98ad8cd1c2cf9209fe2adb5335b8fe852680c9 [file] [log] [blame]
Alexander Kornienko276fc642014-06-29 22:19:53 +00001//===--- 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 Kornienko66580552015-03-09 16:52:33 +000010#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_GOOGLE_AVOIDCSTYLECASTSCHECK_H
11#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_GOOGLE_AVOIDCSTYLECASTSCHECK_H
Alexander Kornienko276fc642014-06-29 22:19:53 +000012
13#include "../ClangTidy.h"
14
15namespace clang {
16namespace tidy {
Alexander Kornienkoed824e02015-03-05 13:46:14 +000017namespace google {
Alexander Kornienko276fc642014-06-29 22:19:53 +000018namespace readability {
19
Alexander Kornienkof8ed0a82015-08-27 18:01:58 +000020/// Finds usages of C-style casts.
Alexander Kornienko276fc642014-06-29 22:19:53 +000021///
22/// http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml?showone=Casting#Casting
Alexander Kornienkof8ed0a82015-08-27 18:01:58 +000023///
Alexander Kornienko276fc642014-06-29 22:19:53 +000024/// Corresponding cpplint.py check name: 'readability/casting'.
Alexander Kornienkoe3b78392014-06-30 09:54:12 +000025///
Alexander Kornienkof8ed0a82015-08-27 18:01:58 +000026/// 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 Kornienko276fc642014-06-29 22:19:53 +000029class AvoidCStyleCastsCheck : public ClangTidyCheck {
30public:
Alexander Kornienko6e0cbc82014-09-12 08:53:36 +000031 AvoidCStyleCastsCheck(StringRef Name, ClangTidyContext *Context)
32 : ClangTidyCheck(Name, Context) {}
Alexander Kornienko276fc642014-06-29 22:19:53 +000033 void registerMatchers(ast_matchers::MatchFinder *Finder) override;
34 void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
35};
36
37} // namespace readability
Alexander Kornienkoed824e02015-03-05 13:46:14 +000038} // namespace google
Alexander Kornienko276fc642014-06-29 22:19:53 +000039} // namespace tidy
40} // namespace clang
41
Alexander Kornienko66580552015-03-09 16:52:33 +000042#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_GOOGLE_AVOIDCSTYLECASTSCHECK_H