]> git.ipfire.org Git - thirdparty/gcc.git/blame - libsanitizer/sanitizer_common/sanitizer_suppressions.h
libsanitizer merge from upstream r209283
[thirdparty/gcc.git] / libsanitizer / sanitizer_common / sanitizer_suppressions.h
CommitLineData
ef1b3fda
KS
1//===-- sanitizer_suppressions.h --------------------------------*- C++ -*-===//
2//
3// This file is distributed under the University of Illinois Open Source
4// License. See LICENSE.TXT for details.
5//
6//===----------------------------------------------------------------------===//
7//
8// Suppression parsing/matching code shared between TSan and LSan.
9//
10//===----------------------------------------------------------------------===//
11#ifndef SANITIZER_SUPPRESSIONS_H
12#define SANITIZER_SUPPRESSIONS_H
13
14#include "sanitizer_common.h"
15#include "sanitizer_internal_defs.h"
16
17namespace __sanitizer {
18
19enum SuppressionType {
20 SuppressionNone,
21 SuppressionRace,
22 SuppressionMutex,
23 SuppressionThread,
24 SuppressionSignal,
25 SuppressionLeak,
df77f0e4 26 SuppressionLib,
dee5ea7a 27 SuppressionDeadlock,
ef1b3fda
KS
28 SuppressionTypeCount
29};
30
31struct Suppression {
32 SuppressionType type;
33 char *templ;
34 unsigned hit_count;
35 uptr weight;
36};
37
38class SuppressionContext {
39 public:
40 SuppressionContext() : suppressions_(1), can_parse_(true) {}
41 void Parse(const char *str);
42 bool Match(const char* str, SuppressionType type, Suppression **s);
df77f0e4
KS
43 uptr SuppressionCount() const;
44 const Suppression *SuppressionAt(uptr i) const;
ef1b3fda
KS
45 void GetMatched(InternalMmapVector<Suppression *> *matched);
46
47 private:
48 InternalMmapVector<Suppression> suppressions_;
49 bool can_parse_;
50
51 friend class SuppressionContextTest;
52};
53
54const char *SuppressionTypeString(SuppressionType t);
55
ef1b3fda
KS
56bool TemplateMatch(char *templ, const char *str);
57
58} // namespace __sanitizer
59
60#endif // SANITIZER_SUPPRESSIONS_H