forked from viva64/plog-converter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsuppressfilter.h
56 lines (44 loc) · 1.33 KB
/
suppressfilter.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// 2006-2008 (c) Viva64.com Team
// 2008-2020 (c) OOO "Program Verification Systems"
#ifndef SUPPRESSFILTER_H
#define SUPPRESSFILTER_H
#include <optional>
#include "configs.h"
#include "messagefilter.h"
#include "utils.h"
#include "warning.h"
namespace PlogConverter
{
class SuppressFilter : public IMessageFilter
{
private:
struct File
{
std::string name;
unsigned int line = 0;
static inline bool CheckLine(const Warning& message, const File& file)
{
return file.line == 0 || message.GetLine() == file.line;
}
static inline bool CheckName(const Warning& message, const File& file)
{
return message.GetFile().find(file.name) != std::string::npos;
}
};
std::set<std::string> m_disabledWarnings;
std::vector<int8_t> m_enabledAnalyzerLevels;
std::vector<File> m_enabledFiles;
std::vector<uint32_t> m_enabledWarnings;
public:
explicit SuppressFilter(const ProgramOptions& options);
~SuppressFilter() override;
bool Check(const Warning& message) const override;
private:
bool CheckCode(const Warning& message) const;
bool CheckFalseAlarm(const Warning& message) const;
bool CheckFiles(const Warning& message) const;
bool CheckLevel(const Warning& message) const;
bool CheckWarnings(const Warning& message) const;
};
}
#endif // SUPPRESSFILTER_H