clang-tools 3.8.0

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

BoolPointerImplicitConversionCheck.h
Go to the documentation of this file.
1 //===--- BoolPointerImplicitConversionCheck.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_BOOLPOINTERIMPLICITCONVERSIONCHECK_H
11 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_BOOLPOINTERIMPLICITCONVERSIONCHECK_H
12
13 #include "../ClangTidy.h"
14
15 namespace clang {
16 namespace tidy {
17 namespace misc {
18
19 /// Checks for conditions based on implicit conversion from a bool pointer to
20 /// bool.
21 ///
22 /// Example:
23 ///
24 /// \code
25 /// bool *p;
26 /// if (p) {
27 /// // Never used in a pointer-specific way.
28 /// }
29 /// \endcode
30 class BoolPointerImplicitConversionCheck : public ClangTidyCheck {
31 public:
32 BoolPointerImplicitConversionCheck(StringRef Name, ClangTidyContext *Context)
33 : ClangTidyCheck(Name, Context) {}
34 void registerMatchers(ast_matchers::MatchFinder *Finder) override;
35 void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
36 };
37
38 } // namespace misc
39 } // namespace tidy
40 } // namespace clang
41
42 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_BOOLPOINTERIMPLICITCONVERSIONCHECK_H
43
clang::tidy::misc::BoolPointerImplicitConversionCheck
Checks for conditions based on implicit conversion from a bool pointer to bool.
Definition: BoolPointerImplicitConversionCheck.h:30
Name
StringHandle Name
Definition: PreprocessorTracker.cpp:525
Finder
std::unique_ptr< ast_matchers::MatchFinder > Finder
Definition: ClangTidy.cpp:188
clang::tidy::ClangTidyCheck
Base class for all clang-tidy checks.
Definition: ClangTidy.h:102
clang::tidy::misc::BoolPointerImplicitConversionCheck::registerMatchers
void registerMatchers(ast_matchers::MatchFinder *Finder) override
Override this to register ASTMatchers with Finder.
Definition: BoolPointerImplicitConversionCheck.cpp:27
clang::tidy::misc::BoolPointerImplicitConversionCheck::BoolPointerImplicitConversionCheck
BoolPointerImplicitConversionCheck(StringRef Name, ClangTidyContext *Context)
Definition: BoolPointerImplicitConversionCheck.h:32
clang::tidy::misc::BoolPointerImplicitConversionCheck::check
void check(const ast_matchers::MatchFinder::MatchResult &Result) override
ClangTidyChecks that register ASTMatchers should do the actual work in here.
Definition: BoolPointerImplicitConversionCheck.cpp:41
clang::tidy::ClangTidyContext
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.
Definition: ClangTidyDiagnosticConsumer.h:124
Result
const NamedDecl * Result
Definition: USRFinder.cpp:121