Delete changes meant for a private branch.
[official-gcc.git] / libsanitizer / sanitizer_common / sanitizer_suppressions.h
blob2d88b1f72fa6d8a2e56e753aa903bfa40321c1c5
1 //===-- sanitizer_suppressions.h --------------------------------*- C++ -*-===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
8 //
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 {
21 struct Suppression {
22 Suppression() { internal_memset(this, 0, sizeof(*this)); }
23 const char *type;
24 char *templ;
25 atomic_uint32_t hit_count;
26 uptr weight;
29 class SuppressionContext {
30 public:
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);
44 private:
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];
51 bool can_parse_;
54 } // namespace __sanitizer
56 #endif // SANITIZER_SUPPRESSIONS_H