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

0001 /*
0002     SPDX-FileCopyrightText: 2016 Sergio Martins <smartins@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #ifndef CLAZY_QT_MACROS_H
0008 #define CLAZY_QT_MACROS_H
0009 
0010 #include "checkbase.h"
0011 
0012 #include <clang/Basic/SourceLocation.h>
0013 
0014 #include <string>
0015 
0016 class QtMacrosPreprocessorCallbacks;
0017 class ClazyContext;
0018 namespace clang
0019 {
0020 class Token;
0021 } // namespace clang
0022 
0023 /**
0024  * See README-qt-macros for more info.
0025  */
0026 class QtMacros : public CheckBase
0027 {
0028 public:
0029     explicit QtMacros(const std::string &name, ClazyContext *context);
0030 
0031 private:
0032     void checkIfDef(const clang::Token &MacroNameTok, clang::SourceLocation Loc);
0033     void VisitMacroDefined(const clang::Token &MacroNameTok) override;
0034     void VisitDefined(const clang::Token &macroNameTok, const clang::SourceRange &range) override;
0035     void VisitIfdef(clang::SourceLocation loc, const clang::Token &macroNameTok) override;
0036 
0037     bool m_OSMacroExists = false;
0038 };
0039 
0040 #endif