Debian Codegraph @

src/checks/manuallevel/ifndef-define-typo.h

raw
1 /*
2 SPDX-FileCopyrightText: 2018 Sergio Martins <[email protected]>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6
7 #ifndef CLAZY_IFNDEF_DEFINE_TYPO_H
8 #define CLAZY_IFNDEF_DEFINE_TYPO_H
9
10 #include "checkbase.h"
11
12 /**
13 * See README-ifndef-define-typo.md for more info.
14 */
15 class IfndefDefineTypo : public CheckBase
16 {
17 public:
18 using CheckBase::CheckBase;
19 void VisitMacroDefined(const clang::Token &macroNameTok) override;
20 void VisitDefined(const clang::Token &macroNameTok, const clang::SourceRange &) override;
21 void VisitIfdef(clang::SourceLocation, const clang::Token &) override;
22 void VisitIfndef(clang::SourceLocation, const clang::Token &) override;
23 void VisitIf(clang::SourceLocation loc, clang::SourceRange conditionRange, clang::PPCallbacks::ConditionValueKind conditionValue) override;
24 void VisitElif(clang::SourceLocation loc,
25 clang::SourceRange conditionRange,
26 clang::PPCallbacks::ConditionValueKind ConditionValue,
27 clang::SourceLocation ifLoc) override;
28 void VisitElse(clang::SourceLocation loc, clang::SourceLocation ifLoc) override;
29 void VisitEndif(clang::SourceLocation loc, clang::SourceLocation ifLoc) override;
30
31 void maybeWarn(const std::string &define, clang::SourceLocation loc);
32
33 private:
34 std::string m_lastIfndef;
35 };
36
37 #endif