File indexing completed on 2024-04-28 05:38:32
0001 /* 0002 SPDX-FileCopyrightText: 2018 Sergio Martins <smartins@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #ifndef CLAZY_IFNDEF_DEFINE_TYPO_H 0008 #define CLAZY_IFNDEF_DEFINE_TYPO_H 0009 0010 #include "checkbase.h" 0011 0012 /** 0013 * See README-ifndef-define-typo.md for more info. 0014 */ 0015 class IfndefDefineTypo : public CheckBase 0016 { 0017 public: 0018 explicit IfndefDefineTypo(const std::string &name, ClazyContext *context); 0019 void VisitMacroDefined(const clang::Token ¯oNameTok) override; 0020 void VisitDefined(const clang::Token ¯oNameTok, const clang::SourceRange &) override; 0021 void VisitIfdef(clang::SourceLocation, const clang::Token &) override; 0022 void VisitIfndef(clang::SourceLocation, const clang::Token &) override; 0023 void VisitIf(clang::SourceLocation loc, clang::SourceRange conditionRange, clang::PPCallbacks::ConditionValueKind conditionValue) override; 0024 void VisitElif(clang::SourceLocation loc, 0025 clang::SourceRange conditionRange, 0026 clang::PPCallbacks::ConditionValueKind ConditionValue, 0027 clang::SourceLocation ifLoc) override; 0028 void VisitElse(clang::SourceLocation loc, clang::SourceLocation ifLoc) override; 0029 void VisitEndif(clang::SourceLocation loc, clang::SourceLocation ifLoc) override; 0030 0031 void maybeWarn(const std::string &define, clang::SourceLocation loc); 0032 0033 private: 0034 std::string m_lastIfndef; 0035 }; 0036 0037 #endif