2013-11-04 22:33:31 +01:00
|
|
|
//===-- sanitizer_suppressions.h --------------------------------*- C++ -*-===//
|
|
|
|
//
|
2019-08-14 10:47:11 +02:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2013-11-04 22:33:31 +01:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
2015-10-21 09:32:45 +02:00
|
|
|
// Suppression parsing/matching code.
|
2013-11-04 22:33:31 +01:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef SANITIZER_SUPPRESSIONS_H
|
|
|
|
#define SANITIZER_SUPPRESSIONS_H
|
|
|
|
|
|
|
|
#include "sanitizer_common.h"
|
2015-10-21 09:32:45 +02:00
|
|
|
#include "sanitizer_atomic.h"
|
2013-11-04 22:33:31 +01:00
|
|
|
#include "sanitizer_internal_defs.h"
|
|
|
|
|
|
|
|
namespace __sanitizer {
|
|
|
|
|
|
|
|
struct Suppression {
|
2016-11-08 23:04:09 +01:00
|
|
|
Suppression() { internal_memset(this, 0, sizeof(*this)); }
|
2015-10-21 09:32:45 +02:00
|
|
|
const char *type;
|
2013-11-04 22:33:31 +01:00
|
|
|
char *templ;
|
2015-10-21 09:32:45 +02:00
|
|
|
atomic_uint32_t hit_count;
|
2013-11-04 22:33:31 +01:00
|
|
|
uptr weight;
|
|
|
|
};
|
|
|
|
|
|
|
|
class SuppressionContext {
|
|
|
|
public:
|
2015-10-21 09:32:45 +02:00
|
|
|
// Create new SuppressionContext capable of parsing given suppression types.
|
|
|
|
SuppressionContext(const char *supprression_types[],
|
|
|
|
int suppression_types_num);
|
|
|
|
|
|
|
|
void ParseFromFile(const char *filename);
|
2013-11-04 22:33:31 +01:00
|
|
|
void Parse(const char *str);
|
2015-10-21 09:32:45 +02:00
|
|
|
|
|
|
|
bool Match(const char *str, const char *type, Suppression **s);
|
2013-12-05 10:18:38 +01:00
|
|
|
uptr SuppressionCount() const;
|
2015-10-21 09:32:45 +02:00
|
|
|
bool HasSuppressionType(const char *type) const;
|
2013-12-05 10:18:38 +01:00
|
|
|
const Suppression *SuppressionAt(uptr i) const;
|
2013-11-04 22:33:31 +01:00
|
|
|
void GetMatched(InternalMmapVector<Suppression *> *matched);
|
|
|
|
|
|
|
|
private:
|
2019-11-05 14:54:57 +01:00
|
|
|
static const int kMaxSuppressionTypes = 64;
|
2015-10-21 09:32:45 +02:00
|
|
|
const char **const suppression_types_;
|
|
|
|
const int suppression_types_num_;
|
|
|
|
|
2013-11-04 22:33:31 +01:00
|
|
|
InternalMmapVector<Suppression> suppressions_;
|
2015-10-21 09:32:45 +02:00
|
|
|
bool has_suppression_type_[kMaxSuppressionTypes];
|
2013-11-04 22:33:31 +01:00
|
|
|
bool can_parse_;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace __sanitizer
|
|
|
|
|
|
|
|
#endif // SANITIZER_SUPPRESSIONS_H
|