File indexing completed on 2024-04-28 05:38:28
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_INCORRECT_EMIT_H 0008 #define CLAZY_INCORRECT_EMIT_H 0009 0010 #include "checkbase.h" 0011 0012 #include <clang/Basic/SourceLocation.h> 0013 0014 #include <string> 0015 #include <unordered_map> 0016 #include <vector> 0017 0018 class ClazyContext; 0019 0020 namespace clang 0021 { 0022 class CXXMemberCallExpr; 0023 class MacroInfo; 0024 class Stmt; 0025 class Token; 0026 } 0027 0028 /** 0029 * See README-incorrect-emit.md for more info. 0030 */ 0031 class IncorrectEmit : public CheckBase 0032 { 0033 public: 0034 explicit IncorrectEmit(const std::string &name, ClazyContext *context); 0035 void VisitStmt(clang::Stmt *stmt) override; 0036 0037 private: 0038 void checkCallSignalInsideCTOR(clang::CXXMemberCallExpr *); 0039 void VisitMacroExpands(const clang::Token &MacroNameTok, const clang::SourceRange &range, const clang::MacroInfo *minfo = nullptr) override; 0040 bool hasEmitKeyboard(clang::CXXMemberCallExpr *) const; 0041 std::vector<clang::SourceLocation> m_emitLocations; 0042 mutable std::unordered_map<unsigned, clang::SourceLocation> m_locationCache; 0043 }; 0044 0045 #endif