1 //===-- sanitizer_suppressions.h --------------------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // Suppression parsing/matching code.
11 //===----------------------------------------------------------------------===//
12 #ifndef SANITIZER_SUPPRESSIONS_H
13 #define SANITIZER_SUPPRESSIONS_H
15 #include "sanitizer_common.h"
16 #include "sanitizer_atomic.h"
17 #include "sanitizer_internal_defs.h"
19 namespace __sanitizer
{
22 Suppression() { internal_memset(this, 0, sizeof(*this)); }
25 atomic_uint32_t hit_count
;
29 class SuppressionContext
{
31 // Create new SuppressionContext capable of parsing given suppression types.
32 SuppressionContext(const char *supprression_types
[],
33 int suppression_types_num
);
35 void ParseFromFile(const char *filename
);
36 void Parse(const char *str
);
38 bool Match(const char *str
, const char *type
, Suppression
**s
);
39 uptr
SuppressionCount() const;
40 bool HasSuppressionType(const char *type
) const;
41 const Suppression
*SuppressionAt(uptr i
) const;
42 void GetMatched(InternalMmapVector
<Suppression
*> *matched
);
45 static const int kMaxSuppressionTypes
= 64;
46 const char **const suppression_types_
;
47 const int suppression_types_num_
;
49 InternalMmapVector
<Suppression
> suppressions_
;
50 bool has_suppression_type_
[kMaxSuppressionTypes
];
54 } // namespace __sanitizer
56 #endif // SANITIZER_SUPPRESSIONS_H