File indexing completed on 2024-04-28 05:38:30

0001 /*
0002     SPDX-FileCopyrightText: 2015 Klarälvdalens Datakonsult AB a KDAB Group company info@kdab.com
0003     SPDX-FileContributor: SĂ©rgio Martins <sergio.martins@kdab.com>
0004 
0005     SPDX-FileCopyrightText: 2015 Sergio Martins <smartins@kde.org>
0006 
0007     SPDX-License-Identifier: LGPL-2.0-or-later
0008 */
0009 
0010 #ifndef CLANG_LAZY_IMPLICIT_CASTS_H
0011 #define CLANG_LAZY_IMPLICIT_CASTS_H
0012 
0013 #include "checkbase.h"
0014 
0015 #include <string>
0016 
0017 class ClazyContext;
0018 
0019 namespace clang
0020 {
0021 class ImplicitCastExpr;
0022 class SourceLocation;
0023 class Stmt;
0024 class CallExpr;
0025 class FunctionDecl;
0026 }
0027 
0028 /**
0029  * Finds places with unwanted implicit casts.
0030  *
0031  * See README-implicit-casts for more information
0032  */
0033 class ImplicitCasts : public CheckBase
0034 {
0035 public:
0036     ImplicitCasts(const std::string &name, ClazyContext *context);
0037     void VisitStmt(clang::Stmt *stmt) override;
0038 
0039 private:
0040     bool isBoolToInt(clang::FunctionDecl *func) const;
0041     bool isMacroToIgnore(clang::SourceLocation loc) const;
0042 };
0043 
0044 #endif