Path: blob/main/contrib/llvm-project/compiler-rt/lib/tsan/rtl/tsan_ignoreset.cpp
35268 views
//===-- tsan_ignoreset.cpp ------------------------------------------------===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7//8// This file is a part of ThreadSanitizer (TSan), a race detector.9//10//===----------------------------------------------------------------------===//11#include "tsan_ignoreset.h"1213namespace __tsan {1415const uptr IgnoreSet::kMaxSize;1617IgnoreSet::IgnoreSet()18: size_() {19}2021void IgnoreSet::Add(StackID stack_id) {22if (size_ == kMaxSize)23return;24for (uptr i = 0; i < size_; i++) {25if (stacks_[i] == stack_id)26return;27}28stacks_[size_++] = stack_id;29}3031StackID IgnoreSet::At(uptr i) const {32CHECK_LT(i, size_);33CHECK_LE(size_, kMaxSize);34return stacks_[i];35}3637} // namespace __tsan383940