* config/nvptx/nvptx.c (nvptx_reorg): Remove unused vars. Fix
[official-gcc.git] / libsanitizer / sanitizer_common / sanitizer_suppressions.h
blob84ee834a9fdd6bdf506e952bf576e6d5f066af07
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
14 #include "sanitizer_common.h"
15 #include "sanitizer_internal_defs.h"
17 namespace __sanitizer {
19 enum SuppressionType {
20 SuppressionNone,
21 SuppressionRace,
22 SuppressionMutex,
23 SuppressionThread,
24 SuppressionSignal,
25 SuppressionLeak,
26 SuppressionLib,
27 SuppressionDeadlock,
28 SuppressionVptrCheck,
29 SuppressionTypeCount
32 struct Suppression {
33 SuppressionType type;
34 char *templ;
35 unsigned hit_count;
36 uptr weight;
39 class SuppressionContext {
40 public:
41 void Parse(const char *str);
42 bool Match(const char* str, SuppressionType type, Suppression **s);
43 uptr SuppressionCount() const;
44 const Suppression *SuppressionAt(uptr i) const;
45 void GetMatched(InternalMmapVector<Suppression *> *matched);
47 // Create a SuppressionContext singleton if it hasn't been created earlier.
48 // Not thread safe. Must be called early during initialization (but after
49 // runtime flags are parsed).
50 static void InitIfNecessary();
51 // Returns a SuppressionContext singleton.
52 static SuppressionContext *Get();
54 private:
55 SuppressionContext() : suppressions_(1), can_parse_(true) {}
56 InternalMmapVector<Suppression> suppressions_;
57 bool can_parse_;
59 friend class SuppressionContextTest;
62 const char *SuppressionTypeString(SuppressionType t);
64 bool TemplateMatch(char *templ, const char *str);
66 } // namespace __sanitizer
68 #endif // SANITIZER_SUPPRESSIONS_H