Merge trunk version 208955 into gupc branch.
[official-gcc.git] / libsanitizer / tsan / tsan_ignoreset.cc
blobf0aec42eb6156f7f104edbc8e9dd801e84526d59
1 //===-- tsan_ignoreset.cc -------------------------------------------------===//
2 //
3 // This file is distributed under the University of Illinois Open Source
4 // License. See LICENSE.TXT for details.
5 //
6 //===----------------------------------------------------------------------===//
7 //
8 // This file is a part of ThreadSanitizer (TSan), a race detector.
9 //
10 //===----------------------------------------------------------------------===//
11 #include "tsan_ignoreset.h"
13 namespace __tsan {
15 const uptr IgnoreSet::kMaxSize;
17 IgnoreSet::IgnoreSet()
18 : size_() {
21 void IgnoreSet::Add(u32 stack_id) {
22 if (size_ == kMaxSize)
23 return;
24 for (uptr i = 0; i < size_; i++) {
25 if (stacks_[i] == stack_id)
26 return;
28 stacks_[size_++] = stack_id;
31 void IgnoreSet::Reset() {
32 size_ = 0;
35 uptr IgnoreSet::Size() const {
36 return size_;
39 u32 IgnoreSet::At(uptr i) const {
40 CHECK_LT(i, size_);
41 CHECK_LE(size_, kMaxSize);
42 return stacks_[i];
45 } // namespace __tsan