xref: /freebsd/contrib/llvm-project/compiler-rt/lib/tsan/rtl/tsan_ignoreset.h (revision a90b9d0159070121c221b966469c3e36d912bf82)
1 //===-- tsan_ignoreset.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 // This file is a part of ThreadSanitizer (TSan), a race detector.
10 //
11 // IgnoreSet holds a set of stack traces where ignores were enabled.
12 //===----------------------------------------------------------------------===//
13 #ifndef TSAN_IGNORESET_H
14 #define TSAN_IGNORESET_H
15 
16 #include "tsan_defs.h"
17 
18 namespace __tsan {
19 
20 class IgnoreSet {
21  public:
22   IgnoreSet();
23   void Add(StackID stack_id);
24   void Reset() { size_ = 0; }
25   uptr Size() const { return size_; }
26   StackID At(uptr i) const;
27 
28  private:
29   static constexpr uptr kMaxSize = 16;
30   uptr size_;
31   StackID stacks_[kMaxSize];
32 };
33 
34 }  // namespace __tsan
35 
36 #endif  // TSAN_IGNORESET_H
37