1 //===-- sanitizer_suppressions.h --------------------------------*- C++ -*-===//
3 // This file is distributed under the University of Illinois Open Source
4 // License. See LICENSE.TXT for details.
6 //===----------------------------------------------------------------------===//
8 // Suppression parsing/matching code shared between TSan and LSan.
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
{
39 class SuppressionContext
{
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();
55 SuppressionContext() : suppressions_(1), can_parse_(true) {}
56 InternalMmapVector
<Suppression
> suppressions_
;
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