aboutsummaryrefslogtreecommitdiff
path: root/lib/sanitizer_common/sanitizer_suppressions.h
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2014-11-06 22:49:13 +0000
committerDimitry Andric <dim@FreeBSD.org>2014-11-06 22:49:13 +0000
commit8ef50bf3d1c287b5013c3168de77a462dfce3495 (patch)
tree3467f3372c1195b1546172d89af2205a50b1866d /lib/sanitizer_common/sanitizer_suppressions.h
parent11023dc647fd8f41418da90d59db138400d0f334 (diff)
downloadsrc-8ef50bf3d1c287b5013c3168de77a462dfce3495.tar.gz
src-8ef50bf3d1c287b5013c3168de77a462dfce3495.zip
Import compiler-rt release_34 branch r197381.vendor/compiler-rt/compiler-rt-r197381
Notes
Notes: svn path=/vendor/compiler-rt/dist/; revision=274201 svn path=/vendor/compiler-rt/compiler-rt-r197381/; revision=274202; tag=vendor/compiler-rt/compiler-rt-r197381
Diffstat (limited to 'lib/sanitizer_common/sanitizer_suppressions.h')
-rw-r--r--lib/sanitizer_common/sanitizer_suppressions.h61
1 files changed, 61 insertions, 0 deletions
diff --git a/lib/sanitizer_common/sanitizer_suppressions.h b/lib/sanitizer_common/sanitizer_suppressions.h
new file mode 100644
index 000000000000..92cb09365b5e
--- /dev/null
+++ b/lib/sanitizer_common/sanitizer_suppressions.h
@@ -0,0 +1,61 @@
+//===-- sanitizer_suppressions.h --------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// Suppression parsing/matching code shared between TSan and LSan.
+//
+//===----------------------------------------------------------------------===//
+#ifndef SANITIZER_SUPPRESSIONS_H
+#define SANITIZER_SUPPRESSIONS_H
+
+#include "sanitizer_common.h"
+#include "sanitizer_internal_defs.h"
+
+namespace __sanitizer {
+
+enum SuppressionType {
+ SuppressionNone,
+ SuppressionRace,
+ SuppressionMutex,
+ SuppressionThread,
+ SuppressionSignal,
+ SuppressionLeak,
+ SuppressionLib,
+ SuppressionTypeCount
+};
+
+struct Suppression {
+ SuppressionType type;
+ char *templ;
+ unsigned hit_count;
+ uptr weight;
+};
+
+class SuppressionContext {
+ public:
+ SuppressionContext() : suppressions_(1), can_parse_(true) {}
+ void Parse(const char *str);
+ bool Match(const char* str, SuppressionType type, Suppression **s);
+ uptr SuppressionCount() const;
+ const Suppression *SuppressionAt(uptr i) const;
+ void GetMatched(InternalMmapVector<Suppression *> *matched);
+
+ private:
+ InternalMmapVector<Suppression> suppressions_;
+ bool can_parse_;
+
+ friend class SuppressionContextTest;
+};
+
+const char *SuppressionTypeString(SuppressionType t);
+
+bool TemplateMatch(char *templ, const char *str);
+
+} // namespace __sanitizer
+
+#endif // SANITIZER_SUPPRESSIONS_H