• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===--- BoolPointerImplicitConversionCheck.h - clang-tidy ------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_BOOLPOINTERIMPLICITCONVERSIONCHECK_H
10 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_BOOLPOINTERIMPLICITCONVERSIONCHECK_H
11 
12 #include "../ClangTidyCheck.h"
13 
14 namespace clang {
15 namespace tidy {
16 namespace bugprone {
17 
18 /// Checks for conditions based on implicit conversion from a bool pointer to
19 /// bool.
20 ///
21 /// Example:
22 ///
23 /// \code
24 ///   bool *p;
25 ///   if (p) {
26 ///     // Never used in a pointer-specific way.
27 ///   }
28 /// \endcode
29 class BoolPointerImplicitConversionCheck : public ClangTidyCheck {
30 public:
BoolPointerImplicitConversionCheck(StringRef Name,ClangTidyContext * Context)31   BoolPointerImplicitConversionCheck(StringRef Name, ClangTidyContext *Context)
32       : ClangTidyCheck(Name, Context) {}
33   void registerMatchers(ast_matchers::MatchFinder *Finder) override;
34   void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
35 };
36 
37 } // namespace bugprone
38 } // namespace tidy
39 } // namespace clang
40 
41 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_BOOLPOINTERIMPLICITCONVERSIONCHECK_H
42