[analyzer][Z3] Restore the original timeout of 15s (#118291)
[llvm-project.git] / libcxx / test / std / utilities / memory / allocator.uses / allocator.uses.construction / common.h
blob48b0fa85a8c23864c51adf2926ab5b35b964f6de
1 //===----------------------------------------------------------------------===//
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 //===----------------------------------------------------------------------===//
9 #include "test_allocator.h"
11 using Alloc = test_allocator<int>;
13 enum class RefType {
14 LValue,
15 ConstLValue,
16 RValue,
17 ConstRValue,
20 struct UsesAllocArgT {
21 using allocator_type = Alloc;
23 bool allocator_constructed_ = false;
24 Alloc a_;
25 const Alloc& alloc_ = a_;
26 const int* val_ptr_;
27 RefType ref_type_;
29 constexpr UsesAllocArgT() = default;
30 constexpr UsesAllocArgT(std::allocator_arg_t, const Alloc& alloc) : allocator_constructed_(true), alloc_(alloc) {}
31 constexpr UsesAllocArgT(std::allocator_arg_t, const Alloc& alloc, int& val)
32 : allocator_constructed_(true), alloc_(alloc), val_ptr_(&val), ref_type_(RefType::LValue) {}
33 constexpr UsesAllocArgT(std::allocator_arg_t, const Alloc& alloc, const int& val)
34 : allocator_constructed_(true), alloc_(alloc), val_ptr_(&val), ref_type_(RefType::ConstLValue) {}
35 constexpr UsesAllocArgT(std::allocator_arg_t, const Alloc& alloc, int&& val)
36 : allocator_constructed_(true), alloc_(alloc), val_ptr_(&val), ref_type_(RefType::RValue) {}
37 constexpr UsesAllocArgT(std::allocator_arg_t, const Alloc& alloc, const int&& val)
38 : allocator_constructed_(true), alloc_(alloc), val_ptr_(&val), ref_type_(RefType::ConstRValue) {}
41 struct UsesAllocLast {
42 using allocator_type = Alloc;
44 bool allocator_constructed_ = false;
45 Alloc a_;
46 const Alloc& alloc_ = a_;
47 const int* val_ptr_;
48 RefType ref_type_;
50 constexpr UsesAllocLast() = default;
51 constexpr UsesAllocLast(const Alloc& alloc) : allocator_constructed_(true), alloc_(alloc) {}
52 constexpr UsesAllocLast(int& val, const Alloc& alloc)
53 : allocator_constructed_(true), alloc_(alloc), val_ptr_(&val), ref_type_(RefType::LValue) {}
54 constexpr UsesAllocLast(const int& val, const Alloc& alloc)
55 : allocator_constructed_(true), alloc_(alloc), val_ptr_(&val), ref_type_(RefType::ConstLValue) {}
56 constexpr UsesAllocLast(int&& val, const Alloc& alloc)
57 : allocator_constructed_(true), alloc_(alloc), val_ptr_(&val), ref_type_(RefType::RValue) {}
58 constexpr UsesAllocLast(const int&& val, const Alloc& alloc)
59 : allocator_constructed_(true), alloc_(alloc), val_ptr_(&val), ref_type_(RefType::ConstRValue) {}
62 struct NotAllocatorAware {
63 bool allocator_constructed_ = false;
65 constexpr NotAllocatorAware() = default;
66 constexpr NotAllocatorAware(const Alloc&) : allocator_constructed_(true) {}
67 constexpr NotAllocatorAware(const Alloc&, int) : allocator_constructed_(true) {}
70 struct ConvertibleToPair {
71 constexpr operator std::pair<int, int>() const { return {1, 2}; }