blob: 2eed471134508065d61819e33b7bbe3ecab762b2 [file] [log] [blame]
Olivier Deprezf4ef2d02021-04-20 13:36:24 +02001//===--- 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
14namespace clang {
15namespace tidy {
16namespace 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
29class BoolPointerImplicitConversionCheck : public ClangTidyCheck {
30public:
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