/* SPDX-FileCopyrightText: 2016 Sergio Martins SPDX-License-Identifier: LGPL-2.0-or-later */ #ifndef CLAZY_SUPPRESSION_MANAGER_H #define CLAZY_SUPPRESSION_MANAGER_H #include #include #include #include #include #include namespace llvm { class Regex; } namespace clang { class SourceLocation; class LangOptions; class SourceManager; class FileID; } class SuppressionManager { public: using SourceFileID = unsigned int; using LineNumber = unsigned int; using CheckName = std::string; using LineAndCheckName = std::pair; struct CheckBeginAndEnd { std::vector checksToSkipWildcard; LineNumber begin; LineNumber end; }; struct Suppressions { bool skipEntireFile = false; std::set skipNextLine; std::set checksToSkip; std::set checksToSkipByLine; std::unordered_map checkWildcardsToSkipByLine; std::vector checkWildcardsRanges; }; SuppressionManager(); bool isSuppressed(const std::string &checkName, clang::SourceLocation, const clang::SourceManager &, const clang::LangOptions &) const; private: void parseFile(clang::FileID, const clang::SourceManager &, const clang::LangOptions &lo) const; SuppressionManager(const SuppressionManager &) = delete; SuppressionManager &operator=(const SuppressionManager &) = delete; mutable std::unordered_map m_processedFileIDs; }; #endif