libstdc++: Use variable template to fix -fconcepts-ts error [PR113366]
[official-gcc.git] / libsanitizer / tsan / tsan_ignoreset.cpp
blob1fca1cf4f9fcf254ccf838eb1e58751b77058f1e
1 //===-- tsan_ignoreset.cpp ------------------------------------------------===//
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.
11 //===----------------------------------------------------------------------===//
12 #include "tsan_ignoreset.h"
14 namespace __tsan {
16 const uptr IgnoreSet::kMaxSize;
18 IgnoreSet::IgnoreSet()
19 : size_() {
22 void IgnoreSet::Add(StackID stack_id) {
23 if (size_ == kMaxSize)
24 return;
25 for (uptr i = 0; i < size_; i++) {
26 if (stacks_[i] == stack_id)
27 return;
29 stacks_[size_++] = stack_id;
32 StackID IgnoreSet::At(uptr i) const {
33 CHECK_LT(i, size_);
34 CHECK_LE(size_, kMaxSize);
35 return stacks_[i];
38 } // namespace __tsan