Coverage Report

Created: 2025-06-13 06:55

/src/spirv-cross/spirv_cross_containers.hpp
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * Copyright 2019-2021 Hans-Kristian Arntzen
3
 * SPDX-License-Identifier: Apache-2.0 OR MIT
4
 *
5
 * Licensed under the Apache License, Version 2.0 (the "License");
6
 * you may not use this file except in compliance with the License.
7
 * You may obtain a copy of the License at
8
 *
9
 *     http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
18
/*
19
 * At your option, you may choose to accept this material under either:
20
 *  1. The Apache License, Version 2.0, found at <http://www.apache.org/licenses/LICENSE-2.0>, or
21
 *  2. The MIT License, found at <http://opensource.org/licenses/MIT>.
22
 */
23
24
#ifndef SPIRV_CROSS_CONTAINERS_HPP
25
#define SPIRV_CROSS_CONTAINERS_HPP
26
27
#include "spirv_cross_error_handling.hpp"
28
#include <algorithm>
29
#include <exception>
30
#include <functional>
31
#include <iterator>
32
#include <limits>
33
#include <memory>
34
#include <stack>
35
#include <stddef.h>
36
#include <stdint.h>
37
#include <stdlib.h>
38
#include <string.h>
39
#include <type_traits>
40
#include <unordered_map>
41
#include <unordered_set>
42
#include <utility>
43
#include <vector>
44
45
#ifdef SPIRV_CROSS_NAMESPACE_OVERRIDE
46
#define SPIRV_CROSS_NAMESPACE SPIRV_CROSS_NAMESPACE_OVERRIDE
47
#else
48
#define SPIRV_CROSS_NAMESPACE spirv_cross
49
#endif
50
51
namespace SPIRV_CROSS_NAMESPACE
52
{
53
#ifndef SPIRV_CROSS_FORCE_STL_TYPES
54
// std::aligned_storage does not support size == 0, so roll our own.
55
template <typename T, size_t N>
56
class AlignedBuffer
57
{
58
public:
59
  T *data()
60
534k
  {
61
#if defined(_MSC_VER) && _MSC_VER < 1900
62
    // MSVC 2013 workarounds, sigh ...
63
    // Only use this workaround on MSVC 2013 due to some confusion around default initialized unions.
64
    // Spec seems to suggest the memory will be zero-initialized, which is *not* what we want.
65
    return reinterpret_cast<T *>(u.aligned_char);
66
#else
67
534k
    return reinterpret_cast<T *>(aligned_char);
68
534k
#endif
69
534k
  }
spirv_cross::AlignedBuffer<std::__1::pair<unsigned int, unsigned int>, 8ul>::data()
Line
Count
Source
60
1.26k
  {
61
#if defined(_MSC_VER) && _MSC_VER < 1900
62
    // MSVC 2013 workarounds, sigh ...
63
    // Only use this workaround on MSVC 2013 due to some confusion around default initialized unions.
64
    // Spec seems to suggest the memory will be zero-initialized, which is *not* what we want.
65
    return reinterpret_cast<T *>(u.aligned_char);
66
#else
67
1.26k
    return reinterpret_cast<T *>(aligned_char);
68
1.26k
#endif
69
1.26k
  }
spirv_cross::AlignedBuffer<unsigned int, 8ul>::data()
Line
Count
Source
60
139k
  {
61
#if defined(_MSC_VER) && _MSC_VER < 1900
62
    // MSVC 2013 workarounds, sigh ...
63
    // Only use this workaround on MSVC 2013 due to some confusion around default initialized unions.
64
    // Spec seems to suggest the memory will be zero-initialized, which is *not* what we want.
65
    return reinterpret_cast<T *>(u.aligned_char);
66
#else
67
139k
    return reinterpret_cast<T *>(aligned_char);
68
139k
#endif
69
139k
  }
spirv_cross::AlignedBuffer<spirv_cross::TypedID<(spirv_cross::Types)2>, 8ul>::data()
Line
Count
Source
60
62.9k
  {
61
#if defined(_MSC_VER) && _MSC_VER < 1900
62
    // MSVC 2013 workarounds, sigh ...
63
    // Only use this workaround on MSVC 2013 due to some confusion around default initialized unions.
64
    // Spec seems to suggest the memory will be zero-initialized, which is *not* what we want.
65
    return reinterpret_cast<T *>(u.aligned_char);
66
#else
67
62.9k
    return reinterpret_cast<T *>(aligned_char);
68
62.9k
#endif
69
62.9k
  }
spirv_cross::AlignedBuffer<unsigned char, 8ul>::data()
Line
Count
Source
60
1.75k
  {
61
#if defined(_MSC_VER) && _MSC_VER < 1900
62
    // MSVC 2013 workarounds, sigh ...
63
    // Only use this workaround on MSVC 2013 due to some confusion around default initialized unions.
64
    // Spec seems to suggest the memory will be zero-initialized, which is *not* what we want.
65
    return reinterpret_cast<T *>(u.aligned_char);
66
#else
67
1.75k
    return reinterpret_cast<T *>(aligned_char);
68
1.75k
#endif
69
1.75k
  }
spirv_cross::AlignedBuffer<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, 8ul>::data()
Line
Count
Source
60
1.50k
  {
61
#if defined(_MSC_VER) && _MSC_VER < 1900
62
    // MSVC 2013 workarounds, sigh ...
63
    // Only use this workaround on MSVC 2013 due to some confusion around default initialized unions.
64
    // Spec seems to suggest the memory will be zero-initialized, which is *not* what we want.
65
    return reinterpret_cast<T *>(u.aligned_char);
66
#else
67
1.50k
    return reinterpret_cast<T *>(aligned_char);
68
1.50k
#endif
69
1.50k
  }
spirv_cross::AlignedBuffer<spv::Capability, 8ul>::data()
Line
Count
Source
60
1.25k
  {
61
#if defined(_MSC_VER) && _MSC_VER < 1900
62
    // MSVC 2013 workarounds, sigh ...
63
    // Only use this workaround on MSVC 2013 due to some confusion around default initialized unions.
64
    // Spec seems to suggest the memory will be zero-initialized, which is *not* what we want.
65
    return reinterpret_cast<T *>(u.aligned_char);
66
#else
67
1.25k
    return reinterpret_cast<T *>(aligned_char);
68
1.25k
#endif
69
1.25k
  }
spirv_cross::AlignedBuffer<spirv_cross::TypedID<(spirv_cross::Types)0>, 8ul>::data()
Line
Count
Source
60
61.0k
  {
61
#if defined(_MSC_VER) && _MSC_VER < 1900
62
    // MSVC 2013 workarounds, sigh ...
63
    // Only use this workaround on MSVC 2013 due to some confusion around default initialized unions.
64
    // Spec seems to suggest the memory will be zero-initialized, which is *not* what we want.
65
    return reinterpret_cast<T *>(u.aligned_char);
66
#else
67
61.0k
    return reinterpret_cast<T *>(aligned_char);
68
61.0k
#endif
69
61.0k
  }
spirv_cross::AlignedBuffer<spirv_cross::Variant, 8ul>::data()
Line
Count
Source
60
1.75k
  {
61
#if defined(_MSC_VER) && _MSC_VER < 1900
62
    // MSVC 2013 workarounds, sigh ...
63
    // Only use this workaround on MSVC 2013 due to some confusion around default initialized unions.
64
    // Spec seems to suggest the memory will be zero-initialized, which is *not* what we want.
65
    return reinterpret_cast<T *>(u.aligned_char);
66
#else
67
1.75k
    return reinterpret_cast<T *>(aligned_char);
68
1.75k
#endif
69
1.75k
  }
Unexecuted instantiation: spirv_cross::AlignedBuffer<spirv_cross::StringStream<4096ul, 4096ul>::Buffer, 8ul>::data()
spirv_cross::AlignedBuffer<std::__1::unique_ptr<spirv_cross::SPIRUndef, spirv_cross::ObjectPool<spirv_cross::SPIRUndef>::MallocDeleter>, 8ul>::data()
Line
Count
Source
60
1.20k
  {
61
#if defined(_MSC_VER) && _MSC_VER < 1900
62
    // MSVC 2013 workarounds, sigh ...
63
    // Only use this workaround on MSVC 2013 due to some confusion around default initialized unions.
64
    // Spec seems to suggest the memory will be zero-initialized, which is *not* what we want.
65
    return reinterpret_cast<T *>(u.aligned_char);
66
#else
67
1.20k
    return reinterpret_cast<T *>(aligned_char);
68
1.20k
#endif
69
1.20k
  }
spirv_cross::AlignedBuffer<std::__1::unique_ptr<spirv_cross::SPIRString, spirv_cross::ObjectPool<spirv_cross::SPIRString>::MallocDeleter>, 8ul>::data()
Line
Count
Source
60
1.20k
  {
61
#if defined(_MSC_VER) && _MSC_VER < 1900
62
    // MSVC 2013 workarounds, sigh ...
63
    // Only use this workaround on MSVC 2013 due to some confusion around default initialized unions.
64
    // Spec seems to suggest the memory will be zero-initialized, which is *not* what we want.
65
    return reinterpret_cast<T *>(u.aligned_char);
66
#else
67
1.20k
    return reinterpret_cast<T *>(aligned_char);
68
1.20k
#endif
69
1.20k
  }
spirv_cross::AlignedBuffer<std::__1::unique_ptr<spirv_cross::SPIRCombinedImageSampler, spirv_cross::ObjectPool<spirv_cross::SPIRCombinedImageSampler>::MallocDeleter>, 8ul>::data()
Line
Count
Source
60
1.20k
  {
61
#if defined(_MSC_VER) && _MSC_VER < 1900
62
    // MSVC 2013 workarounds, sigh ...
63
    // Only use this workaround on MSVC 2013 due to some confusion around default initialized unions.
64
    // Spec seems to suggest the memory will be zero-initialized, which is *not* what we want.
65
    return reinterpret_cast<T *>(u.aligned_char);
66
#else
67
1.20k
    return reinterpret_cast<T *>(aligned_char);
68
1.20k
#endif
69
1.20k
  }
spirv_cross::AlignedBuffer<std::__1::unique_ptr<spirv_cross::SPIRConstantOp, spirv_cross::ObjectPool<spirv_cross::SPIRConstantOp>::MallocDeleter>, 8ul>::data()
Line
Count
Source
60
1.20k
  {
61
#if defined(_MSC_VER) && _MSC_VER < 1900
62
    // MSVC 2013 workarounds, sigh ...
63
    // Only use this workaround on MSVC 2013 due to some confusion around default initialized unions.
64
    // Spec seems to suggest the memory will be zero-initialized, which is *not* what we want.
65
    return reinterpret_cast<T *>(u.aligned_char);
66
#else
67
1.20k
    return reinterpret_cast<T *>(aligned_char);
68
1.20k
#endif
69
1.20k
  }
spirv_cross::AlignedBuffer<bool, 8ul>::data()
Line
Count
Source
60
45.0k
  {
61
#if defined(_MSC_VER) && _MSC_VER < 1900
62
    // MSVC 2013 workarounds, sigh ...
63
    // Only use this workaround on MSVC 2013 due to some confusion around default initialized unions.
64
    // Spec seems to suggest the memory will be zero-initialized, which is *not* what we want.
65
    return reinterpret_cast<T *>(u.aligned_char);
66
#else
67
45.0k
    return reinterpret_cast<T *>(aligned_char);
68
45.0k
#endif
69
45.0k
  }
spirv_cross::AlignedBuffer<spirv_cross::TypedID<(spirv_cross::Types)1>, 8ul>::data()
Line
Count
Source
60
44.5k
  {
61
#if defined(_MSC_VER) && _MSC_VER < 1900
62
    // MSVC 2013 workarounds, sigh ...
63
    // Only use this workaround on MSVC 2013 due to some confusion around default initialized unions.
64
    // Spec seems to suggest the memory will be zero-initialized, which is *not* what we want.
65
    return reinterpret_cast<T *>(u.aligned_char);
66
#else
67
44.5k
    return reinterpret_cast<T *>(aligned_char);
68
44.5k
#endif
69
44.5k
  }
spirv_cross::AlignedBuffer<std::__1::unique_ptr<spirv_cross::SPIRType, spirv_cross::ObjectPool<spirv_cross::SPIRType>::MallocDeleter>, 8ul>::data()
Line
Count
Source
60
1.20k
  {
61
#if defined(_MSC_VER) && _MSC_VER < 1900
62
    // MSVC 2013 workarounds, sigh ...
63
    // Only use this workaround on MSVC 2013 due to some confusion around default initialized unions.
64
    // Spec seems to suggest the memory will be zero-initialized, which is *not* what we want.
65
    return reinterpret_cast<T *>(u.aligned_char);
66
#else
67
1.20k
    return reinterpret_cast<T *>(aligned_char);
68
1.20k
#endif
69
1.20k
  }
spirv_cross::AlignedBuffer<std::__1::unique_ptr<spirv_cross::SPIRExtension, spirv_cross::ObjectPool<spirv_cross::SPIRExtension>::MallocDeleter>, 8ul>::data()
Line
Count
Source
60
1.20k
  {
61
#if defined(_MSC_VER) && _MSC_VER < 1900
62
    // MSVC 2013 workarounds, sigh ...
63
    // Only use this workaround on MSVC 2013 due to some confusion around default initialized unions.
64
    // Spec seems to suggest the memory will be zero-initialized, which is *not* what we want.
65
    return reinterpret_cast<T *>(u.aligned_char);
66
#else
67
1.20k
    return reinterpret_cast<T *>(aligned_char);
68
1.20k
#endif
69
1.20k
  }
spirv_cross::AlignedBuffer<std::__1::unique_ptr<spirv_cross::SPIRExpression, spirv_cross::ObjectPool<spirv_cross::SPIRExpression>::MallocDeleter>, 8ul>::data()
Line
Count
Source
60
1.20k
  {
61
#if defined(_MSC_VER) && _MSC_VER < 1900
62
    // MSVC 2013 workarounds, sigh ...
63
    // Only use this workaround on MSVC 2013 due to some confusion around default initialized unions.
64
    // Spec seems to suggest the memory will be zero-initialized, which is *not* what we want.
65
    return reinterpret_cast<T *>(u.aligned_char);
66
#else
67
1.20k
    return reinterpret_cast<T *>(aligned_char);
68
1.20k
#endif
69
1.20k
  }
spirv_cross::AlignedBuffer<std::__1::unique_ptr<spirv_cross::SPIRFunctionPrototype, spirv_cross::ObjectPool<spirv_cross::SPIRFunctionPrototype>::MallocDeleter>, 8ul>::data()
Line
Count
Source
60
1.20k
  {
61
#if defined(_MSC_VER) && _MSC_VER < 1900
62
    // MSVC 2013 workarounds, sigh ...
63
    // Only use this workaround on MSVC 2013 due to some confusion around default initialized unions.
64
    // Spec seems to suggest the memory will be zero-initialized, which is *not* what we want.
65
    return reinterpret_cast<T *>(u.aligned_char);
66
#else
67
1.20k
    return reinterpret_cast<T *>(aligned_char);
68
1.20k
#endif
69
1.20k
  }
spirv_cross::AlignedBuffer<std::__1::unique_ptr<spirv_cross::SPIRBlock, spirv_cross::ObjectPool<spirv_cross::SPIRBlock>::MallocDeleter>, 8ul>::data()
Line
Count
Source
60
1.20k
  {
61
#if defined(_MSC_VER) && _MSC_VER < 1900
62
    // MSVC 2013 workarounds, sigh ...
63
    // Only use this workaround on MSVC 2013 due to some confusion around default initialized unions.
64
    // Spec seems to suggest the memory will be zero-initialized, which is *not* what we want.
65
    return reinterpret_cast<T *>(u.aligned_char);
66
#else
67
1.20k
    return reinterpret_cast<T *>(aligned_char);
68
1.20k
#endif
69
1.20k
  }
spirv_cross::AlignedBuffer<spirv_cross::Instruction, 8ul>::data()
Line
Count
Source
60
24.6k
  {
61
#if defined(_MSC_VER) && _MSC_VER < 1900
62
    // MSVC 2013 workarounds, sigh ...
63
    // Only use this workaround on MSVC 2013 due to some confusion around default initialized unions.
64
    // Spec seems to suggest the memory will be zero-initialized, which is *not* what we want.
65
    return reinterpret_cast<T *>(u.aligned_char);
66
#else
67
24.6k
    return reinterpret_cast<T *>(aligned_char);
68
24.6k
#endif
69
24.6k
  }
spirv_cross::AlignedBuffer<spirv_cross::SPIRBlock::Phi, 8ul>::data()
Line
Count
Source
60
19.7k
  {
61
#if defined(_MSC_VER) && _MSC_VER < 1900
62
    // MSVC 2013 workarounds, sigh ...
63
    // Only use this workaround on MSVC 2013 due to some confusion around default initialized unions.
64
    // Spec seems to suggest the memory will be zero-initialized, which is *not* what we want.
65
    return reinterpret_cast<T *>(u.aligned_char);
66
#else
67
19.7k
    return reinterpret_cast<T *>(aligned_char);
68
19.7k
#endif
69
19.7k
  }
spirv_cross::AlignedBuffer<std::__1::pair<spirv_cross::TypedID<(spirv_cross::Types)1>, spirv_cross::TypedID<(spirv_cross::Types)0> >, 8ul>::data()
Line
Count
Source
60
39.2k
  {
61
#if defined(_MSC_VER) && _MSC_VER < 1900
62
    // MSVC 2013 workarounds, sigh ...
63
    // Only use this workaround on MSVC 2013 due to some confusion around default initialized unions.
64
    // Spec seems to suggest the memory will be zero-initialized, which is *not* what we want.
65
    return reinterpret_cast<T *>(u.aligned_char);
66
#else
67
39.2k
    return reinterpret_cast<T *>(aligned_char);
68
39.2k
#endif
69
39.2k
  }
spirv_cross::AlignedBuffer<spirv_cross::SPIRBlock::Case, 8ul>::data()
Line
Count
Source
60
39.2k
  {
61
#if defined(_MSC_VER) && _MSC_VER < 1900
62
    // MSVC 2013 workarounds, sigh ...
63
    // Only use this workaround on MSVC 2013 due to some confusion around default initialized unions.
64
    // Spec seems to suggest the memory will be zero-initialized, which is *not* what we want.
65
    return reinterpret_cast<T *>(u.aligned_char);
66
#else
67
39.2k
    return reinterpret_cast<T *>(aligned_char);
68
39.2k
#endif
69
39.2k
  }
spirv_cross::AlignedBuffer<spirv_cross::SPIRFunction::Parameter, 8ul>::data()
Line
Count
Source
60
1.80k
  {
61
#if defined(_MSC_VER) && _MSC_VER < 1900
62
    // MSVC 2013 workarounds, sigh ...
63
    // Only use this workaround on MSVC 2013 due to some confusion around default initialized unions.
64
    // Spec seems to suggest the memory will be zero-initialized, which is *not* what we want.
65
    return reinterpret_cast<T *>(u.aligned_char);
66
#else
67
1.80k
    return reinterpret_cast<T *>(aligned_char);
68
1.80k
#endif
69
1.80k
  }
spirv_cross::AlignedBuffer<spirv_cross::TypedID<(spirv_cross::Types)6>, 8ul>::data()
Line
Count
Source
60
1.27k
  {
61
#if defined(_MSC_VER) && _MSC_VER < 1900
62
    // MSVC 2013 workarounds, sigh ...
63
    // Only use this workaround on MSVC 2013 due to some confusion around default initialized unions.
64
    // Spec seems to suggest the memory will be zero-initialized, which is *not* what we want.
65
    return reinterpret_cast<T *>(u.aligned_char);
66
#else
67
1.27k
    return reinterpret_cast<T *>(aligned_char);
68
1.27k
#endif
69
1.27k
  }
spirv_cross::AlignedBuffer<spirv_cross::SPIRFunction::CombinedImageSamplerParameter, 8ul>::data()
Line
Count
Source
60
900
  {
61
#if defined(_MSC_VER) && _MSC_VER < 1900
62
    // MSVC 2013 workarounds, sigh ...
63
    // Only use this workaround on MSVC 2013 due to some confusion around default initialized unions.
64
    // Spec seems to suggest the memory will be zero-initialized, which is *not* what we want.
65
    return reinterpret_cast<T *>(u.aligned_char);
66
#else
67
900
    return reinterpret_cast<T *>(aligned_char);
68
900
#endif
69
900
  }
spirv_cross::AlignedBuffer<std::__1::unique_ptr<spirv_cross::SPIRFunction, spirv_cross::ObjectPool<spirv_cross::SPIRFunction>::MallocDeleter>, 8ul>::data()
Line
Count
Source
60
1.20k
  {
61
#if defined(_MSC_VER) && _MSC_VER < 1900
62
    // MSVC 2013 workarounds, sigh ...
63
    // Only use this workaround on MSVC 2013 due to some confusion around default initialized unions.
64
    // Spec seems to suggest the memory will be zero-initialized, which is *not* what we want.
65
    return reinterpret_cast<T *>(u.aligned_char);
66
#else
67
1.20k
    return reinterpret_cast<T *>(aligned_char);
68
1.20k
#endif
69
1.20k
  }
spirv_cross::AlignedBuffer<std::__1::unique_ptr<spirv_cross::SPIRAccessChain, spirv_cross::ObjectPool<spirv_cross::SPIRAccessChain>::MallocDeleter>, 8ul>::data()
Line
Count
Source
60
1.20k
  {
61
#if defined(_MSC_VER) && _MSC_VER < 1900
62
    // MSVC 2013 workarounds, sigh ...
63
    // Only use this workaround on MSVC 2013 due to some confusion around default initialized unions.
64
    // Spec seems to suggest the memory will be zero-initialized, which is *not* what we want.
65
    return reinterpret_cast<T *>(u.aligned_char);
66
#else
67
1.20k
    return reinterpret_cast<T *>(aligned_char);
68
1.20k
#endif
69
1.20k
  }
spirv_cross::AlignedBuffer<std::__1::unique_ptr<spirv_cross::SPIRVariable, spirv_cross::ObjectPool<spirv_cross::SPIRVariable>::MallocDeleter>, 8ul>::data()
Line
Count
Source
60
1.20k
  {
61
#if defined(_MSC_VER) && _MSC_VER < 1900
62
    // MSVC 2013 workarounds, sigh ...
63
    // Only use this workaround on MSVC 2013 due to some confusion around default initialized unions.
64
    // Spec seems to suggest the memory will be zero-initialized, which is *not* what we want.
65
    return reinterpret_cast<T *>(u.aligned_char);
66
#else
67
1.20k
    return reinterpret_cast<T *>(aligned_char);
68
1.20k
#endif
69
1.20k
  }
spirv_cross::AlignedBuffer<spirv_cross::TypedID<(spirv_cross::Types)3>, 8ul>::data()
Line
Count
Source
60
30.7k
  {
61
#if defined(_MSC_VER) && _MSC_VER < 1900
62
    // MSVC 2013 workarounds, sigh ...
63
    // Only use this workaround on MSVC 2013 due to some confusion around default initialized unions.
64
    // Spec seems to suggest the memory will be zero-initialized, which is *not* what we want.
65
    return reinterpret_cast<T *>(u.aligned_char);
66
#else
67
30.7k
    return reinterpret_cast<T *>(aligned_char);
68
30.7k
#endif
69
30.7k
  }
spirv_cross::AlignedBuffer<std::__1::unique_ptr<spirv_cross::SPIRConstant, spirv_cross::ObjectPool<spirv_cross::SPIRConstant>::MallocDeleter>, 8ul>::data()
Line
Count
Source
60
1.20k
  {
61
#if defined(_MSC_VER) && _MSC_VER < 1900
62
    // MSVC 2013 workarounds, sigh ...
63
    // Only use this workaround on MSVC 2013 due to some confusion around default initialized unions.
64
    // Spec seems to suggest the memory will be zero-initialized, which is *not* what we want.
65
    return reinterpret_cast<T *>(u.aligned_char);
66
#else
67
1.20k
    return reinterpret_cast<T *>(aligned_char);
68
1.20k
#endif
69
1.20k
  }
70
71
private:
72
#if defined(_MSC_VER) && _MSC_VER < 1900
73
  // MSVC 2013 workarounds, sigh ...
74
  union
75
  {
76
    char aligned_char[sizeof(T) * N];
77
    double dummy_aligner;
78
  } u;
79
#else
80
  alignas(T) char aligned_char[sizeof(T) * N];
81
#endif
82
};
83
84
template <typename T>
85
class AlignedBuffer<T, 0>
86
{
87
public:
88
  T *data()
89
36.9k
  {
90
36.9k
    return nullptr;
91
36.9k
  }
spirv_cross::AlignedBuffer<spirv_cross::Meta::Decoration, 0ul>::data()
Line
Count
Source
89
16.7k
  {
90
16.7k
    return nullptr;
91
16.7k
  }
spirv_cross::AlignedBuffer<spirv_cross::SPIRUndef*, 0ul>::data()
Line
Count
Source
89
1.27k
  {
90
1.27k
    return nullptr;
91
1.27k
  }
spirv_cross::AlignedBuffer<spirv_cross::SPIRString*, 0ul>::data()
Line
Count
Source
89
1.20k
  {
90
1.20k
    return nullptr;
91
1.20k
  }
spirv_cross::AlignedBuffer<spirv_cross::SPIRCombinedImageSampler*, 0ul>::data()
Line
Count
Source
89
1.20k
  {
90
1.20k
    return nullptr;
91
1.20k
  }
spirv_cross::AlignedBuffer<spirv_cross::SPIRConstantOp*, 0ul>::data()
Line
Count
Source
89
1.21k
  {
90
1.21k
    return nullptr;
91
1.21k
  }
spirv_cross::AlignedBuffer<spirv_cross::SPIRType*, 0ul>::data()
Line
Count
Source
89
1.73k
  {
90
1.73k
    return nullptr;
91
1.73k
  }
spirv_cross::AlignedBuffer<spirv_cross::SPIRExtension*, 0ul>::data()
Line
Count
Source
89
1.48k
  {
90
1.48k
    return nullptr;
91
1.48k
  }
spirv_cross::AlignedBuffer<spirv_cross::SPIRExpression*, 0ul>::data()
Line
Count
Source
89
1.20k
  {
90
1.20k
    return nullptr;
91
1.20k
  }
spirv_cross::AlignedBuffer<spirv_cross::SPIRFunctionPrototype*, 0ul>::data()
Line
Count
Source
89
1.46k
  {
90
1.46k
    return nullptr;
91
1.46k
  }
spirv_cross::AlignedBuffer<spirv_cross::SPIRBlock*, 0ul>::data()
Line
Count
Source
89
1.62k
  {
90
1.62k
    return nullptr;
91
1.62k
  }
spirv_cross::AlignedBuffer<std::__1::function<void ()>, 0ul>::data()
Line
Count
Source
89
1.80k
  {
90
1.80k
    return nullptr;
91
1.80k
  }
spirv_cross::AlignedBuffer<spirv_cross::SPIRFunction*, 0ul>::data()
Line
Count
Source
89
1.42k
  {
90
1.42k
    return nullptr;
91
1.42k
  }
spirv_cross::AlignedBuffer<spirv_cross::SPIRAccessChain*, 0ul>::data()
Line
Count
Source
89
1.20k
  {
90
1.20k
    return nullptr;
91
1.20k
  }
spirv_cross::AlignedBuffer<spirv_cross::SPIRVariable*, 0ul>::data()
Line
Count
Source
89
1.59k
  {
90
1.59k
    return nullptr;
91
1.59k
  }
spirv_cross::AlignedBuffer<spirv_cross::SPIRConstant*, 0ul>::data()
Line
Count
Source
89
1.79k
  {
90
1.79k
    return nullptr;
91
1.79k
  }
92
};
93
94
// An immutable version of SmallVector which erases type information about storage.
95
template <typename T>
96
class VectorView
97
{
98
public:
99
  T &operator[](size_t i) SPIRV_CROSS_NOEXCEPT
100
398k
  {
101
398k
    return ptr[i];
102
398k
  }
spirv_cross::VectorView<spirv_cross::Variant>::operator[](unsigned long)
Line
Count
Source
100
363k
  {
101
363k
    return ptr[i];
102
363k
  }
spirv_cross::VectorView<unsigned char>::operator[](unsigned long)
Line
Count
Source
100
14.4k
  {
101
14.4k
    return ptr[i];
102
14.4k
  }
spirv_cross::VectorView<spirv_cross::Meta::Decoration>::operator[](unsigned long)
Line
Count
Source
100
10.9k
  {
101
10.9k
    return ptr[i];
102
10.9k
  }
spirv_cross::VectorView<unsigned int>::operator[](unsigned long)
Line
Count
Source
100
4.51k
  {
101
4.51k
    return ptr[i];
102
4.51k
  }
spirv_cross::VectorView<spirv_cross::TypedID<(spirv_cross::Types)1> >::operator[](unsigned long)
Line
Count
Source
100
4.51k
  {
101
4.51k
    return ptr[i];
102
4.51k
  }
103
104
  const T &operator[](size_t i) const SPIRV_CROSS_NOEXCEPT
105
7.03k
  {
106
7.03k
    return ptr[i];
107
7.03k
  }
spirv_cross::VectorView<spirv_cross::TypedID<(spirv_cross::Types)1> >::operator[](unsigned long) const
Line
Count
Source
105
3.51k
  {
106
3.51k
    return ptr[i];
107
3.51k
  }
spirv_cross::VectorView<spirv_cross::Variant>::operator[](unsigned long) const
Line
Count
Source
105
3.51k
  {
106
3.51k
    return ptr[i];
107
3.51k
  }
Unexecuted instantiation: spirv_cross::VectorView<spirv_cross::Meta::Decoration>::operator[](unsigned long) const
108
109
  bool empty() const SPIRV_CROSS_NOEXCEPT
110
142k
  {
111
142k
    return buffer_size == 0;
112
142k
  }
spirv_cross::VectorView<spirv_cross::SPIRUndef*>::empty() const
Line
Count
Source
110
3.62k
  {
111
3.62k
    return buffer_size == 0;
112
3.62k
  }
spirv_cross::VectorView<spirv_cross::SPIRString*>::empty() const
Line
Count
Source
110
1.77k
  {
111
1.77k
    return buffer_size == 0;
112
1.77k
  }
Unexecuted instantiation: spirv_cross::VectorView<spirv_cross::SPIRCombinedImageSampler*>::empty() const
spirv_cross::VectorView<spirv_cross::SPIRConstantOp*>::empty() const
Line
Count
Source
110
1.58k
  {
111
1.58k
    return buffer_size == 0;
112
1.58k
  }
spirv_cross::VectorView<spirv_cross::SPIRType*>::empty() const
Line
Count
Source
110
44.5k
  {
111
44.5k
    return buffer_size == 0;
112
44.5k
  }
spirv_cross::VectorView<spirv_cross::SPIRExtension*>::empty() const
Line
Count
Source
110
1.01k
  {
111
1.01k
    return buffer_size == 0;
112
1.01k
  }
Unexecuted instantiation: spirv_cross::VectorView<spirv_cross::SPIRExpression*>::empty() const
spirv_cross::VectorView<spirv_cross::SPIRFunctionPrototype*>::empty() const
Line
Count
Source
110
11.6k
  {
111
11.6k
    return buffer_size == 0;
112
11.6k
  }
spirv_cross::VectorView<spirv_cross::SPIRBlock*>::empty() const
Line
Count
Source
110
19.6k
  {
111
19.6k
    return buffer_size == 0;
112
19.6k
  }
spirv_cross::VectorView<spirv_cross::SPIRFunction*>::empty() const
Line
Count
Source
110
900
  {
111
900
    return buffer_size == 0;
112
900
  }
Unexecuted instantiation: spirv_cross::VectorView<spirv_cross::SPIRAccessChain*>::empty() const
spirv_cross::VectorView<spirv_cross::SPIRVariable*>::empty() const
Line
Count
Source
110
19.0k
  {
111
19.0k
    return buffer_size == 0;
112
19.0k
  }
Unexecuted instantiation: spirv_cross::VectorView<spirv_cross::TypedID<(spirv_cross::Types)3> >::empty() const
spirv_cross::VectorView<spirv_cross::SPIRConstant*>::empty() const
Line
Count
Source
110
25.3k
  {
111
25.3k
    return buffer_size == 0;
112
25.3k
  }
spirv_cross::VectorView<unsigned int>::empty() const
Line
Count
Source
110
7.55k
  {
111
7.55k
    return buffer_size == 0;
112
7.55k
  }
spirv_cross::VectorView<spirv_cross::TypedID<(spirv_cross::Types)1> >::empty() const
Line
Count
Source
110
6.38k
  {
111
6.38k
    return buffer_size == 0;
112
6.38k
  }
113
114
  size_t size() const SPIRV_CROSS_NOEXCEPT
115
37.9M
  {
116
37.9M
    return buffer_size;
117
37.9M
  }
spirv_cross::VectorView<std::__1::unique_ptr<spirv_cross::SPIRUndef, spirv_cross::ObjectPool<spirv_cross::SPIRUndef>::MallocDeleter> >::size() const
Line
Count
Source
115
71
  {
116
71
    return buffer_size;
117
71
  }
spirv_cross::VectorView<std::__1::unique_ptr<spirv_cross::SPIRString, spirv_cross::ObjectPool<spirv_cross::SPIRString>::MallocDeleter> >::size() const
Line
Count
Source
115
4
  {
116
4
    return buffer_size;
117
4
  }
Unexecuted instantiation: spirv_cross::VectorView<std::__1::unique_ptr<spirv_cross::SPIRCombinedImageSampler, spirv_cross::ObjectPool<spirv_cross::SPIRCombinedImageSampler>::MallocDeleter> >::size() const
spirv_cross::VectorView<std::__1::unique_ptr<spirv_cross::SPIRConstantOp, spirv_cross::ObjectPool<spirv_cross::SPIRConstantOp>::MallocDeleter> >::size() const
Line
Count
Source
115
13
  {
116
13
    return buffer_size;
117
13
  }
spirv_cross::VectorView<std::__1::unique_ptr<spirv_cross::SPIRType, spirv_cross::ObjectPool<spirv_cross::SPIRType>::MallocDeleter> >::size() const
Line
Count
Source
115
442
  {
116
442
    return buffer_size;
117
442
  }
spirv_cross::VectorView<std::__1::unique_ptr<spirv_cross::SPIRExtension, spirv_cross::ObjectPool<spirv_cross::SPIRExtension>::MallocDeleter> >::size() const
Line
Count
Source
115
284
  {
116
284
    return buffer_size;
117
284
  }
Unexecuted instantiation: spirv_cross::VectorView<std::__1::unique_ptr<spirv_cross::SPIRExpression, spirv_cross::ObjectPool<spirv_cross::SPIRExpression>::MallocDeleter> >::size() const
spirv_cross::VectorView<std::__1::unique_ptr<spirv_cross::SPIRFunctionPrototype, spirv_cross::ObjectPool<spirv_cross::SPIRFunctionPrototype>::MallocDeleter> >::size() const
Line
Count
Source
115
268
  {
116
268
    return buffer_size;
117
268
  }
spirv_cross::VectorView<std::__1::unique_ptr<spirv_cross::SPIRBlock, spirv_cross::ObjectPool<spirv_cross::SPIRBlock>::MallocDeleter> >::size() const
Line
Count
Source
115
350
  {
116
350
    return buffer_size;
117
350
  }
spirv_cross::VectorView<std::__1::unique_ptr<spirv_cross::SPIRFunction, spirv_cross::ObjectPool<spirv_cross::SPIRFunction>::MallocDeleter> >::size() const
Line
Count
Source
115
227
  {
116
227
    return buffer_size;
117
227
  }
Unexecuted instantiation: spirv_cross::VectorView<std::__1::unique_ptr<spirv_cross::SPIRAccessChain, spirv_cross::ObjectPool<spirv_cross::SPIRAccessChain>::MallocDeleter> >::size() const
spirv_cross::VectorView<std::__1::unique_ptr<spirv_cross::SPIRVariable, spirv_cross::ObjectPool<spirv_cross::SPIRVariable>::MallocDeleter> >::size() const
Line
Count
Source
115
333
  {
116
333
    return buffer_size;
117
333
  }
spirv_cross::VectorView<std::__1::unique_ptr<spirv_cross::SPIRConstant, spirv_cross::ObjectPool<spirv_cross::SPIRConstant>::MallocDeleter> >::size() const
Line
Count
Source
115
466
  {
116
466
    return buffer_size;
117
466
  }
spirv_cross::VectorView<unsigned int>::size() const
Line
Count
Source
115
11.1k
  {
116
11.1k
    return buffer_size;
117
11.1k
  }
spirv_cross::VectorView<spirv_cross::TypedID<(spirv_cross::Types)1> >::size() const
Line
Count
Source
115
18.3k
  {
116
18.3k
    return buffer_size;
117
18.3k
  }
spirv_cross::VectorView<spirv_cross::Variant>::size() const
Line
Count
Source
115
37.9M
  {
116
37.9M
    return buffer_size;
117
37.9M
  }
spirv_cross::VectorView<spirv_cross::Meta::Decoration>::size() const
Line
Count
Source
115
10.9k
  {
116
10.9k
    return buffer_size;
117
10.9k
  }
118
119
  T *data() SPIRV_CROSS_NOEXCEPT
120
1.87k
  {
121
1.87k
    return ptr;
122
1.87k
  }
123
124
  const T *data() const SPIRV_CROSS_NOEXCEPT
125
448
  {
126
448
    return ptr;
127
448
  }
128
129
  T *begin() SPIRV_CROSS_NOEXCEPT
130
10.6k
  {
131
10.6k
    return ptr;
132
10.6k
  }
spirv_cross::VectorView<unsigned int>::begin()
Line
Count
Source
130
9.65k
  {
131
9.65k
    return ptr;
132
9.65k
  }
Unexecuted instantiation: spirv_cross::VectorView<spirv_cross::StringStream<4096ul, 4096ul>::Buffer>::begin()
spirv_cross::VectorView<spirv_cross::Instruction>::begin()
Line
Count
Source
130
574
  {
131
574
    return ptr;
132
574
  }
spirv_cross::VectorView<std::__1::pair<unsigned int, unsigned int> >::begin()
Line
Count
Source
130
399
  {
131
399
    return ptr;
132
399
  }
Unexecuted instantiation: spirv_cross::VectorView<spirv_cross::Meta::Decoration>::begin()
spirv_cross::VectorView<spirv_cross::TypedID<(spirv_cross::Types)0> >::begin()
Line
Count
Source
130
36
  {
131
36
    return ptr;
132
36
  }
133
134
  T *end() SPIRV_CROSS_NOEXCEPT
135
10.6k
  {
136
10.6k
    return ptr + buffer_size;
137
10.6k
  }
spirv_cross::VectorView<unsigned int>::end()
Line
Count
Source
135
9.65k
  {
136
9.65k
    return ptr + buffer_size;
137
9.65k
  }
Unexecuted instantiation: spirv_cross::VectorView<spirv_cross::StringStream<4096ul, 4096ul>::Buffer>::end()
spirv_cross::VectorView<spirv_cross::Instruction>::end()
Line
Count
Source
135
574
  {
136
574
    return ptr + buffer_size;
137
574
  }
spirv_cross::VectorView<std::__1::pair<unsigned int, unsigned int> >::end()
Line
Count
Source
135
399
  {
136
399
    return ptr + buffer_size;
137
399
  }
Unexecuted instantiation: spirv_cross::VectorView<spirv_cross::Meta::Decoration>::end()
spirv_cross::VectorView<spirv_cross::TypedID<(spirv_cross::Types)0> >::end()
Line
Count
Source
135
54
  {
136
54
    return ptr + buffer_size;
137
54
  }
138
139
  const T *begin() const SPIRV_CROSS_NOEXCEPT
140
0
  {
141
0
    return ptr;
142
0
  }
Unexecuted instantiation: spirv_cross::VectorView<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::begin() const
Unexecuted instantiation: spirv_cross::VectorView<spirv_cross::StringStream<4096ul, 4096ul>::Buffer>::begin() const
143
144
  const T *end() const SPIRV_CROSS_NOEXCEPT
145
0
  {
146
0
    return ptr + buffer_size;
147
0
  }
Unexecuted instantiation: spirv_cross::VectorView<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::end() const
Unexecuted instantiation: spirv_cross::VectorView<spirv_cross::StringStream<4096ul, 4096ul>::Buffer>::end() const
148
149
  T &front() SPIRV_CROSS_NOEXCEPT
150
  {
151
    return ptr[0];
152
  }
153
154
  const T &front() const SPIRV_CROSS_NOEXCEPT
155
  {
156
    return ptr[0];
157
  }
158
159
  T &back() SPIRV_CROSS_NOEXCEPT
160
65.2k
  {
161
65.2k
    return ptr[buffer_size - 1];
162
65.2k
  }
spirv_cross::VectorView<spirv_cross::SPIRUndef*>::back()
Line
Count
Source
160
1.81k
  {
161
1.81k
    return ptr[buffer_size - 1];
162
1.81k
  }
spirv_cross::VectorView<spirv_cross::SPIRString*>::back()
Line
Count
Source
160
886
  {
161
886
    return ptr[buffer_size - 1];
162
886
  }
Unexecuted instantiation: spirv_cross::VectorView<spirv_cross::SPIRCombinedImageSampler*>::back()
spirv_cross::VectorView<spirv_cross::SPIRConstantOp*>::back()
Line
Count
Source
160
791
  {
161
791
    return ptr[buffer_size - 1];
162
791
  }
spirv_cross::VectorView<spirv_cross::SPIRType*>::back()
Line
Count
Source
160
22.2k
  {
161
22.2k
    return ptr[buffer_size - 1];
162
22.2k
  }
spirv_cross::VectorView<spirv_cross::SPIRExtension*>::back()
Line
Count
Source
160
508
  {
161
508
    return ptr[buffer_size - 1];
162
508
  }
Unexecuted instantiation: spirv_cross::VectorView<spirv_cross::SPIRExpression*>::back()
spirv_cross::VectorView<spirv_cross::SPIRFunctionPrototype*>::back()
Line
Count
Source
160
5.83k
  {
161
5.83k
    return ptr[buffer_size - 1];
162
5.83k
  }
spirv_cross::VectorView<spirv_cross::SPIRBlock*>::back()
Line
Count
Source
160
9.80k
  {
161
9.80k
    return ptr[buffer_size - 1];
162
9.80k
  }
spirv_cross::VectorView<spirv_cross::SPIRFunction*>::back()
Line
Count
Source
160
450
  {
161
450
    return ptr[buffer_size - 1];
162
450
  }
Unexecuted instantiation: spirv_cross::VectorView<spirv_cross::SPIRAccessChain*>::back()
spirv_cross::VectorView<spirv_cross::SPIRVariable*>::back()
Line
Count
Source
160
9.50k
  {
161
9.50k
    return ptr[buffer_size - 1];
162
9.50k
  }
spirv_cross::VectorView<spirv_cross::SPIRConstant*>::back()
Line
Count
Source
160
12.6k
  {
161
12.6k
    return ptr[buffer_size - 1];
162
12.6k
  }
Unexecuted instantiation: spirv_cross::VectorView<spirv_cross::Variant>::back()
spirv_cross::VectorView<bool>::back()
Line
Count
Source
160
368
  {
161
368
    return ptr[buffer_size - 1];
162
368
  }
spirv_cross::VectorView<unsigned int>::back()
Line
Count
Source
160
366
  {
161
366
    return ptr[buffer_size - 1];
162
366
  }
163
164
  const T &back() const SPIRV_CROSS_NOEXCEPT
165
0
  {
166
0
    return ptr[buffer_size - 1];
167
0
  }
168
169
  // Makes it easier to consume SmallVector.
170
#if defined(_MSC_VER) && _MSC_VER < 1900
171
  explicit operator std::vector<T>() const
172
  {
173
    // Another MSVC 2013 workaround. It does not understand lvalue/rvalue qualified operations.
174
    return std::vector<T>(ptr, ptr + buffer_size);
175
  }
176
#else
177
  // Makes it easier to consume SmallVector.
178
  explicit operator std::vector<T>() const &
179
  {
180
    return std::vector<T>(ptr, ptr + buffer_size);
181
  }
182
183
  // If we are converting as an r-value, we can pilfer our elements.
184
  explicit operator std::vector<T>() &&
185
  {
186
    return std::vector<T>(std::make_move_iterator(ptr), std::make_move_iterator(ptr + buffer_size));
187
  }
188
#endif
189
190
  // Avoid sliced copies. Base class should only be read as a reference.
191
  VectorView(const VectorView &) = delete;
192
  void operator=(const VectorView &) = delete;
193
194
protected:
195
273k
  VectorView() = default;
spirv_cross::VectorView<spirv_cross::TypedID<(spirv_cross::Types)2> >::VectorView()
Line
Count
Source
195
28.4k
  VectorView() = default;
spirv_cross::VectorView<spirv_cross::TypedID<(spirv_cross::Types)3> >::VectorView()
Line
Count
Source
195
15.3k
  VectorView() = default;
spirv_cross::VectorView<unsigned int>::VectorView()
Line
Count
Source
195
67.1k
  VectorView() = default;
spirv_cross::VectorView<std::__1::pair<unsigned int, unsigned int> >::VectorView()
Line
Count
Source
195
600
  VectorView() = default;
spirv_cross::VectorView<spirv_cross::Instruction>::VectorView()
Line
Count
Source
195
10.3k
  VectorView() = default;
spirv_cross::VectorView<spirv_cross::Meta::Decoration>::VectorView()
Line
Count
Source
195
8.15k
  VectorView() = default;
spirv_cross::VectorView<bool>::VectorView()
Line
Count
Source
195
22.2k
  VectorView() = default;
spirv_cross::VectorView<spirv_cross::TypedID<(spirv_cross::Types)1> >::VectorView()
Line
Count
Source
195
22.2k
  VectorView() = default;
spirv_cross::VectorView<spirv_cross::TypedID<(spirv_cross::Types)0> >::VectorView()
Line
Count
Source
195
29.3k
  VectorView() = default;
spirv_cross::VectorView<spirv_cross::SPIRFunction::Parameter>::VectorView()
Line
Count
Source
195
900
  VectorView() = default;
spirv_cross::VectorView<spirv_cross::TypedID<(spirv_cross::Types)6> >::VectorView()
Line
Count
Source
195
450
  VectorView() = default;
spirv_cross::VectorView<spirv_cross::SPIRFunction::CombinedImageSamplerParameter>::VectorView()
Line
Count
Source
195
450
  VectorView() = default;
spirv_cross::VectorView<std::__1::function<void ()> >::VectorView()
Line
Count
Source
195
900
  VectorView() = default;
spirv_cross::VectorView<spirv_cross::SPIRBlock::Phi>::VectorView()
Line
Count
Source
195
9.80k
  VectorView() = default;
spirv_cross::VectorView<std::__1::pair<spirv_cross::TypedID<(spirv_cross::Types)1>, spirv_cross::TypedID<(spirv_cross::Types)0> > >::VectorView()
Line
Count
Source
195
19.6k
  VectorView() = default;
spirv_cross::VectorView<spirv_cross::SPIRBlock::Case>::VectorView()
Line
Count
Source
195
19.6k
  VectorView() = default;
spirv_cross::VectorView<spirv_cross::Variant>::VectorView()
Line
Count
Source
195
600
  VectorView() = default;
spirv_cross::VectorView<spv::Capability>::VectorView()
Line
Count
Source
195
600
  VectorView() = default;
spirv_cross::VectorView<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::VectorView()
Line
Count
Source
195
600
  VectorView() = default;
spirv_cross::VectorView<unsigned char>::VectorView()
Line
Count
Source
195
600
  VectorView() = default;
spirv_cross::VectorView<spirv_cross::SPIRType*>::VectorView()
Line
Count
Source
195
600
  VectorView() = default;
spirv_cross::VectorView<std::__1::unique_ptr<spirv_cross::SPIRType, spirv_cross::ObjectPool<spirv_cross::SPIRType>::MallocDeleter> >::VectorView()
Line
Count
Source
195
600
  VectorView() = default;
spirv_cross::VectorView<spirv_cross::SPIRVariable*>::VectorView()
Line
Count
Source
195
600
  VectorView() = default;
spirv_cross::VectorView<std::__1::unique_ptr<spirv_cross::SPIRVariable, spirv_cross::ObjectPool<spirv_cross::SPIRVariable>::MallocDeleter> >::VectorView()
Line
Count
Source
195
600
  VectorView() = default;
spirv_cross::VectorView<spirv_cross::SPIRConstant*>::VectorView()
Line
Count
Source
195
600
  VectorView() = default;
spirv_cross::VectorView<std::__1::unique_ptr<spirv_cross::SPIRConstant, spirv_cross::ObjectPool<spirv_cross::SPIRConstant>::MallocDeleter> >::VectorView()
Line
Count
Source
195
600
  VectorView() = default;
spirv_cross::VectorView<spirv_cross::SPIRFunction*>::VectorView()
Line
Count
Source
195
600
  VectorView() = default;
spirv_cross::VectorView<std::__1::unique_ptr<spirv_cross::SPIRFunction, spirv_cross::ObjectPool<spirv_cross::SPIRFunction>::MallocDeleter> >::VectorView()
Line
Count
Source
195
600
  VectorView() = default;
spirv_cross::VectorView<spirv_cross::SPIRFunctionPrototype*>::VectorView()
Line
Count
Source
195
600
  VectorView() = default;
spirv_cross::VectorView<std::__1::unique_ptr<spirv_cross::SPIRFunctionPrototype, spirv_cross::ObjectPool<spirv_cross::SPIRFunctionPrototype>::MallocDeleter> >::VectorView()
Line
Count
Source
195
600
  VectorView() = default;
spirv_cross::VectorView<spirv_cross::SPIRBlock*>::VectorView()
Line
Count
Source
195
600
  VectorView() = default;
spirv_cross::VectorView<std::__1::unique_ptr<spirv_cross::SPIRBlock, spirv_cross::ObjectPool<spirv_cross::SPIRBlock>::MallocDeleter> >::VectorView()
Line
Count
Source
195
600
  VectorView() = default;
spirv_cross::VectorView<spirv_cross::SPIRExtension*>::VectorView()
Line
Count
Source
195
600
  VectorView() = default;
spirv_cross::VectorView<std::__1::unique_ptr<spirv_cross::SPIRExtension, spirv_cross::ObjectPool<spirv_cross::SPIRExtension>::MallocDeleter> >::VectorView()
Line
Count
Source
195
600
  VectorView() = default;
spirv_cross::VectorView<spirv_cross::SPIRExpression*>::VectorView()
Line
Count
Source
195
600
  VectorView() = default;
spirv_cross::VectorView<std::__1::unique_ptr<spirv_cross::SPIRExpression, spirv_cross::ObjectPool<spirv_cross::SPIRExpression>::MallocDeleter> >::VectorView()
Line
Count
Source
195
600
  VectorView() = default;
spirv_cross::VectorView<spirv_cross::SPIRConstantOp*>::VectorView()
Line
Count
Source
195
600
  VectorView() = default;
spirv_cross::VectorView<std::__1::unique_ptr<spirv_cross::SPIRConstantOp, spirv_cross::ObjectPool<spirv_cross::SPIRConstantOp>::MallocDeleter> >::VectorView()
Line
Count
Source
195
600
  VectorView() = default;
spirv_cross::VectorView<spirv_cross::SPIRCombinedImageSampler*>::VectorView()
Line
Count
Source
195
600
  VectorView() = default;
spirv_cross::VectorView<std::__1::unique_ptr<spirv_cross::SPIRCombinedImageSampler, spirv_cross::ObjectPool<spirv_cross::SPIRCombinedImageSampler>::MallocDeleter> >::VectorView()
Line
Count
Source
195
600
  VectorView() = default;
spirv_cross::VectorView<spirv_cross::SPIRAccessChain*>::VectorView()
Line
Count
Source
195
600
  VectorView() = default;
spirv_cross::VectorView<std::__1::unique_ptr<spirv_cross::SPIRAccessChain, spirv_cross::ObjectPool<spirv_cross::SPIRAccessChain>::MallocDeleter> >::VectorView()
Line
Count
Source
195
600
  VectorView() = default;
spirv_cross::VectorView<spirv_cross::SPIRUndef*>::VectorView()
Line
Count
Source
195
600
  VectorView() = default;
spirv_cross::VectorView<std::__1::unique_ptr<spirv_cross::SPIRUndef, spirv_cross::ObjectPool<spirv_cross::SPIRUndef>::MallocDeleter> >::VectorView()
Line
Count
Source
195
600
  VectorView() = default;
spirv_cross::VectorView<spirv_cross::SPIRString*>::VectorView()
Line
Count
Source
195
600
  VectorView() = default;
spirv_cross::VectorView<std::__1::unique_ptr<spirv_cross::SPIRString, spirv_cross::ObjectPool<spirv_cross::SPIRString>::MallocDeleter> >::VectorView()
Line
Count
Source
195
600
  VectorView() = default;
196
  T *ptr = nullptr;
197
  size_t buffer_size = 0;
198
};
199
200
// Simple vector which supports up to N elements inline, without malloc/free.
201
// We use a lot of throwaway vectors all over the place which triggers allocations.
202
// This class only implements the subset of std::vector we need in SPIRV-Cross.
203
// It is *NOT* a drop-in replacement in general projects.
204
template <typename T, size_t N = 8>
205
class SmallVector : public VectorView<T>
206
{
207
public:
208
  SmallVector() SPIRV_CROSS_NOEXCEPT
209
273k
  {
210
273k
    this->ptr = stack_storage.data();
211
273k
    buffer_capacity = N;
212
273k
  }
spirv_cross::SmallVector<spirv_cross::TypedID<(spirv_cross::Types)2>, 8ul>::SmallVector()
Line
Count
Source
209
28.4k
  {
210
28.4k
    this->ptr = stack_storage.data();
211
28.4k
    buffer_capacity = N;
212
28.4k
  }
spirv_cross::SmallVector<spirv_cross::TypedID<(spirv_cross::Types)3>, 8ul>::SmallVector()
Line
Count
Source
209
15.3k
  {
210
15.3k
    this->ptr = stack_storage.data();
211
15.3k
    buffer_capacity = N;
212
15.3k
  }
spirv_cross::SmallVector<unsigned int, 8ul>::SmallVector()
Line
Count
Source
209
67.1k
  {
210
67.1k
    this->ptr = stack_storage.data();
211
67.1k
    buffer_capacity = N;
212
67.1k
  }
spirv_cross::SmallVector<std::__1::pair<unsigned int, unsigned int>, 8ul>::SmallVector()
Line
Count
Source
209
600
  {
210
600
    this->ptr = stack_storage.data();
211
600
    buffer_capacity = N;
212
600
  }
spirv_cross::SmallVector<spirv_cross::Instruction, 8ul>::SmallVector()
Line
Count
Source
209
10.3k
  {
210
10.3k
    this->ptr = stack_storage.data();
211
10.3k
    buffer_capacity = N;
212
10.3k
  }
spirv_cross::SmallVector<spirv_cross::Meta::Decoration, 0ul>::SmallVector()
Line
Count
Source
209
8.15k
  {
210
8.15k
    this->ptr = stack_storage.data();
211
8.15k
    buffer_capacity = N;
212
8.15k
  }
spirv_cross::SmallVector<bool, 8ul>::SmallVector()
Line
Count
Source
209
22.2k
  {
210
22.2k
    this->ptr = stack_storage.data();
211
22.2k
    buffer_capacity = N;
212
22.2k
  }
spirv_cross::SmallVector<spirv_cross::TypedID<(spirv_cross::Types)1>, 8ul>::SmallVector()
Line
Count
Source
209
22.2k
  {
210
22.2k
    this->ptr = stack_storage.data();
211
22.2k
    buffer_capacity = N;
212
22.2k
  }
spirv_cross::SmallVector<spirv_cross::TypedID<(spirv_cross::Types)0>, 8ul>::SmallVector()
Line
Count
Source
209
29.3k
  {
210
29.3k
    this->ptr = stack_storage.data();
211
29.3k
    buffer_capacity = N;
212
29.3k
  }
spirv_cross::SmallVector<spirv_cross::SPIRFunction::Parameter, 8ul>::SmallVector()
Line
Count
Source
209
900
  {
210
900
    this->ptr = stack_storage.data();
211
900
    buffer_capacity = N;
212
900
  }
spirv_cross::SmallVector<spirv_cross::TypedID<(spirv_cross::Types)6>, 8ul>::SmallVector()
Line
Count
Source
209
450
  {
210
450
    this->ptr = stack_storage.data();
211
450
    buffer_capacity = N;
212
450
  }
spirv_cross::SmallVector<spirv_cross::SPIRFunction::CombinedImageSamplerParameter, 8ul>::SmallVector()
Line
Count
Source
209
450
  {
210
450
    this->ptr = stack_storage.data();
211
450
    buffer_capacity = N;
212
450
  }
spirv_cross::SmallVector<std::__1::function<void ()>, 0ul>::SmallVector()
Line
Count
Source
209
900
  {
210
900
    this->ptr = stack_storage.data();
211
900
    buffer_capacity = N;
212
900
  }
spirv_cross::SmallVector<spirv_cross::SPIRBlock::Phi, 8ul>::SmallVector()
Line
Count
Source
209
9.80k
  {
210
9.80k
    this->ptr = stack_storage.data();
211
9.80k
    buffer_capacity = N;
212
9.80k
  }
spirv_cross::SmallVector<std::__1::pair<spirv_cross::TypedID<(spirv_cross::Types)1>, spirv_cross::TypedID<(spirv_cross::Types)0> >, 8ul>::SmallVector()
Line
Count
Source
209
19.6k
  {
210
19.6k
    this->ptr = stack_storage.data();
211
19.6k
    buffer_capacity = N;
212
19.6k
  }
spirv_cross::SmallVector<spirv_cross::SPIRBlock::Case, 8ul>::SmallVector()
Line
Count
Source
209
19.6k
  {
210
19.6k
    this->ptr = stack_storage.data();
211
19.6k
    buffer_capacity = N;
212
19.6k
  }
spirv_cross::SmallVector<spirv_cross::Variant, 8ul>::SmallVector()
Line
Count
Source
209
600
  {
210
600
    this->ptr = stack_storage.data();
211
600
    buffer_capacity = N;
212
600
  }
spirv_cross::SmallVector<spv::Capability, 8ul>::SmallVector()
Line
Count
Source
209
600
  {
210
600
    this->ptr = stack_storage.data();
211
600
    buffer_capacity = N;
212
600
  }
spirv_cross::SmallVector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, 8ul>::SmallVector()
Line
Count
Source
209
600
  {
210
600
    this->ptr = stack_storage.data();
211
600
    buffer_capacity = N;
212
600
  }
spirv_cross::SmallVector<unsigned char, 8ul>::SmallVector()
Line
Count
Source
209
600
  {
210
600
    this->ptr = stack_storage.data();
211
600
    buffer_capacity = N;
212
600
  }
spirv_cross::SmallVector<spirv_cross::SPIRType*, 0ul>::SmallVector()
Line
Count
Source
209
600
  {
210
600
    this->ptr = stack_storage.data();
211
600
    buffer_capacity = N;
212
600
  }
spirv_cross::SmallVector<std::__1::unique_ptr<spirv_cross::SPIRType, spirv_cross::ObjectPool<spirv_cross::SPIRType>::MallocDeleter>, 8ul>::SmallVector()
Line
Count
Source
209
600
  {
210
600
    this->ptr = stack_storage.data();
211
600
    buffer_capacity = N;
212
600
  }
spirv_cross::SmallVector<spirv_cross::SPIRVariable*, 0ul>::SmallVector()
Line
Count
Source
209
600
  {
210
600
    this->ptr = stack_storage.data();
211
600
    buffer_capacity = N;
212
600
  }
spirv_cross::SmallVector<std::__1::unique_ptr<spirv_cross::SPIRVariable, spirv_cross::ObjectPool<spirv_cross::SPIRVariable>::MallocDeleter>, 8ul>::SmallVector()
Line
Count
Source
209
600
  {
210
600
    this->ptr = stack_storage.data();
211
600
    buffer_capacity = N;
212
600
  }
spirv_cross::SmallVector<spirv_cross::SPIRConstant*, 0ul>::SmallVector()
Line
Count
Source
209
600
  {
210
600
    this->ptr = stack_storage.data();
211
600
    buffer_capacity = N;
212
600
  }
spirv_cross::SmallVector<std::__1::unique_ptr<spirv_cross::SPIRConstant, spirv_cross::ObjectPool<spirv_cross::SPIRConstant>::MallocDeleter>, 8ul>::SmallVector()
Line
Count
Source
209
600
  {
210
600
    this->ptr = stack_storage.data();
211
600
    buffer_capacity = N;
212
600
  }
spirv_cross::SmallVector<spirv_cross::SPIRFunction*, 0ul>::SmallVector()
Line
Count
Source
209
600
  {
210
600
    this->ptr = stack_storage.data();
211
600
    buffer_capacity = N;
212
600
  }
spirv_cross::SmallVector<std::__1::unique_ptr<spirv_cross::SPIRFunction, spirv_cross::ObjectPool<spirv_cross::SPIRFunction>::MallocDeleter>, 8ul>::SmallVector()
Line
Count
Source
209
600
  {
210
600
    this->ptr = stack_storage.data();
211
600
    buffer_capacity = N;
212
600
  }
spirv_cross::SmallVector<spirv_cross::SPIRFunctionPrototype*, 0ul>::SmallVector()
Line
Count
Source
209
600
  {
210
600
    this->ptr = stack_storage.data();
211
600
    buffer_capacity = N;
212
600
  }
spirv_cross::SmallVector<std::__1::unique_ptr<spirv_cross::SPIRFunctionPrototype, spirv_cross::ObjectPool<spirv_cross::SPIRFunctionPrototype>::MallocDeleter>, 8ul>::SmallVector()
Line
Count
Source
209
600
  {
210
600
    this->ptr = stack_storage.data();
211
600
    buffer_capacity = N;
212
600
  }
spirv_cross::SmallVector<spirv_cross::SPIRBlock*, 0ul>::SmallVector()
Line
Count
Source
209
600
  {
210
600
    this->ptr = stack_storage.data();
211
600
    buffer_capacity = N;
212
600
  }
spirv_cross::SmallVector<std::__1::unique_ptr<spirv_cross::SPIRBlock, spirv_cross::ObjectPool<spirv_cross::SPIRBlock>::MallocDeleter>, 8ul>::SmallVector()
Line
Count
Source
209
600
  {
210
600
    this->ptr = stack_storage.data();
211
600
    buffer_capacity = N;
212
600
  }
spirv_cross::SmallVector<spirv_cross::SPIRExtension*, 0ul>::SmallVector()
Line
Count
Source
209
600
  {
210
600
    this->ptr = stack_storage.data();
211
600
    buffer_capacity = N;
212
600
  }
spirv_cross::SmallVector<std::__1::unique_ptr<spirv_cross::SPIRExtension, spirv_cross::ObjectPool<spirv_cross::SPIRExtension>::MallocDeleter>, 8ul>::SmallVector()
Line
Count
Source
209
600
  {
210
600
    this->ptr = stack_storage.data();
211
600
    buffer_capacity = N;
212
600
  }
spirv_cross::SmallVector<spirv_cross::SPIRExpression*, 0ul>::SmallVector()
Line
Count
Source
209
600
  {
210
600
    this->ptr = stack_storage.data();
211
600
    buffer_capacity = N;
212
600
  }
spirv_cross::SmallVector<std::__1::unique_ptr<spirv_cross::SPIRExpression, spirv_cross::ObjectPool<spirv_cross::SPIRExpression>::MallocDeleter>, 8ul>::SmallVector()
Line
Count
Source
209
600
  {
210
600
    this->ptr = stack_storage.data();
211
600
    buffer_capacity = N;
212
600
  }
spirv_cross::SmallVector<spirv_cross::SPIRConstantOp*, 0ul>::SmallVector()
Line
Count
Source
209
600
  {
210
600
    this->ptr = stack_storage.data();
211
600
    buffer_capacity = N;
212
600
  }
spirv_cross::SmallVector<std::__1::unique_ptr<spirv_cross::SPIRConstantOp, spirv_cross::ObjectPool<spirv_cross::SPIRConstantOp>::MallocDeleter>, 8ul>::SmallVector()
Line
Count
Source
209
600
  {
210
600
    this->ptr = stack_storage.data();
211
600
    buffer_capacity = N;
212
600
  }
spirv_cross::SmallVector<spirv_cross::SPIRCombinedImageSampler*, 0ul>::SmallVector()
Line
Count
Source
209
600
  {
210
600
    this->ptr = stack_storage.data();
211
600
    buffer_capacity = N;
212
600
  }
spirv_cross::SmallVector<std::__1::unique_ptr<spirv_cross::SPIRCombinedImageSampler, spirv_cross::ObjectPool<spirv_cross::SPIRCombinedImageSampler>::MallocDeleter>, 8ul>::SmallVector()
Line
Count
Source
209
600
  {
210
600
    this->ptr = stack_storage.data();
211
600
    buffer_capacity = N;
212
600
  }
spirv_cross::SmallVector<spirv_cross::SPIRAccessChain*, 0ul>::SmallVector()
Line
Count
Source
209
600
  {
210
600
    this->ptr = stack_storage.data();
211
600
    buffer_capacity = N;
212
600
  }
spirv_cross::SmallVector<std::__1::unique_ptr<spirv_cross::SPIRAccessChain, spirv_cross::ObjectPool<spirv_cross::SPIRAccessChain>::MallocDeleter>, 8ul>::SmallVector()
Line
Count
Source
209
600
  {
210
600
    this->ptr = stack_storage.data();
211
600
    buffer_capacity = N;
212
600
  }
spirv_cross::SmallVector<spirv_cross::SPIRUndef*, 0ul>::SmallVector()
Line
Count
Source
209
600
  {
210
600
    this->ptr = stack_storage.data();
211
600
    buffer_capacity = N;
212
600
  }
spirv_cross::SmallVector<std::__1::unique_ptr<spirv_cross::SPIRUndef, spirv_cross::ObjectPool<spirv_cross::SPIRUndef>::MallocDeleter>, 8ul>::SmallVector()
Line
Count
Source
209
600
  {
210
600
    this->ptr = stack_storage.data();
211
600
    buffer_capacity = N;
212
600
  }
spirv_cross::SmallVector<spirv_cross::SPIRString*, 0ul>::SmallVector()
Line
Count
Source
209
600
  {
210
600
    this->ptr = stack_storage.data();
211
600
    buffer_capacity = N;
212
600
  }
spirv_cross::SmallVector<std::__1::unique_ptr<spirv_cross::SPIRString, spirv_cross::ObjectPool<spirv_cross::SPIRString>::MallocDeleter>, 8ul>::SmallVector()
Line
Count
Source
209
600
  {
210
600
    this->ptr = stack_storage.data();
211
600
    buffer_capacity = N;
212
600
  }
213
214
  template <typename U>
215
  SmallVector(const U *arg_list_begin, const U *arg_list_end) SPIRV_CROSS_NOEXCEPT : SmallVector()
216
  {
217
    auto count = size_t(arg_list_end - arg_list_begin);
218
    reserve(count);
219
    for (size_t i = 0; i < count; i++, arg_list_begin++)
220
      new (&this->ptr[i]) T(*arg_list_begin);
221
    this->buffer_size = count;
222
  }
223
224
  template <typename U>
225
  SmallVector(std::initializer_list<U> init) SPIRV_CROSS_NOEXCEPT : SmallVector(init.begin(), init.end())
226
  {
227
  }
228
229
  template <typename U, size_t M>
230
  explicit SmallVector(const U (&init)[M]) SPIRV_CROSS_NOEXCEPT : SmallVector(init, init + M)
231
  {
232
  }
233
234
5.49k
  SmallVector(SmallVector &&other) SPIRV_CROSS_NOEXCEPT : SmallVector()
235
5.49k
  {
236
5.49k
    *this = std::move(other);
237
5.49k
  }
238
239
  SmallVector &operator=(SmallVector &&other) SPIRV_CROSS_NOEXCEPT
240
5.49k
  {
241
5.49k
    clear();
242
5.49k
    if (other.ptr != other.stack_storage.data())
243
0
    {
244
      // Pilfer allocated pointer.
245
0
      if (this->ptr != stack_storage.data())
246
0
        free(this->ptr);
247
0
      this->ptr = other.ptr;
248
0
      this->buffer_size = other.buffer_size;
249
0
      buffer_capacity = other.buffer_capacity;
250
0
      other.ptr = nullptr;
251
0
      other.buffer_size = 0;
252
0
      other.buffer_capacity = 0;
253
0
    }
254
5.49k
    else
255
5.49k
    {
256
      // Need to move the stack contents individually.
257
5.49k
      reserve(other.buffer_size);
258
5.49k
      for (size_t i = 0; i < other.buffer_size; i++)
259
0
      {
260
0
        new (&this->ptr[i]) T(std::move(other.ptr[i]));
261
0
        other.ptr[i].~T();
262
0
      }
263
5.49k
      this->buffer_size = other.buffer_size;
264
5.49k
      other.buffer_size = 0;
265
5.49k
    }
266
5.49k
    return *this;
267
5.49k
  }
spirv_cross::SmallVector<spirv_cross::TypedID<(spirv_cross::Types)2>, 8ul>::operator=(spirv_cross::SmallVector<spirv_cross::TypedID<(spirv_cross::Types)2>, 8ul>&&)
Line
Count
Source
240
5.49k
  {
241
5.49k
    clear();
242
5.49k
    if (other.ptr != other.stack_storage.data())
243
0
    {
244
      // Pilfer allocated pointer.
245
0
      if (this->ptr != stack_storage.data())
246
0
        free(this->ptr);
247
0
      this->ptr = other.ptr;
248
0
      this->buffer_size = other.buffer_size;
249
0
      buffer_capacity = other.buffer_capacity;
250
0
      other.ptr = nullptr;
251
0
      other.buffer_size = 0;
252
0
      other.buffer_capacity = 0;
253
0
    }
254
5.49k
    else
255
5.49k
    {
256
      // Need to move the stack contents individually.
257
5.49k
      reserve(other.buffer_size);
258
5.49k
      for (size_t i = 0; i < other.buffer_size; i++)
259
0
      {
260
0
        new (&this->ptr[i]) T(std::move(other.ptr[i]));
261
0
        other.ptr[i].~T();
262
0
      }
263
5.49k
      this->buffer_size = other.buffer_size;
264
5.49k
      other.buffer_size = 0;
265
5.49k
    }
266
5.49k
    return *this;
267
5.49k
  }
Unexecuted instantiation: spirv_cross::SmallVector<spirv_cross::TypedID<(spirv_cross::Types)0>, 8ul>::operator=(spirv_cross::SmallVector<spirv_cross::TypedID<(spirv_cross::Types)0>, 8ul>&&)
Unexecuted instantiation: spirv_cross::SmallVector<spv::Capability, 8ul>::operator=(spirv_cross::SmallVector<spv::Capability, 8ul>&&)
Unexecuted instantiation: spirv_cross::SmallVector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, 8ul>::operator=(spirv_cross::SmallVector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, 8ul>&&)
Unexecuted instantiation: spirv_cross::SmallVector<unsigned char, 8ul>::operator=(spirv_cross::SmallVector<unsigned char, 8ul>&&)
Unexecuted instantiation: spirv_cross::SmallVector<spirv_cross::Variant, 8ul>::operator=(spirv_cross::SmallVector<spirv_cross::Variant, 8ul>&&)
268
269
13.8k
  SmallVector(const SmallVector &other) SPIRV_CROSS_NOEXCEPT : SmallVector()
270
13.8k
  {
271
13.8k
    *this = other;
272
13.8k
  }
Unexecuted instantiation: spirv_cross::SmallVector<spirv_cross::TypedID<(spirv_cross::Types)3>, 8ul>::SmallVector(spirv_cross::SmallVector<spirv_cross::TypedID<(spirv_cross::Types)3>, 8ul> const&)
spirv_cross::SmallVector<unsigned int, 8ul>::SmallVector(spirv_cross::SmallVector<unsigned int, 8ul> const&)
Line
Count
Source
269
6.90k
  SmallVector(const SmallVector &other) SPIRV_CROSS_NOEXCEPT : SmallVector()
270
6.90k
  {
271
6.90k
    *this = other;
272
6.90k
  }
spirv_cross::SmallVector<bool, 8ul>::SmallVector(spirv_cross::SmallVector<bool, 8ul> const&)
Line
Count
Source
269
3.45k
  SmallVector(const SmallVector &other) SPIRV_CROSS_NOEXCEPT : SmallVector()
270
3.45k
  {
271
3.45k
    *this = other;
272
3.45k
  }
spirv_cross::SmallVector<spirv_cross::TypedID<(spirv_cross::Types)1>, 8ul>::SmallVector(spirv_cross::SmallVector<spirv_cross::TypedID<(spirv_cross::Types)1>, 8ul> const&)
Line
Count
Source
269
3.45k
  SmallVector(const SmallVector &other) SPIRV_CROSS_NOEXCEPT : SmallVector()
270
3.45k
  {
271
3.45k
    *this = other;
272
3.45k
  }
Unexecuted instantiation: spirv_cross::SmallVector<spirv_cross::TypedID<(spirv_cross::Types)0>, 8ul>::SmallVector(spirv_cross::SmallVector<spirv_cross::TypedID<(spirv_cross::Types)0>, 8ul> const&)
Unexecuted instantiation: spirv_cross::SmallVector<spirv_cross::SPIRFunction::Parameter, 8ul>::SmallVector(spirv_cross::SmallVector<spirv_cross::SPIRFunction::Parameter, 8ul> const&)
Unexecuted instantiation: spirv_cross::SmallVector<spirv_cross::TypedID<(spirv_cross::Types)2>, 8ul>::SmallVector(spirv_cross::SmallVector<spirv_cross::TypedID<(spirv_cross::Types)2>, 8ul> const&)
Unexecuted instantiation: spirv_cross::SmallVector<spirv_cross::TypedID<(spirv_cross::Types)6>, 8ul>::SmallVector(spirv_cross::SmallVector<spirv_cross::TypedID<(spirv_cross::Types)6>, 8ul> const&)
Unexecuted instantiation: spirv_cross::SmallVector<spirv_cross::SPIRFunction::CombinedImageSamplerParameter, 8ul>::SmallVector(spirv_cross::SmallVector<spirv_cross::SPIRFunction::CombinedImageSamplerParameter, 8ul> const&)
Unexecuted instantiation: spirv_cross::SmallVector<std::__1::function<void ()>, 0ul>::SmallVector(spirv_cross::SmallVector<std::__1::function<void ()>, 0ul> const&)
Unexecuted instantiation: spirv_cross::SmallVector<spirv_cross::Instruction, 8ul>::SmallVector(spirv_cross::SmallVector<spirv_cross::Instruction, 8ul> const&)
Unexecuted instantiation: spirv_cross::SmallVector<spirv_cross::SPIRBlock::Phi, 8ul>::SmallVector(spirv_cross::SmallVector<spirv_cross::SPIRBlock::Phi, 8ul> const&)
Unexecuted instantiation: spirv_cross::SmallVector<std::__1::pair<spirv_cross::TypedID<(spirv_cross::Types)1>, spirv_cross::TypedID<(spirv_cross::Types)0> >, 8ul>::SmallVector(spirv_cross::SmallVector<std::__1::pair<spirv_cross::TypedID<(spirv_cross::Types)1>, spirv_cross::TypedID<(spirv_cross::Types)0> >, 8ul> const&)
Unexecuted instantiation: spirv_cross::SmallVector<spirv_cross::SPIRBlock::Case, 8ul>::SmallVector(spirv_cross::SmallVector<spirv_cross::SPIRBlock::Case, 8ul> const&)
Unexecuted instantiation: spirv_cross::SmallVector<spirv_cross::Meta::Decoration, 0ul>::SmallVector(spirv_cross::SmallVector<spirv_cross::Meta::Decoration, 0ul> const&)
273
274
  SmallVector &operator=(const SmallVector &other) SPIRV_CROSS_NOEXCEPT
275
50.5k
  {
276
50.5k
    if (this == &other)
277
4.57k
      return *this;
278
279
45.9k
    clear();
280
45.9k
    reserve(other.buffer_size);
281
114k
    for (size_t i = 0; i < other.buffer_size; i++)
282
68.8k
      new (&this->ptr[i]) T(other.ptr[i]);
283
45.9k
    this->buffer_size = other.buffer_size;
284
45.9k
    return *this;
285
50.5k
  }
spirv_cross::SmallVector<unsigned int, 8ul>::operator=(spirv_cross::SmallVector<unsigned int, 8ul> const&)
Line
Count
Source
275
24.9k
  {
276
24.9k
    if (this == &other)
277
2.11k
      return *this;
278
279
22.8k
    clear();
280
22.8k
    reserve(other.buffer_size);
281
54.8k
    for (size_t i = 0; i < other.buffer_size; i++)
282
31.9k
      new (&this->ptr[i]) T(other.ptr[i]);
283
22.8k
    this->buffer_size = other.buffer_size;
284
22.8k
    return *this;
285
24.9k
  }
spirv_cross::SmallVector<bool, 8ul>::operator=(spirv_cross::SmallVector<bool, 8ul> const&)
Line
Count
Source
275
12.4k
  {
276
12.4k
    if (this == &other)
277
1.05k
      return *this;
278
279
11.4k
    clear();
280
11.4k
    reserve(other.buffer_size);
281
43.4k
    for (size_t i = 0; i < other.buffer_size; i++)
282
31.9k
      new (&this->ptr[i]) T(other.ptr[i]);
283
11.4k
    this->buffer_size = other.buffer_size;
284
11.4k
    return *this;
285
12.4k
  }
spirv_cross::SmallVector<spirv_cross::TypedID<(spirv_cross::Types)1>, 8ul>::operator=(spirv_cross::SmallVector<spirv_cross::TypedID<(spirv_cross::Types)1>, 8ul> const&)
Line
Count
Source
275
13.1k
  {
276
13.1k
    if (this == &other)
277
1.40k
      return *this;
278
279
11.7k
    clear();
280
11.7k
    reserve(other.buffer_size);
281
16.6k
    for (size_t i = 0; i < other.buffer_size; i++)
282
4.91k
      new (&this->ptr[i]) T(other.ptr[i]);
283
11.7k
    this->buffer_size = other.buffer_size;
284
11.7k
    return *this;
285
13.1k
  }
Unexecuted instantiation: spirv_cross::SmallVector<spirv_cross::TypedID<(spirv_cross::Types)0>, 8ul>::operator=(spirv_cross::SmallVector<spirv_cross::TypedID<(spirv_cross::Types)0>, 8ul> const&)
Unexecuted instantiation: spirv_cross::SmallVector<spirv_cross::Instruction, 8ul>::operator=(spirv_cross::SmallVector<spirv_cross::Instruction, 8ul> const&)
Unexecuted instantiation: spirv_cross::SmallVector<spirv_cross::SPIRBlock::Phi, 8ul>::operator=(spirv_cross::SmallVector<spirv_cross::SPIRBlock::Phi, 8ul> const&)
Unexecuted instantiation: spirv_cross::SmallVector<std::__1::pair<spirv_cross::TypedID<(spirv_cross::Types)1>, spirv_cross::TypedID<(spirv_cross::Types)0> >, 8ul>::operator=(spirv_cross::SmallVector<std::__1::pair<spirv_cross::TypedID<(spirv_cross::Types)1>, spirv_cross::TypedID<(spirv_cross::Types)0> >, 8ul> const&)
Unexecuted instantiation: spirv_cross::SmallVector<spirv_cross::SPIRBlock::Case, 8ul>::operator=(spirv_cross::SmallVector<spirv_cross::SPIRBlock::Case, 8ul> const&)
Unexecuted instantiation: spirv_cross::SmallVector<spirv_cross::TypedID<(spirv_cross::Types)2>, 8ul>::operator=(spirv_cross::SmallVector<spirv_cross::TypedID<(spirv_cross::Types)2>, 8ul> const&)
Unexecuted instantiation: spirv_cross::SmallVector<spirv_cross::SPIRFunction::Parameter, 8ul>::operator=(spirv_cross::SmallVector<spirv_cross::SPIRFunction::Parameter, 8ul> const&)
Unexecuted instantiation: spirv_cross::SmallVector<spirv_cross::TypedID<(spirv_cross::Types)6>, 8ul>::operator=(spirv_cross::SmallVector<spirv_cross::TypedID<(spirv_cross::Types)6>, 8ul> const&)
Unexecuted instantiation: spirv_cross::SmallVector<spirv_cross::SPIRFunction::CombinedImageSamplerParameter, 8ul>::operator=(spirv_cross::SmallVector<spirv_cross::SPIRFunction::CombinedImageSamplerParameter, 8ul> const&)
Unexecuted instantiation: spirv_cross::SmallVector<std::__1::function<void ()>, 0ul>::operator=(spirv_cross::SmallVector<std::__1::function<void ()>, 0ul> const&)
Unexecuted instantiation: spirv_cross::SmallVector<spirv_cross::TypedID<(spirv_cross::Types)3>, 8ul>::operator=(spirv_cross::SmallVector<spirv_cross::TypedID<(spirv_cross::Types)3>, 8ul> const&)
Unexecuted instantiation: spirv_cross::SmallVector<spirv_cross::Meta::Decoration, 0ul>::operator=(spirv_cross::SmallVector<spirv_cross::Meta::Decoration, 0ul> const&)
Unexecuted instantiation: spirv_cross::SmallVector<spv::Capability, 8ul>::operator=(spirv_cross::SmallVector<spv::Capability, 8ul> const&)
Unexecuted instantiation: spirv_cross::SmallVector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, 8ul>::operator=(spirv_cross::SmallVector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, 8ul> const&)
Unexecuted instantiation: spirv_cross::SmallVector<unsigned char, 8ul>::operator=(spirv_cross::SmallVector<unsigned char, 8ul> const&)
286
287
1.87k
  explicit SmallVector(size_t count) SPIRV_CROSS_NOEXCEPT : SmallVector()
288
1.87k
  {
289
1.87k
    resize(count);
290
1.87k
  }
291
292
  ~SmallVector()
293
273k
  {
294
273k
    clear();
295
273k
    if (this->ptr != stack_storage.data())
296
12.1k
      free(this->ptr);
297
273k
  }
spirv_cross::SmallVector<std::__1::pair<unsigned int, unsigned int>, 8ul>::~SmallVector()
Line
Count
Source
293
600
  {
294
600
    clear();
295
600
    if (this->ptr != stack_storage.data())
296
16
      free(this->ptr);
297
600
  }
spirv_cross::SmallVector<unsigned int, 8ul>::~SmallVector()
Line
Count
Source
293
67.1k
  {
294
67.1k
    clear();
295
67.1k
    if (this->ptr != stack_storage.data())
296
5.39k
      free(this->ptr);
297
67.1k
  }
spirv_cross::SmallVector<spirv_cross::TypedID<(spirv_cross::Types)2>, 8ul>::~SmallVector()
Line
Count
Source
293
28.4k
  {
294
28.4k
    clear();
295
28.4k
    if (this->ptr != stack_storage.data())
296
223
      free(this->ptr);
297
28.4k
  }
spirv_cross::SmallVector<unsigned char, 8ul>::~SmallVector()
Line
Count
Source
293
600
  {
294
600
    clear();
295
600
    if (this->ptr != stack_storage.data())
296
558
      free(this->ptr);
297
600
  }
spirv_cross::SmallVector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, 8ul>::~SmallVector()
Line
Count
Source
293
600
  {
294
600
    clear();
295
600
    if (this->ptr != stack_storage.data())
296
34
      free(this->ptr);
297
600
  }
spirv_cross::SmallVector<spv::Capability, 8ul>::~SmallVector()
Line
Count
Source
293
600
  {
294
600
    clear();
295
600
    if (this->ptr != stack_storage.data())
296
12
      free(this->ptr);
297
600
  }
spirv_cross::SmallVector<spirv_cross::TypedID<(spirv_cross::Types)0>, 8ul>::~SmallVector()
Line
Count
Source
293
29.3k
  {
294
29.3k
    clear();
295
29.3k
    if (this->ptr != stack_storage.data())
296
1.01k
      free(this->ptr);
297
29.3k
  }
spirv_cross::SmallVector<spirv_cross::Meta::Decoration, 0ul>::~SmallVector()
Line
Count
Source
293
8.15k
  {
294
8.15k
    clear();
295
8.15k
    if (this->ptr != stack_storage.data())
296
381
      free(this->ptr);
297
8.15k
  }
spirv_cross::SmallVector<spirv_cross::Variant, 8ul>::~SmallVector()
Line
Count
Source
293
600
  {
294
600
    clear();
295
600
    if (this->ptr != stack_storage.data())
296
558
      free(this->ptr);
297
600
  }
spirv_cross::SmallVector<spirv_cross::TypedID<(spirv_cross::Types)3>, 8ul>::~SmallVector()
Line
Count
Source
293
15.3k
  {
294
15.3k
    clear();
295
15.3k
    if (this->ptr != stack_storage.data())
296
6
      free(this->ptr);
297
15.3k
  }
spirv_cross::SmallVector<spirv_cross::Instruction, 8ul>::~SmallVector()
Line
Count
Source
293
10.3k
  {
294
10.3k
    clear();
295
10.3k
    if (this->ptr != stack_storage.data())
296
1.15k
      free(this->ptr);
297
10.3k
  }
spirv_cross::SmallVector<spirv_cross::TypedID<(spirv_cross::Types)1>, 8ul>::~SmallVector()
Line
Count
Source
293
22.2k
  {
294
22.2k
    clear();
295
22.2k
    if (this->ptr != stack_storage.data())
296
48
      free(this->ptr);
297
22.2k
  }
spirv_cross::SmallVector<bool, 8ul>::~SmallVector()
Line
Count
Source
293
22.2k
  {
294
22.2k
    clear();
295
22.2k
    if (this->ptr != stack_storage.data())
296
528
      free(this->ptr);
297
22.2k
  }
spirv_cross::SmallVector<spirv_cross::SPIRFunction::Parameter, 8ul>::~SmallVector()
Line
Count
Source
293
900
  {
294
900
    clear();
295
900
    if (this->ptr != stack_storage.data())
296
0
      free(this->ptr);
297
900
  }
spirv_cross::SmallVector<std::__1::function<void ()>, 0ul>::~SmallVector()
Line
Count
Source
293
900
  {
294
900
    clear();
295
900
    if (this->ptr != stack_storage.data())
296
0
      free(this->ptr);
297
900
  }
spirv_cross::SmallVector<spirv_cross::SPIRFunction::CombinedImageSamplerParameter, 8ul>::~SmallVector()
Line
Count
Source
293
450
  {
294
450
    clear();
295
450
    if (this->ptr != stack_storage.data())
296
0
      free(this->ptr);
297
450
  }
spirv_cross::SmallVector<spirv_cross::TypedID<(spirv_cross::Types)6>, 8ul>::~SmallVector()
Line
Count
Source
293
450
  {
294
450
    clear();
295
450
    if (this->ptr != stack_storage.data())
296
149
      free(this->ptr);
297
450
  }
spirv_cross::SmallVector<spirv_cross::SPIRBlock::Case, 8ul>::~SmallVector()
Line
Count
Source
293
19.6k
  {
294
19.6k
    clear();
295
19.6k
    if (this->ptr != stack_storage.data())
296
84
      free(this->ptr);
297
19.6k
  }
spirv_cross::SmallVector<std::__1::pair<spirv_cross::TypedID<(spirv_cross::Types)1>, spirv_cross::TypedID<(spirv_cross::Types)0> >, 8ul>::~SmallVector()
Line
Count
Source
293
19.6k
  {
294
19.6k
    clear();
295
19.6k
    if (this->ptr != stack_storage.data())
296
0
      free(this->ptr);
297
19.6k
  }
spirv_cross::SmallVector<spirv_cross::SPIRBlock::Phi, 8ul>::~SmallVector()
Line
Count
Source
293
9.80k
  {
294
9.80k
    clear();
295
9.80k
    if (this->ptr != stack_storage.data())
296
55
      free(this->ptr);
297
9.80k
  }
spirv_cross::SmallVector<std::__1::unique_ptr<spirv_cross::SPIRType, spirv_cross::ObjectPool<spirv_cross::SPIRType>::MallocDeleter>, 8ul>::~SmallVector()
Line
Count
Source
293
600
  {
294
600
    clear();
295
600
    if (this->ptr != stack_storage.data())
296
0
      free(this->ptr);
297
600
  }
spirv_cross::SmallVector<spirv_cross::SPIRType*, 0ul>::~SmallVector()
Line
Count
Source
293
600
  {
294
600
    clear();
295
600
    if (this->ptr != stack_storage.data())
296
354
      free(this->ptr);
297
600
  }
spirv_cross::SmallVector<std::__1::unique_ptr<spirv_cross::SPIRVariable, spirv_cross::ObjectPool<spirv_cross::SPIRVariable>::MallocDeleter>, 8ul>::~SmallVector()
Line
Count
Source
293
600
  {
294
600
    clear();
295
600
    if (this->ptr != stack_storage.data())
296
0
      free(this->ptr);
297
600
  }
spirv_cross::SmallVector<spirv_cross::SPIRVariable*, 0ul>::~SmallVector()
Line
Count
Source
293
600
  {
294
600
    clear();
295
600
    if (this->ptr != stack_storage.data())
296
258
      free(this->ptr);
297
600
  }
spirv_cross::SmallVector<std::__1::unique_ptr<spirv_cross::SPIRConstant, spirv_cross::ObjectPool<spirv_cross::SPIRConstant>::MallocDeleter>, 8ul>::~SmallVector()
Line
Count
Source
293
600
  {
294
600
    clear();
295
600
    if (this->ptr != stack_storage.data())
296
0
      free(this->ptr);
297
600
  }
spirv_cross::SmallVector<spirv_cross::SPIRConstant*, 0ul>::~SmallVector()
Line
Count
Source
293
600
  {
294
600
    clear();
295
600
    if (this->ptr != stack_storage.data())
296
277
      free(this->ptr);
297
600
  }
spirv_cross::SmallVector<std::__1::unique_ptr<spirv_cross::SPIRFunction, spirv_cross::ObjectPool<spirv_cross::SPIRFunction>::MallocDeleter>, 8ul>::~SmallVector()
Line
Count
Source
293
600
  {
294
600
    clear();
295
600
    if (this->ptr != stack_storage.data())
296
0
      free(this->ptr);
297
600
  }
spirv_cross::SmallVector<spirv_cross::SPIRFunction*, 0ul>::~SmallVector()
Line
Count
Source
293
600
  {
294
600
    clear();
295
600
    if (this->ptr != stack_storage.data())
296
227
      free(this->ptr);
297
600
  }
spirv_cross::SmallVector<std::__1::unique_ptr<spirv_cross::SPIRFunctionPrototype, spirv_cross::ObjectPool<spirv_cross::SPIRFunctionPrototype>::MallocDeleter>, 8ul>::~SmallVector()
Line
Count
Source
293
600
  {
294
600
    clear();
295
600
    if (this->ptr != stack_storage.data())
296
0
      free(this->ptr);
297
600
  }
spirv_cross::SmallVector<spirv_cross::SPIRFunctionPrototype*, 0ul>::~SmallVector()
Line
Count
Source
293
600
  {
294
600
    clear();
295
600
    if (this->ptr != stack_storage.data())
296
268
      free(this->ptr);
297
600
  }
spirv_cross::SmallVector<std::__1::unique_ptr<spirv_cross::SPIRBlock, spirv_cross::ObjectPool<spirv_cross::SPIRBlock>::MallocDeleter>, 8ul>::~SmallVector()
Line
Count
Source
293
600
  {
294
600
    clear();
295
600
    if (this->ptr != stack_storage.data())
296
0
      free(this->ptr);
297
600
  }
spirv_cross::SmallVector<spirv_cross::SPIRBlock*, 0ul>::~SmallVector()
Line
Count
Source
293
600
  {
294
600
    clear();
295
600
    if (this->ptr != stack_storage.data())
296
227
      free(this->ptr);
297
600
  }
spirv_cross::SmallVector<std::__1::unique_ptr<spirv_cross::SPIRExtension, spirv_cross::ObjectPool<spirv_cross::SPIRExtension>::MallocDeleter>, 8ul>::~SmallVector()
Line
Count
Source
293
600
  {
294
600
    clear();
295
600
    if (this->ptr != stack_storage.data())
296
0
      free(this->ptr);
297
600
  }
spirv_cross::SmallVector<spirv_cross::SPIRExtension*, 0ul>::~SmallVector()
Line
Count
Source
293
600
  {
294
600
    clear();
295
600
    if (this->ptr != stack_storage.data())
296
284
      free(this->ptr);
297
600
  }
spirv_cross::SmallVector<std::__1::unique_ptr<spirv_cross::SPIRExpression, spirv_cross::ObjectPool<spirv_cross::SPIRExpression>::MallocDeleter>, 8ul>::~SmallVector()
Line
Count
Source
293
600
  {
294
600
    clear();
295
600
    if (this->ptr != stack_storage.data())
296
0
      free(this->ptr);
297
600
  }
spirv_cross::SmallVector<spirv_cross::SPIRExpression*, 0ul>::~SmallVector()
Line
Count
Source
293
600
  {
294
600
    clear();
295
600
    if (this->ptr != stack_storage.data())
296
0
      free(this->ptr);
297
600
  }
spirv_cross::SmallVector<std::__1::unique_ptr<spirv_cross::SPIRConstantOp, spirv_cross::ObjectPool<spirv_cross::SPIRConstantOp>::MallocDeleter>, 8ul>::~SmallVector()
Line
Count
Source
293
600
  {
294
600
    clear();
295
600
    if (this->ptr != stack_storage.data())
296
0
      free(this->ptr);
297
600
  }
spirv_cross::SmallVector<spirv_cross::SPIRConstantOp*, 0ul>::~SmallVector()
Line
Count
Source
293
600
  {
294
600
    clear();
295
600
    if (this->ptr != stack_storage.data())
296
13
      free(this->ptr);
297
600
  }
spirv_cross::SmallVector<std::__1::unique_ptr<spirv_cross::SPIRCombinedImageSampler, spirv_cross::ObjectPool<spirv_cross::SPIRCombinedImageSampler>::MallocDeleter>, 8ul>::~SmallVector()
Line
Count
Source
293
600
  {
294
600
    clear();
295
600
    if (this->ptr != stack_storage.data())
296
0
      free(this->ptr);
297
600
  }
spirv_cross::SmallVector<spirv_cross::SPIRCombinedImageSampler*, 0ul>::~SmallVector()
Line
Count
Source
293
600
  {
294
600
    clear();
295
600
    if (this->ptr != stack_storage.data())
296
0
      free(this->ptr);
297
600
  }
spirv_cross::SmallVector<std::__1::unique_ptr<spirv_cross::SPIRAccessChain, spirv_cross::ObjectPool<spirv_cross::SPIRAccessChain>::MallocDeleter>, 8ul>::~SmallVector()
Line
Count
Source
293
600
  {
294
600
    clear();
295
600
    if (this->ptr != stack_storage.data())
296
0
      free(this->ptr);
297
600
  }
spirv_cross::SmallVector<spirv_cross::SPIRAccessChain*, 0ul>::~SmallVector()
Line
Count
Source
293
600
  {
294
600
    clear();
295
600
    if (this->ptr != stack_storage.data())
296
0
      free(this->ptr);
297
600
  }
spirv_cross::SmallVector<std::__1::unique_ptr<spirv_cross::SPIRUndef, spirv_cross::ObjectPool<spirv_cross::SPIRUndef>::MallocDeleter>, 8ul>::~SmallVector()
Line
Count
Source
293
600
  {
294
600
    clear();
295
600
    if (this->ptr != stack_storage.data())
296
0
      free(this->ptr);
297
600
  }
spirv_cross::SmallVector<spirv_cross::SPIRUndef*, 0ul>::~SmallVector()
Line
Count
Source
293
600
  {
294
600
    clear();
295
600
    if (this->ptr != stack_storage.data())
296
71
      free(this->ptr);
297
600
  }
spirv_cross::SmallVector<std::__1::unique_ptr<spirv_cross::SPIRString, spirv_cross::ObjectPool<spirv_cross::SPIRString>::MallocDeleter>, 8ul>::~SmallVector()
Line
Count
Source
293
600
  {
294
600
    clear();
295
600
    if (this->ptr != stack_storage.data())
296
0
      free(this->ptr);
297
600
  }
spirv_cross::SmallVector<spirv_cross::SPIRString*, 0ul>::~SmallVector()
Line
Count
Source
293
600
  {
294
600
    clear();
295
600
    if (this->ptr != stack_storage.data())
296
4
      free(this->ptr);
297
600
  }
298
299
  void clear() SPIRV_CROSS_NOEXCEPT
300
325k
  {
301
83.2M
    for (size_t i = 0; i < this->buffer_size; i++)
302
82.9M
      this->ptr[i].~T();
303
325k
    this->buffer_size = 0;
304
325k
  }
spirv_cross::SmallVector<std::__1::pair<unsigned int, unsigned int>, 8ul>::clear()
Line
Count
Source
300
999
  {
301
3.82k
    for (size_t i = 0; i < this->buffer_size; i++)
302
2.82k
      this->ptr[i].~T();
303
999
    this->buffer_size = 0;
304
999
  }
spirv_cross::SmallVector<unsigned int, 8ul>::clear()
Line
Count
Source
300
90.0k
  {
301
215k
    for (size_t i = 0; i < this->buffer_size; i++)
302
125k
      this->ptr[i].~T();
303
90.0k
    this->buffer_size = 0;
304
90.0k
  }
spirv_cross::SmallVector<spirv_cross::TypedID<(spirv_cross::Types)2>, 8ul>::clear()
Line
Count
Source
300
33.9k
  {
301
48.0k
    for (size_t i = 0; i < this->buffer_size; i++)
302
14.1k
      this->ptr[i].~T();
303
33.9k
    this->buffer_size = 0;
304
33.9k
  }
spirv_cross::SmallVector<unsigned char, 8ul>::clear()
Line
Count
Source
300
600
  {
301
37.8M
    for (size_t i = 0; i < this->buffer_size; i++)
302
37.8M
      this->ptr[i].~T();
303
600
    this->buffer_size = 0;
304
600
  }
spirv_cross::SmallVector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, 8ul>::clear()
Line
Count
Source
300
600
  {
301
314k
    for (size_t i = 0; i < this->buffer_size; i++)
302
313k
      this->ptr[i].~T();
303
600
    this->buffer_size = 0;
304
600
  }
spirv_cross::SmallVector<spv::Capability, 8ul>::clear()
Line
Count
Source
300
600
  {
301
4.20k
    for (size_t i = 0; i < this->buffer_size; i++)
302
3.60k
      this->ptr[i].~T();
303
600
    this->buffer_size = 0;
304
600
  }
spirv_cross::SmallVector<spirv_cross::TypedID<(spirv_cross::Types)0>, 8ul>::clear()
Line
Count
Source
300
29.3k
  {
301
76.3k
    for (size_t i = 0; i < this->buffer_size; i++)
302
46.9k
      this->ptr[i].~T();
303
29.3k
    this->buffer_size = 0;
304
29.3k
  }
spirv_cross::SmallVector<spirv_cross::Meta::Decoration, 0ul>::clear()
Line
Count
Source
300
8.15k
  {
301
5.94M
    for (size_t i = 0; i < this->buffer_size; i++)
302
5.93M
      this->ptr[i].~T();
303
8.15k
    this->buffer_size = 0;
304
8.15k
  }
spirv_cross::SmallVector<spirv_cross::Variant, 8ul>::clear()
Line
Count
Source
300
600
  {
301
37.8M
    for (size_t i = 0; i < this->buffer_size; i++)
302
37.8M
      this->ptr[i].~T();
303
600
    this->buffer_size = 0;
304
600
  }
Unexecuted instantiation: spirv_cross::SmallVector<spirv_cross::StringStream<4096ul, 4096ul>::Buffer, 8ul>::clear()
spirv_cross::SmallVector<bool, 8ul>::clear()
Line
Count
Source
300
33.6k
  {
301
66.8k
    for (size_t i = 0; i < this->buffer_size; i++)
302
33.1k
      this->ptr[i].~T();
303
33.6k
    this->buffer_size = 0;
304
33.6k
  }
spirv_cross::SmallVector<spirv_cross::TypedID<(spirv_cross::Types)1>, 8ul>::clear()
Line
Count
Source
300
34.0k
  {
301
43.3k
    for (size_t i = 0; i < this->buffer_size; i++)
302
9.31k
      this->ptr[i].~T();
303
34.0k
    this->buffer_size = 0;
304
34.0k
  }
spirv_cross::SmallVector<spirv_cross::Instruction, 8ul>::clear()
Line
Count
Source
300
10.3k
  {
301
631k
    for (size_t i = 0; i < this->buffer_size; i++)
302
621k
      this->ptr[i].~T();
303
10.3k
    this->buffer_size = 0;
304
10.3k
  }
spirv_cross::SmallVector<spirv_cross::SPIRBlock::Phi, 8ul>::clear()
Line
Count
Source
300
9.80k
  {
301
16.0k
    for (size_t i = 0; i < this->buffer_size; i++)
302
6.29k
      this->ptr[i].~T();
303
9.80k
    this->buffer_size = 0;
304
9.80k
  }
spirv_cross::SmallVector<std::__1::pair<spirv_cross::TypedID<(spirv_cross::Types)1>, spirv_cross::TypedID<(spirv_cross::Types)0> >, 8ul>::clear()
Line
Count
Source
300
19.6k
  {
301
19.6k
    for (size_t i = 0; i < this->buffer_size; i++)
302
0
      this->ptr[i].~T();
303
19.6k
    this->buffer_size = 0;
304
19.6k
  }
spirv_cross::SmallVector<spirv_cross::SPIRBlock::Case, 8ul>::clear()
Line
Count
Source
300
19.6k
  {
301
20.8k
    for (size_t i = 0; i < this->buffer_size; i++)
302
1.20k
      this->ptr[i].~T();
303
19.6k
    this->buffer_size = 0;
304
19.6k
  }
spirv_cross::SmallVector<spirv_cross::SPIRFunction::Parameter, 8ul>::clear()
Line
Count
Source
300
900
  {
301
1.06k
    for (size_t i = 0; i < this->buffer_size; i++)
302
166
      this->ptr[i].~T();
303
900
    this->buffer_size = 0;
304
900
  }
spirv_cross::SmallVector<spirv_cross::TypedID<(spirv_cross::Types)6>, 8ul>::clear()
Line
Count
Source
300
450
  {
301
10.2k
    for (size_t i = 0; i < this->buffer_size; i++)
302
9.81k
      this->ptr[i].~T();
303
450
    this->buffer_size = 0;
304
450
  }
spirv_cross::SmallVector<spirv_cross::SPIRFunction::CombinedImageSamplerParameter, 8ul>::clear()
Line
Count
Source
300
450
  {
301
450
    for (size_t i = 0; i < this->buffer_size; i++)
302
0
      this->ptr[i].~T();
303
450
    this->buffer_size = 0;
304
450
  }
spirv_cross::SmallVector<std::__1::function<void ()>, 0ul>::clear()
Line
Count
Source
300
900
  {
301
900
    for (size_t i = 0; i < this->buffer_size; i++)
302
0
      this->ptr[i].~T();
303
900
    this->buffer_size = 0;
304
900
  }
spirv_cross::SmallVector<spirv_cross::TypedID<(spirv_cross::Types)3>, 8ul>::clear()
Line
Count
Source
300
15.3k
  {
301
21.4k
    for (size_t i = 0; i < this->buffer_size; i++)
302
6.10k
      this->ptr[i].~T();
303
15.3k
    this->buffer_size = 0;
304
15.3k
  }
spirv_cross::SmallVector<std::__1::unique_ptr<spirv_cross::SPIRType, spirv_cross::ObjectPool<spirv_cross::SPIRType>::MallocDeleter>, 8ul>::clear()
Line
Count
Source
300
600
  {
301
1.04k
    for (size_t i = 0; i < this->buffer_size; i++)
302
442
      this->ptr[i].~T();
303
600
    this->buffer_size = 0;
304
600
  }
spirv_cross::SmallVector<spirv_cross::SPIRType*, 0ul>::clear()
Line
Count
Source
300
600
  {
301
9.08k
    for (size_t i = 0; i < this->buffer_size; i++)
302
8.48k
      this->ptr[i].~T();
303
600
    this->buffer_size = 0;
304
600
  }
spirv_cross::SmallVector<std::__1::unique_ptr<spirv_cross::SPIRVariable, spirv_cross::ObjectPool<spirv_cross::SPIRVariable>::MallocDeleter>, 8ul>::clear()
Line
Count
Source
300
600
  {
301
933
    for (size_t i = 0; i < this->buffer_size; i++)
302
333
      this->ptr[i].~T();
303
600
    this->buffer_size = 0;
304
600
  }
spirv_cross::SmallVector<spirv_cross::SPIRVariable*, 0ul>::clear()
Line
Count
Source
300
600
  {
301
7.57k
    for (size_t i = 0; i < this->buffer_size; i++)
302
6.97k
      this->ptr[i].~T();
303
600
    this->buffer_size = 0;
304
600
  }
spirv_cross::SmallVector<std::__1::unique_ptr<spirv_cross::SPIRConstant, spirv_cross::ObjectPool<spirv_cross::SPIRConstant>::MallocDeleter>, 8ul>::clear()
Line
Count
Source
300
600
  {
301
1.06k
    for (size_t i = 0; i < this->buffer_size; i++)
302
466
      this->ptr[i].~T();
303
600
    this->buffer_size = 0;
304
600
  }
spirv_cross::SmallVector<spirv_cross::SPIRConstant*, 0ul>::clear()
Line
Count
Source
300
600
  {
301
16.9k
    for (size_t i = 0; i < this->buffer_size; i++)
302
16.3k
      this->ptr[i].~T();
303
600
    this->buffer_size = 0;
304
600
  }
spirv_cross::SmallVector<std::__1::unique_ptr<spirv_cross::SPIRFunction, spirv_cross::ObjectPool<spirv_cross::SPIRFunction>::MallocDeleter>, 8ul>::clear()
Line
Count
Source
300
600
  {
301
827
    for (size_t i = 0; i < this->buffer_size; i++)
302
227
      this->ptr[i].~T();
303
600
    this->buffer_size = 0;
304
600
  }
spirv_cross::SmallVector<spirv_cross::SPIRFunction*, 0ul>::clear()
Line
Count
Source
300
600
  {
301
4.23k
    for (size_t i = 0; i < this->buffer_size; i++)
302
3.63k
      this->ptr[i].~T();
303
600
    this->buffer_size = 0;
304
600
  }
spirv_cross::SmallVector<std::__1::unique_ptr<spirv_cross::SPIRFunctionPrototype, spirv_cross::ObjectPool<spirv_cross::SPIRFunctionPrototype>::MallocDeleter>, 8ul>::clear()
Line
Count
Source
300
600
  {
301
868
    for (size_t i = 0; i < this->buffer_size; i++)
302
268
      this->ptr[i].~T();
303
600
    this->buffer_size = 0;
304
600
  }
spirv_cross::SmallVector<spirv_cross::SPIRFunctionPrototype*, 0ul>::clear()
Line
Count
Source
300
600
  {
301
4.88k
    for (size_t i = 0; i < this->buffer_size; i++)
302
4.28k
      this->ptr[i].~T();
303
600
    this->buffer_size = 0;
304
600
  }
spirv_cross::SmallVector<std::__1::unique_ptr<spirv_cross::SPIRBlock, spirv_cross::ObjectPool<spirv_cross::SPIRBlock>::MallocDeleter>, 8ul>::clear()
Line
Count
Source
300
600
  {
301
950
    for (size_t i = 0; i < this->buffer_size; i++)
302
350
      this->ptr[i].~T();
303
600
    this->buffer_size = 0;
304
600
  }
spirv_cross::SmallVector<spirv_cross::SPIRBlock*, 0ul>::clear()
Line
Count
Source
300
600
  {
301
11.1k
    for (size_t i = 0; i < this->buffer_size; i++)
302
10.5k
      this->ptr[i].~T();
303
600
    this->buffer_size = 0;
304
600
  }
spirv_cross::SmallVector<std::__1::unique_ptr<spirv_cross::SPIRExtension, spirv_cross::ObjectPool<spirv_cross::SPIRExtension>::MallocDeleter>, 8ul>::clear()
Line
Count
Source
300
600
  {
301
884
    for (size_t i = 0; i < this->buffer_size; i++)
302
284
      this->ptr[i].~T();
303
600
    this->buffer_size = 0;
304
600
  }
spirv_cross::SmallVector<spirv_cross::SPIRExtension*, 0ul>::clear()
Line
Count
Source
300
600
  {
301
5.14k
    for (size_t i = 0; i < this->buffer_size; i++)
302
4.54k
      this->ptr[i].~T();
303
600
    this->buffer_size = 0;
304
600
  }
spirv_cross::SmallVector<std::__1::unique_ptr<spirv_cross::SPIRExpression, spirv_cross::ObjectPool<spirv_cross::SPIRExpression>::MallocDeleter>, 8ul>::clear()
Line
Count
Source
300
600
  {
301
600
    for (size_t i = 0; i < this->buffer_size; i++)
302
0
      this->ptr[i].~T();
303
600
    this->buffer_size = 0;
304
600
  }
spirv_cross::SmallVector<spirv_cross::SPIRExpression*, 0ul>::clear()
Line
Count
Source
300
600
  {
301
600
    for (size_t i = 0; i < this->buffer_size; i++)
302
0
      this->ptr[i].~T();
303
600
    this->buffer_size = 0;
304
600
  }
spirv_cross::SmallVector<std::__1::unique_ptr<spirv_cross::SPIRConstantOp, spirv_cross::ObjectPool<spirv_cross::SPIRConstantOp>::MallocDeleter>, 8ul>::clear()
Line
Count
Source
300
600
  {
301
613
    for (size_t i = 0; i < this->buffer_size; i++)
302
13
      this->ptr[i].~T();
303
600
    this->buffer_size = 0;
304
600
  }
spirv_cross::SmallVector<spirv_cross::SPIRConstantOp*, 0ul>::clear()
Line
Count
Source
300
600
  {
301
808
    for (size_t i = 0; i < this->buffer_size; i++)
302
208
      this->ptr[i].~T();
303
600
    this->buffer_size = 0;
304
600
  }
spirv_cross::SmallVector<std::__1::unique_ptr<spirv_cross::SPIRCombinedImageSampler, spirv_cross::ObjectPool<spirv_cross::SPIRCombinedImageSampler>::MallocDeleter>, 8ul>::clear()
Line
Count
Source
300
600
  {
301
600
    for (size_t i = 0; i < this->buffer_size; i++)
302
0
      this->ptr[i].~T();
303
600
    this->buffer_size = 0;
304
600
  }
spirv_cross::SmallVector<spirv_cross::SPIRCombinedImageSampler*, 0ul>::clear()
Line
Count
Source
300
600
  {
301
600
    for (size_t i = 0; i < this->buffer_size; i++)
302
0
      this->ptr[i].~T();
303
600
    this->buffer_size = 0;
304
600
  }
spirv_cross::SmallVector<std::__1::unique_ptr<spirv_cross::SPIRAccessChain, spirv_cross::ObjectPool<spirv_cross::SPIRAccessChain>::MallocDeleter>, 8ul>::clear()
Line
Count
Source
300
600
  {
301
600
    for (size_t i = 0; i < this->buffer_size; i++)
302
0
      this->ptr[i].~T();
303
600
    this->buffer_size = 0;
304
600
  }
spirv_cross::SmallVector<spirv_cross::SPIRAccessChain*, 0ul>::clear()
Line
Count
Source
300
600
  {
301
600
    for (size_t i = 0; i < this->buffer_size; i++)
302
0
      this->ptr[i].~T();
303
600
    this->buffer_size = 0;
304
600
  }
spirv_cross::SmallVector<std::__1::unique_ptr<spirv_cross::SPIRUndef, spirv_cross::ObjectPool<spirv_cross::SPIRUndef>::MallocDeleter>, 8ul>::clear()
Line
Count
Source
300
600
  {
301
671
    for (size_t i = 0; i < this->buffer_size; i++)
302
71
      this->ptr[i].~T();
303
600
    this->buffer_size = 0;
304
600
  }
spirv_cross::SmallVector<spirv_cross::SPIRUndef*, 0ul>::clear()
Line
Count
Source
300
600
  {
301
1.73k
    for (size_t i = 0; i < this->buffer_size; i++)
302
1.13k
      this->ptr[i].~T();
303
600
    this->buffer_size = 0;
304
600
  }
spirv_cross::SmallVector<std::__1::unique_ptr<spirv_cross::SPIRString, spirv_cross::ObjectPool<spirv_cross::SPIRString>::MallocDeleter>, 8ul>::clear()
Line
Count
Source
300
600
  {
301
604
    for (size_t i = 0; i < this->buffer_size; i++)
302
4
      this->ptr[i].~T();
303
600
    this->buffer_size = 0;
304
600
  }
spirv_cross::SmallVector<spirv_cross::SPIRString*, 0ul>::clear()
Line
Count
Source
300
600
  {
301
664
    for (size_t i = 0; i < this->buffer_size; i++)
302
64
      this->ptr[i].~T();
303
600
    this->buffer_size = 0;
304
600
  }
305
306
  void push_back(const T &t) SPIRV_CROSS_NOEXCEPT
307
824k
  {
308
824k
    reserve(this->buffer_size + 1);
309
824k
    new (&this->ptr[this->buffer_size]) T(t);
310
824k
    this->buffer_size++;
311
824k
  }
Unexecuted instantiation: spirv_cross::SmallVector<spirv_cross::StringStream<4096ul, 4096ul>::Buffer, 8ul>::push_back(spirv_cross::StringStream<4096ul, 4096ul>::Buffer const&)
spirv_cross::SmallVector<unsigned int, 8ul>::push_back(unsigned int const&)
Line
Count
Source
307
87.6k
  {
308
87.6k
    reserve(this->buffer_size + 1);
309
87.6k
    new (&this->ptr[this->buffer_size]) T(t);
310
87.6k
    this->buffer_size++;
311
87.6k
  }
spirv_cross::SmallVector<spirv_cross::TypedID<(spirv_cross::Types)2>, 8ul>::push_back(spirv_cross::TypedID<(spirv_cross::Types)2> const&)
Line
Count
Source
307
4.18k
  {
308
4.18k
    reserve(this->buffer_size + 1);
309
4.18k
    new (&this->ptr[this->buffer_size]) T(t);
310
4.18k
    this->buffer_size++;
311
4.18k
  }
spirv_cross::SmallVector<spirv_cross::Instruction, 8ul>::push_back(spirv_cross::Instruction const&)
Line
Count
Source
307
621k
  {
308
621k
    reserve(this->buffer_size + 1);
309
621k
    new (&this->ptr[this->buffer_size]) T(t);
310
621k
    this->buffer_size++;
311
621k
  }
spirv_cross::SmallVector<bool, 8ul>::push_back(bool const&)
Line
Count
Source
307
383
  {
308
383
    reserve(this->buffer_size + 1);
309
383
    new (&this->ptr[this->buffer_size]) T(t);
310
383
    this->buffer_size++;
311
383
  }
spirv_cross::SmallVector<spirv_cross::SPIRType*, 0ul>::push_back(spirv_cross::SPIRType* const&)
Line
Count
Source
307
22.2k
  {
308
22.2k
    reserve(this->buffer_size + 1);
309
22.2k
    new (&this->ptr[this->buffer_size]) T(t);
310
22.2k
    this->buffer_size++;
311
22.2k
  }
spirv_cross::SmallVector<spirv_cross::SPIRVariable*, 0ul>::push_back(spirv_cross::SPIRVariable* const&)
Line
Count
Source
307
9.50k
  {
308
9.50k
    reserve(this->buffer_size + 1);
309
9.50k
    new (&this->ptr[this->buffer_size]) T(t);
310
9.50k
    this->buffer_size++;
311
9.50k
  }
spirv_cross::SmallVector<spirv_cross::SPIRConstant*, 0ul>::push_back(spirv_cross::SPIRConstant* const&)
Line
Count
Source
307
12.6k
  {
308
12.6k
    reserve(this->buffer_size + 1);
309
12.6k
    new (&this->ptr[this->buffer_size]) T(t);
310
12.6k
    this->buffer_size++;
311
12.6k
  }
spirv_cross::SmallVector<spirv_cross::SPIRFunction*, 0ul>::push_back(spirv_cross::SPIRFunction* const&)
Line
Count
Source
307
450
  {
308
450
    reserve(this->buffer_size + 1);
309
450
    new (&this->ptr[this->buffer_size]) T(t);
310
450
    this->buffer_size++;
311
450
  }
spirv_cross::SmallVector<spirv_cross::SPIRFunctionPrototype*, 0ul>::push_back(spirv_cross::SPIRFunctionPrototype* const&)
Line
Count
Source
307
5.83k
  {
308
5.83k
    reserve(this->buffer_size + 1);
309
5.83k
    new (&this->ptr[this->buffer_size]) T(t);
310
5.83k
    this->buffer_size++;
311
5.83k
  }
spirv_cross::SmallVector<spirv_cross::SPIRBlock*, 0ul>::push_back(spirv_cross::SPIRBlock* const&)
Line
Count
Source
307
9.80k
  {
308
9.80k
    reserve(this->buffer_size + 1);
309
9.80k
    new (&this->ptr[this->buffer_size]) T(t);
310
9.80k
    this->buffer_size++;
311
9.80k
  }
spirv_cross::SmallVector<spirv_cross::SPIRExtension*, 0ul>::push_back(spirv_cross::SPIRExtension* const&)
Line
Count
Source
307
508
  {
308
508
    reserve(this->buffer_size + 1);
309
508
    new (&this->ptr[this->buffer_size]) T(t);
310
508
    this->buffer_size++;
311
508
  }
Unexecuted instantiation: spirv_cross::SmallVector<spirv_cross::SPIRExpression*, 0ul>::push_back(spirv_cross::SPIRExpression* const&)
spirv_cross::SmallVector<spirv_cross::SPIRConstantOp*, 0ul>::push_back(spirv_cross::SPIRConstantOp* const&)
Line
Count
Source
307
791
  {
308
791
    reserve(this->buffer_size + 1);
309
791
    new (&this->ptr[this->buffer_size]) T(t);
310
791
    this->buffer_size++;
311
791
  }
Unexecuted instantiation: spirv_cross::SmallVector<spirv_cross::SPIRCombinedImageSampler*, 0ul>::push_back(spirv_cross::SPIRCombinedImageSampler* const&)
Unexecuted instantiation: spirv_cross::SmallVector<spirv_cross::SPIRAccessChain*, 0ul>::push_back(spirv_cross::SPIRAccessChain* const&)
spirv_cross::SmallVector<spirv_cross::SPIRUndef*, 0ul>::push_back(spirv_cross::SPIRUndef* const&)
Line
Count
Source
307
1.81k
  {
308
1.81k
    reserve(this->buffer_size + 1);
309
1.81k
    new (&this->ptr[this->buffer_size]) T(t);
310
1.81k
    this->buffer_size++;
311
1.81k
  }
spirv_cross::SmallVector<spirv_cross::SPIRString*, 0ul>::push_back(spirv_cross::SPIRString* const&)
Line
Count
Source
307
886
  {
308
886
    reserve(this->buffer_size + 1);
309
886
    new (&this->ptr[this->buffer_size]) T(t);
310
886
    this->buffer_size++;
311
886
  }
spirv_cross::SmallVector<spirv_cross::TypedID<(spirv_cross::Types)0>, 8ul>::push_back(spirv_cross::TypedID<(spirv_cross::Types)0> const&)
Line
Count
Source
307
46.9k
  {
308
46.9k
    reserve(this->buffer_size + 1);
309
46.9k
    new (&this->ptr[this->buffer_size]) T(t);
310
46.9k
    this->buffer_size++;
311
46.9k
  }
312
313
  void push_back(T &&t) SPIRV_CROSS_NOEXCEPT
314
416k
  {
315
416k
    reserve(this->buffer_size + 1);
316
416k
    new (&this->ptr[this->buffer_size]) T(std::move(t));
317
416k
    this->buffer_size++;
318
416k
  }
spirv_cross::SmallVector<spirv_cross::SPIRUndef*, 0ul>::push_back(spirv_cross::SPIRUndef*&&)
Line
Count
Source
314
1.13k
  {
315
1.13k
    reserve(this->buffer_size + 1);
316
1.13k
    new (&this->ptr[this->buffer_size]) T(std::move(t));
317
1.13k
    this->buffer_size++;
318
1.13k
  }
spirv_cross::SmallVector<spirv_cross::SPIRString*, 0ul>::push_back(spirv_cross::SPIRString*&&)
Line
Count
Source
314
64
  {
315
64
    reserve(this->buffer_size + 1);
316
64
    new (&this->ptr[this->buffer_size]) T(std::move(t));
317
64
    this->buffer_size++;
318
64
  }
Unexecuted instantiation: spirv_cross::SmallVector<spirv_cross::SPIRCombinedImageSampler*, 0ul>::push_back(spirv_cross::SPIRCombinedImageSampler*&&)
spirv_cross::SmallVector<spirv_cross::SPIRConstantOp*, 0ul>::push_back(spirv_cross::SPIRConstantOp*&&)
Line
Count
Source
314
208
  {
315
208
    reserve(this->buffer_size + 1);
316
208
    new (&this->ptr[this->buffer_size]) T(std::move(t));
317
208
    this->buffer_size++;
318
208
  }
spirv_cross::SmallVector<spirv_cross::SPIRType*, 0ul>::push_back(spirv_cross::SPIRType*&&)
Line
Count
Source
314
8.48k
  {
315
8.48k
    reserve(this->buffer_size + 1);
316
8.48k
    new (&this->ptr[this->buffer_size]) T(std::move(t));
317
8.48k
    this->buffer_size++;
318
8.48k
  }
spirv_cross::SmallVector<spirv_cross::SPIRExtension*, 0ul>::push_back(spirv_cross::SPIRExtension*&&)
Line
Count
Source
314
4.54k
  {
315
4.54k
    reserve(this->buffer_size + 1);
316
4.54k
    new (&this->ptr[this->buffer_size]) T(std::move(t));
317
4.54k
    this->buffer_size++;
318
4.54k
  }
Unexecuted instantiation: spirv_cross::SmallVector<spirv_cross::SPIRExpression*, 0ul>::push_back(spirv_cross::SPIRExpression*&&)
spirv_cross::SmallVector<spirv_cross::SPIRFunctionPrototype*, 0ul>::push_back(spirv_cross::SPIRFunctionPrototype*&&)
Line
Count
Source
314
4.28k
  {
315
4.28k
    reserve(this->buffer_size + 1);
316
4.28k
    new (&this->ptr[this->buffer_size]) T(std::move(t));
317
4.28k
    this->buffer_size++;
318
4.28k
  }
spirv_cross::SmallVector<spirv_cross::SPIRBlock*, 0ul>::push_back(spirv_cross::SPIRBlock*&&)
Line
Count
Source
314
10.5k
  {
315
10.5k
    reserve(this->buffer_size + 1);
316
10.5k
    new (&this->ptr[this->buffer_size]) T(std::move(t));
317
10.5k
    this->buffer_size++;
318
10.5k
  }
spirv_cross::SmallVector<spirv_cross::SPIRFunction::Parameter, 8ul>::push_back(spirv_cross::SPIRFunction::Parameter&&)
Line
Count
Source
314
166
  {
315
166
    reserve(this->buffer_size + 1);
316
166
    new (&this->ptr[this->buffer_size]) T(std::move(t));
317
166
    this->buffer_size++;
318
166
  }
spirv_cross::SmallVector<spirv_cross::SPIRFunction*, 0ul>::push_back(spirv_cross::SPIRFunction*&&)
Line
Count
Source
314
3.63k
  {
315
3.63k
    reserve(this->buffer_size + 1);
316
3.63k
    new (&this->ptr[this->buffer_size]) T(std::move(t));
317
3.63k
    this->buffer_size++;
318
3.63k
  }
Unexecuted instantiation: spirv_cross::SmallVector<spirv_cross::SPIRAccessChain*, 0ul>::push_back(spirv_cross::SPIRAccessChain*&&)
spirv_cross::SmallVector<spirv_cross::SPIRVariable*, 0ul>::push_back(spirv_cross::SPIRVariable*&&)
Line
Count
Source
314
6.97k
  {
315
6.97k
    reserve(this->buffer_size + 1);
316
6.97k
    new (&this->ptr[this->buffer_size]) T(std::move(t));
317
6.97k
    this->buffer_size++;
318
6.97k
  }
spirv_cross::SmallVector<spirv_cross::TypedID<(spirv_cross::Types)3>, 8ul>::push_back(spirv_cross::TypedID<(spirv_cross::Types)3>&&)
Line
Count
Source
314
6.10k
  {
315
6.10k
    reserve(this->buffer_size + 1);
316
6.10k
    new (&this->ptr[this->buffer_size]) T(std::move(t));
317
6.10k
    this->buffer_size++;
318
6.10k
  }
spirv_cross::SmallVector<spirv_cross::SPIRConstant*, 0ul>::push_back(spirv_cross::SPIRConstant*&&)
Line
Count
Source
314
16.3k
  {
315
16.3k
    reserve(this->buffer_size + 1);
316
16.3k
    new (&this->ptr[this->buffer_size]) T(std::move(t));
317
16.3k
    this->buffer_size++;
318
16.3k
  }
spirv_cross::SmallVector<spv::Capability, 8ul>::push_back(spv::Capability&&)
Line
Count
Source
314
3.60k
  {
315
3.60k
    reserve(this->buffer_size + 1);
316
3.60k
    new (&this->ptr[this->buffer_size]) T(std::move(t));
317
3.60k
    this->buffer_size++;
318
3.60k
  }
spirv_cross::SmallVector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, 8ul>::push_back(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&&)
Line
Count
Source
314
313k
  {
315
313k
    reserve(this->buffer_size + 1);
316
313k
    new (&this->ptr[this->buffer_size]) T(std::move(t));
317
313k
    this->buffer_size++;
318
313k
  }
spirv_cross::SmallVector<spirv_cross::TypedID<(spirv_cross::Types)2>, 8ul>::push_back(spirv_cross::TypedID<(spirv_cross::Types)2>&&)
Line
Count
Source
314
9.92k
  {
315
9.92k
    reserve(this->buffer_size + 1);
316
9.92k
    new (&this->ptr[this->buffer_size]) T(std::move(t));
317
9.92k
    this->buffer_size++;
318
9.92k
  }
spirv_cross::SmallVector<std::__1::pair<unsigned int, unsigned int>, 8ul>::push_back(std::__1::pair<unsigned int, unsigned int>&&)
Line
Count
Source
314
2.82k
  {
315
2.82k
    reserve(this->buffer_size + 1);
316
2.82k
    new (&this->ptr[this->buffer_size]) T(std::move(t));
317
2.82k
    this->buffer_size++;
318
2.82k
  }
spirv_cross::SmallVector<unsigned int, 8ul>::push_back(unsigned int&&)
Line
Count
Source
314
1.18k
  {
315
1.18k
    reserve(this->buffer_size + 1);
316
1.18k
    new (&this->ptr[this->buffer_size]) T(std::move(t));
317
1.18k
    this->buffer_size++;
318
1.18k
  }
spirv_cross::SmallVector<bool, 8ul>::push_back(bool&&)
Line
Count
Source
314
801
  {
315
801
    reserve(this->buffer_size + 1);
316
801
    new (&this->ptr[this->buffer_size]) T(std::move(t));
317
801
    this->buffer_size++;
318
801
  }
spirv_cross::SmallVector<spirv_cross::TypedID<(spirv_cross::Types)1>, 8ul>::push_back(spirv_cross::TypedID<(spirv_cross::Types)1>&&)
Line
Count
Source
314
4.39k
  {
315
4.39k
    reserve(this->buffer_size + 1);
316
4.39k
    new (&this->ptr[this->buffer_size]) T(std::move(t));
317
4.39k
    this->buffer_size++;
318
4.39k
  }
spirv_cross::SmallVector<spirv_cross::SPIRBlock::Phi, 8ul>::push_back(spirv_cross::SPIRBlock::Phi&&)
Line
Count
Source
314
6.29k
  {
315
6.29k
    reserve(this->buffer_size + 1);
316
6.29k
    new (&this->ptr[this->buffer_size]) T(std::move(t));
317
6.29k
    this->buffer_size++;
318
6.29k
  }
spirv_cross::SmallVector<spirv_cross::TypedID<(spirv_cross::Types)6>, 8ul>::push_back(spirv_cross::TypedID<(spirv_cross::Types)6>&&)
Line
Count
Source
314
9.81k
  {
315
9.81k
    reserve(this->buffer_size + 1);
316
9.81k
    new (&this->ptr[this->buffer_size]) T(std::move(t));
317
9.81k
    this->buffer_size++;
318
9.81k
  }
spirv_cross::SmallVector<spirv_cross::SPIRBlock::Case, 8ul>::push_back(spirv_cross::SPIRBlock::Case&&)
Line
Count
Source
314
1.20k
  {
315
1.20k
    reserve(this->buffer_size + 1);
316
1.20k
    new (&this->ptr[this->buffer_size]) T(std::move(t));
317
1.20k
    this->buffer_size++;
318
1.20k
  }
319
320
  void pop_back() SPIRV_CROSS_NOEXCEPT
321
64.5k
  {
322
    // Work around false positive warning on GCC 8.3.
323
    // Calling pop_back on empty vector is undefined.
324
64.5k
    if (!this->empty())
325
64.5k
      resize(this->buffer_size - 1);
326
64.5k
  }
spirv_cross::SmallVector<spirv_cross::SPIRUndef*, 0ul>::pop_back()
Line
Count
Source
321
1.81k
  {
322
    // Work around false positive warning on GCC 8.3.
323
    // Calling pop_back on empty vector is undefined.
324
1.81k
    if (!this->empty())
325
1.81k
      resize(this->buffer_size - 1);
326
1.81k
  }
spirv_cross::SmallVector<spirv_cross::SPIRString*, 0ul>::pop_back()
Line
Count
Source
321
886
  {
322
    // Work around false positive warning on GCC 8.3.
323
    // Calling pop_back on empty vector is undefined.
324
886
    if (!this->empty())
325
886
      resize(this->buffer_size - 1);
326
886
  }
Unexecuted instantiation: spirv_cross::SmallVector<spirv_cross::SPIRCombinedImageSampler*, 0ul>::pop_back()
spirv_cross::SmallVector<spirv_cross::SPIRConstantOp*, 0ul>::pop_back()
Line
Count
Source
321
791
  {
322
    // Work around false positive warning on GCC 8.3.
323
    // Calling pop_back on empty vector is undefined.
324
791
    if (!this->empty())
325
791
      resize(this->buffer_size - 1);
326
791
  }
spirv_cross::SmallVector<spirv_cross::SPIRType*, 0ul>::pop_back()
Line
Count
Source
321
22.2k
  {
322
    // Work around false positive warning on GCC 8.3.
323
    // Calling pop_back on empty vector is undefined.
324
22.2k
    if (!this->empty())
325
22.2k
      resize(this->buffer_size - 1);
326
22.2k
  }
spirv_cross::SmallVector<spirv_cross::SPIRExtension*, 0ul>::pop_back()
Line
Count
Source
321
508
  {
322
    // Work around false positive warning on GCC 8.3.
323
    // Calling pop_back on empty vector is undefined.
324
508
    if (!this->empty())
325
508
      resize(this->buffer_size - 1);
326
508
  }
Unexecuted instantiation: spirv_cross::SmallVector<spirv_cross::SPIRExpression*, 0ul>::pop_back()
spirv_cross::SmallVector<spirv_cross::SPIRFunctionPrototype*, 0ul>::pop_back()
Line
Count
Source
321
5.83k
  {
322
    // Work around false positive warning on GCC 8.3.
323
    // Calling pop_back on empty vector is undefined.
324
5.83k
    if (!this->empty())
325
5.83k
      resize(this->buffer_size - 1);
326
5.83k
  }
spirv_cross::SmallVector<spirv_cross::SPIRBlock*, 0ul>::pop_back()
Line
Count
Source
321
9.80k
  {
322
    // Work around false positive warning on GCC 8.3.
323
    // Calling pop_back on empty vector is undefined.
324
9.80k
    if (!this->empty())
325
9.80k
      resize(this->buffer_size - 1);
326
9.80k
  }
spirv_cross::SmallVector<spirv_cross::SPIRFunction*, 0ul>::pop_back()
Line
Count
Source
321
450
  {
322
    // Work around false positive warning on GCC 8.3.
323
    // Calling pop_back on empty vector is undefined.
324
450
    if (!this->empty())
325
450
      resize(this->buffer_size - 1);
326
450
  }
Unexecuted instantiation: spirv_cross::SmallVector<spirv_cross::SPIRAccessChain*, 0ul>::pop_back()
spirv_cross::SmallVector<spirv_cross::SPIRVariable*, 0ul>::pop_back()
Line
Count
Source
321
9.50k
  {
322
    // Work around false positive warning on GCC 8.3.
323
    // Calling pop_back on empty vector is undefined.
324
9.50k
    if (!this->empty())
325
9.50k
      resize(this->buffer_size - 1);
326
9.50k
  }
spirv_cross::SmallVector<spirv_cross::SPIRConstant*, 0ul>::pop_back()
Line
Count
Source
321
12.6k
  {
322
    // Work around false positive warning on GCC 8.3.
323
    // Calling pop_back on empty vector is undefined.
324
12.6k
    if (!this->empty())
325
12.6k
      resize(this->buffer_size - 1);
326
12.6k
  }
327
328
  template <typename... Ts>
329
  void emplace_back(Ts &&... ts) SPIRV_CROSS_NOEXCEPT
330
37.8M
  {
331
37.8M
    reserve(this->buffer_size + 1);
332
37.8M
    new (&this->ptr[this->buffer_size]) T(std::forward<Ts>(ts)...);
333
37.8M
    this->buffer_size++;
334
37.8M
  }
void spirv_cross::SmallVector<std::__1::unique_ptr<spirv_cross::SPIRUndef, spirv_cross::ObjectPool<spirv_cross::SPIRUndef>::MallocDeleter>, 8ul>::emplace_back<spirv_cross::SPIRUndef*&>(spirv_cross::SPIRUndef*&)
Line
Count
Source
330
71
  {
331
71
    reserve(this->buffer_size + 1);
332
71
    new (&this->ptr[this->buffer_size]) T(std::forward<Ts>(ts)...);
333
71
    this->buffer_size++;
334
71
  }
void spirv_cross::SmallVector<std::__1::unique_ptr<spirv_cross::SPIRString, spirv_cross::ObjectPool<spirv_cross::SPIRString>::MallocDeleter>, 8ul>::emplace_back<spirv_cross::SPIRString*&>(spirv_cross::SPIRString*&)
Line
Count
Source
330
4
  {
331
4
    reserve(this->buffer_size + 1);
332
4
    new (&this->ptr[this->buffer_size]) T(std::forward<Ts>(ts)...);
333
4
    this->buffer_size++;
334
4
  }
Unexecuted instantiation: void spirv_cross::SmallVector<std::__1::unique_ptr<spirv_cross::SPIRCombinedImageSampler, spirv_cross::ObjectPool<spirv_cross::SPIRCombinedImageSampler>::MallocDeleter>, 8ul>::emplace_back<spirv_cross::SPIRCombinedImageSampler*&>(spirv_cross::SPIRCombinedImageSampler*&)
void spirv_cross::SmallVector<std::__1::unique_ptr<spirv_cross::SPIRConstantOp, spirv_cross::ObjectPool<spirv_cross::SPIRConstantOp>::MallocDeleter>, 8ul>::emplace_back<spirv_cross::SPIRConstantOp*&>(spirv_cross::SPIRConstantOp*&)
Line
Count
Source
330
13
  {
331
13
    reserve(this->buffer_size + 1);
332
13
    new (&this->ptr[this->buffer_size]) T(std::forward<Ts>(ts)...);
333
13
    this->buffer_size++;
334
13
  }
void spirv_cross::SmallVector<std::__1::unique_ptr<spirv_cross::SPIRType, spirv_cross::ObjectPool<spirv_cross::SPIRType>::MallocDeleter>, 8ul>::emplace_back<spirv_cross::SPIRType*&>(spirv_cross::SPIRType*&)
Line
Count
Source
330
442
  {
331
442
    reserve(this->buffer_size + 1);
332
442
    new (&this->ptr[this->buffer_size]) T(std::forward<Ts>(ts)...);
333
442
    this->buffer_size++;
334
442
  }
void spirv_cross::SmallVector<std::__1::unique_ptr<spirv_cross::SPIRExtension, spirv_cross::ObjectPool<spirv_cross::SPIRExtension>::MallocDeleter>, 8ul>::emplace_back<spirv_cross::SPIRExtension*&>(spirv_cross::SPIRExtension*&)
Line
Count
Source
330
284
  {
331
284
    reserve(this->buffer_size + 1);
332
284
    new (&this->ptr[this->buffer_size]) T(std::forward<Ts>(ts)...);
333
284
    this->buffer_size++;
334
284
  }
Unexecuted instantiation: void spirv_cross::SmallVector<std::__1::unique_ptr<spirv_cross::SPIRExpression, spirv_cross::ObjectPool<spirv_cross::SPIRExpression>::MallocDeleter>, 8ul>::emplace_back<spirv_cross::SPIRExpression*&>(spirv_cross::SPIRExpression*&)
void spirv_cross::SmallVector<std::__1::unique_ptr<spirv_cross::SPIRFunctionPrototype, spirv_cross::ObjectPool<spirv_cross::SPIRFunctionPrototype>::MallocDeleter>, 8ul>::emplace_back<spirv_cross::SPIRFunctionPrototype*&>(spirv_cross::SPIRFunctionPrototype*&)
Line
Count
Source
330
268
  {
331
268
    reserve(this->buffer_size + 1);
332
268
    new (&this->ptr[this->buffer_size]) T(std::forward<Ts>(ts)...);
333
268
    this->buffer_size++;
334
268
  }
void spirv_cross::SmallVector<std::__1::unique_ptr<spirv_cross::SPIRBlock, spirv_cross::ObjectPool<spirv_cross::SPIRBlock>::MallocDeleter>, 8ul>::emplace_back<spirv_cross::SPIRBlock*&>(spirv_cross::SPIRBlock*&)
Line
Count
Source
330
350
  {
331
350
    reserve(this->buffer_size + 1);
332
350
    new (&this->ptr[this->buffer_size]) T(std::forward<Ts>(ts)...);
333
350
    this->buffer_size++;
334
350
  }
void spirv_cross::SmallVector<std::__1::unique_ptr<spirv_cross::SPIRFunction, spirv_cross::ObjectPool<spirv_cross::SPIRFunction>::MallocDeleter>, 8ul>::emplace_back<spirv_cross::SPIRFunction*&>(spirv_cross::SPIRFunction*&)
Line
Count
Source
330
227
  {
331
227
    reserve(this->buffer_size + 1);
332
227
    new (&this->ptr[this->buffer_size]) T(std::forward<Ts>(ts)...);
333
227
    this->buffer_size++;
334
227
  }
Unexecuted instantiation: void spirv_cross::SmallVector<std::__1::unique_ptr<spirv_cross::SPIRAccessChain, spirv_cross::ObjectPool<spirv_cross::SPIRAccessChain>::MallocDeleter>, 8ul>::emplace_back<spirv_cross::SPIRAccessChain*&>(spirv_cross::SPIRAccessChain*&)
void spirv_cross::SmallVector<std::__1::unique_ptr<spirv_cross::SPIRVariable, spirv_cross::ObjectPool<spirv_cross::SPIRVariable>::MallocDeleter>, 8ul>::emplace_back<spirv_cross::SPIRVariable*&>(spirv_cross::SPIRVariable*&)
Line
Count
Source
330
333
  {
331
333
    reserve(this->buffer_size + 1);
332
333
    new (&this->ptr[this->buffer_size]) T(std::forward<Ts>(ts)...);
333
333
    this->buffer_size++;
334
333
  }
void spirv_cross::SmallVector<std::__1::unique_ptr<spirv_cross::SPIRConstant, spirv_cross::ObjectPool<spirv_cross::SPIRConstant>::MallocDeleter>, 8ul>::emplace_back<spirv_cross::SPIRConstant*&>(spirv_cross::SPIRConstant*&)
Line
Count
Source
330
466
  {
331
466
    reserve(this->buffer_size + 1);
332
466
    new (&this->ptr[this->buffer_size]) T(std::forward<Ts>(ts)...);
333
466
    this->buffer_size++;
334
466
  }
void spirv_cross::SmallVector<spirv_cross::Variant, 8ul>::emplace_back<spirv_cross::ObjectPoolGroup*>(spirv_cross::ObjectPoolGroup*&&)
Line
Count
Source
330
37.8M
  {
331
37.8M
    reserve(this->buffer_size + 1);
332
37.8M
    new (&this->ptr[this->buffer_size]) T(std::forward<Ts>(ts)...);
333
37.8M
    this->buffer_size++;
334
37.8M
  }
335
336
  void reserve(size_t count) SPIRV_CROSS_NOEXCEPT
337
39.1M
  {
338
39.1M
    if ((count > (std::numeric_limits<size_t>::max)() / sizeof(T)) ||
339
39.1M
        (count > (std::numeric_limits<size_t>::max)() / 2))
340
0
    {
341
      // Only way this should ever happen is with garbage input, terminate.
342
0
      std::terminate();
343
0
    }
344
345
39.1M
    if (count > buffer_capacity)
346
18.0k
    {
347
18.0k
      size_t target_capacity = buffer_capacity;
348
18.0k
      if (target_capacity == 0)
349
2.36k
        target_capacity = 1;
350
351
      // Weird parens works around macro issues on Windows if NOMINMAX is not used.
352
18.0k
      target_capacity = (std::max)(target_capacity, N);
353
354
      // Need to ensure there is a POT value of target capacity which is larger than count,
355
      // otherwise this will overflow.
356
51.7k
      while (target_capacity < count)
357
33.6k
        target_capacity <<= 1u;
358
359
18.0k
      T *new_buffer =
360
18.0k
          target_capacity > N ? static_cast<T *>(malloc(target_capacity * sizeof(T))) : stack_storage.data();
361
362
      // If we actually fail this malloc, we are hosed anyways, there is no reason to attempt recovery.
363
18.0k
      if (!new_buffer)
364
0
        std::terminate();
365
366
      // In case for some reason two allocations both come from same stack.
367
18.0k
      if (new_buffer != this->ptr)
368
18.0k
      {
369
        // We don't deal with types which can throw in move constructor.
370
1.62M
        for (size_t i = 0; i < this->buffer_size; i++)
371
1.61M
        {
372
1.61M
          new (&new_buffer[i]) T(std::move(this->ptr[i]));
373
1.61M
          this->ptr[i].~T();
374
1.61M
        }
375
18.0k
      }
376
377
18.0k
      if (this->ptr != stack_storage.data())
378
5.87k
        free(this->ptr);
379
18.0k
      this->ptr = new_buffer;
380
18.0k
      buffer_capacity = target_capacity;
381
18.0k
    }
382
39.1M
  }
Unexecuted instantiation: spirv_cross::SmallVector<spirv_cross::StringStream<4096ul, 4096ul>::Buffer, 8ul>::reserve(unsigned long)
spirv_cross::SmallVector<spirv_cross::SPIRUndef*, 0ul>::reserve(unsigned long)
Line
Count
Source
337
3.01k
  {
338
3.01k
    if ((count > (std::numeric_limits<size_t>::max)() / sizeof(T)) ||
339
3.01k
        (count > (std::numeric_limits<size_t>::max)() / 2))
340
0
    {
341
      // Only way this should ever happen is with garbage input, terminate.
342
0
      std::terminate();
343
0
    }
344
345
3.01k
    if (count > buffer_capacity)
346
71
    {
347
71
      size_t target_capacity = buffer_capacity;
348
71
      if (target_capacity == 0)
349
71
        target_capacity = 1;
350
351
      // Weird parens works around macro issues on Windows if NOMINMAX is not used.
352
71
      target_capacity = (std::max)(target_capacity, N);
353
354
      // Need to ensure there is a POT value of target capacity which is larger than count,
355
      // otherwise this will overflow.
356
355
      while (target_capacity < count)
357
284
        target_capacity <<= 1u;
358
359
71
      T *new_buffer =
360
71
          target_capacity > N ? static_cast<T *>(malloc(target_capacity * sizeof(T))) : stack_storage.data();
361
362
      // If we actually fail this malloc, we are hosed anyways, there is no reason to attempt recovery.
363
71
      if (!new_buffer)
364
0
        std::terminate();
365
366
      // In case for some reason two allocations both come from same stack.
367
71
      if (new_buffer != this->ptr)
368
71
      {
369
        // We don't deal with types which can throw in move constructor.
370
71
        for (size_t i = 0; i < this->buffer_size; i++)
371
0
        {
372
0
          new (&new_buffer[i]) T(std::move(this->ptr[i]));
373
0
          this->ptr[i].~T();
374
0
        }
375
71
      }
376
377
71
      if (this->ptr != stack_storage.data())
378
0
        free(this->ptr);
379
71
      this->ptr = new_buffer;
380
71
      buffer_capacity = target_capacity;
381
71
    }
382
3.01k
  }
spirv_cross::SmallVector<std::__1::unique_ptr<spirv_cross::SPIRUndef, spirv_cross::ObjectPool<spirv_cross::SPIRUndef>::MallocDeleter>, 8ul>::reserve(unsigned long)
Line
Count
Source
337
71
  {
338
71
    if ((count > (std::numeric_limits<size_t>::max)() / sizeof(T)) ||
339
71
        (count > (std::numeric_limits<size_t>::max)() / 2))
340
0
    {
341
      // Only way this should ever happen is with garbage input, terminate.
342
0
      std::terminate();
343
0
    }
344
345
71
    if (count > buffer_capacity)
346
0
    {
347
0
      size_t target_capacity = buffer_capacity;
348
0
      if (target_capacity == 0)
349
0
        target_capacity = 1;
350
351
      // Weird parens works around macro issues on Windows if NOMINMAX is not used.
352
0
      target_capacity = (std::max)(target_capacity, N);
353
354
      // Need to ensure there is a POT value of target capacity which is larger than count,
355
      // otherwise this will overflow.
356
0
      while (target_capacity < count)
357
0
        target_capacity <<= 1u;
358
359
0
      T *new_buffer =
360
0
          target_capacity > N ? static_cast<T *>(malloc(target_capacity * sizeof(T))) : stack_storage.data();
361
362
      // If we actually fail this malloc, we are hosed anyways, there is no reason to attempt recovery.
363
0
      if (!new_buffer)
364
0
        std::terminate();
365
366
      // In case for some reason two allocations both come from same stack.
367
0
      if (new_buffer != this->ptr)
368
0
      {
369
        // We don't deal with types which can throw in move constructor.
370
0
        for (size_t i = 0; i < this->buffer_size; i++)
371
0
        {
372
0
          new (&new_buffer[i]) T(std::move(this->ptr[i]));
373
0
          this->ptr[i].~T();
374
0
        }
375
0
      }
376
377
0
      if (this->ptr != stack_storage.data())
378
0
        free(this->ptr);
379
0
      this->ptr = new_buffer;
380
0
      buffer_capacity = target_capacity;
381
0
    }
382
71
  }
spirv_cross::SmallVector<spirv_cross::SPIRString*, 0ul>::reserve(unsigned long)
Line
Count
Source
337
954
  {
338
954
    if ((count > (std::numeric_limits<size_t>::max)() / sizeof(T)) ||
339
954
        (count > (std::numeric_limits<size_t>::max)() / 2))
340
0
    {
341
      // Only way this should ever happen is with garbage input, terminate.
342
0
      std::terminate();
343
0
    }
344
345
954
    if (count > buffer_capacity)
346
4
    {
347
4
      size_t target_capacity = buffer_capacity;
348
4
      if (target_capacity == 0)
349
4
        target_capacity = 1;
350
351
      // Weird parens works around macro issues on Windows if NOMINMAX is not used.
352
4
      target_capacity = (std::max)(target_capacity, N);
353
354
      // Need to ensure there is a POT value of target capacity which is larger than count,
355
      // otherwise this will overflow.
356
20
      while (target_capacity < count)
357
16
        target_capacity <<= 1u;
358
359
4
      T *new_buffer =
360
4
          target_capacity > N ? static_cast<T *>(malloc(target_capacity * sizeof(T))) : stack_storage.data();
361
362
      // If we actually fail this malloc, we are hosed anyways, there is no reason to attempt recovery.
363
4
      if (!new_buffer)
364
0
        std::terminate();
365
366
      // In case for some reason two allocations both come from same stack.
367
4
      if (new_buffer != this->ptr)
368
4
      {
369
        // We don't deal with types which can throw in move constructor.
370
4
        for (size_t i = 0; i < this->buffer_size; i++)
371
0
        {
372
0
          new (&new_buffer[i]) T(std::move(this->ptr[i]));
373
0
          this->ptr[i].~T();
374
0
        }
375
4
      }
376
377
4
      if (this->ptr != stack_storage.data())
378
0
        free(this->ptr);
379
4
      this->ptr = new_buffer;
380
4
      buffer_capacity = target_capacity;
381
4
    }
382
954
  }
spirv_cross::SmallVector<std::__1::unique_ptr<spirv_cross::SPIRString, spirv_cross::ObjectPool<spirv_cross::SPIRString>::MallocDeleter>, 8ul>::reserve(unsigned long)
Line
Count
Source
337
4
  {
338
4
    if ((count > (std::numeric_limits<size_t>::max)() / sizeof(T)) ||
339
4
        (count > (std::numeric_limits<size_t>::max)() / 2))
340
0
    {
341
      // Only way this should ever happen is with garbage input, terminate.
342
0
      std::terminate();
343
0
    }
344
345
4
    if (count > buffer_capacity)
346
0
    {
347
0
      size_t target_capacity = buffer_capacity;
348
0
      if (target_capacity == 0)
349
0
        target_capacity = 1;
350
351
      // Weird parens works around macro issues on Windows if NOMINMAX is not used.
352
0
      target_capacity = (std::max)(target_capacity, N);
353
354
      // Need to ensure there is a POT value of target capacity which is larger than count,
355
      // otherwise this will overflow.
356
0
      while (target_capacity < count)
357
0
        target_capacity <<= 1u;
358
359
0
      T *new_buffer =
360
0
          target_capacity > N ? static_cast<T *>(malloc(target_capacity * sizeof(T))) : stack_storage.data();
361
362
      // If we actually fail this malloc, we are hosed anyways, there is no reason to attempt recovery.
363
0
      if (!new_buffer)
364
0
        std::terminate();
365
366
      // In case for some reason two allocations both come from same stack.
367
0
      if (new_buffer != this->ptr)
368
0
      {
369
        // We don't deal with types which can throw in move constructor.
370
0
        for (size_t i = 0; i < this->buffer_size; i++)
371
0
        {
372
0
          new (&new_buffer[i]) T(std::move(this->ptr[i]));
373
0
          this->ptr[i].~T();
374
0
        }
375
0
      }
376
377
0
      if (this->ptr != stack_storage.data())
378
0
        free(this->ptr);
379
0
      this->ptr = new_buffer;
380
0
      buffer_capacity = target_capacity;
381
0
    }
382
4
  }
Unexecuted instantiation: spirv_cross::SmallVector<spirv_cross::SPIRCombinedImageSampler*, 0ul>::reserve(unsigned long)
Unexecuted instantiation: spirv_cross::SmallVector<std::__1::unique_ptr<spirv_cross::SPIRCombinedImageSampler, spirv_cross::ObjectPool<spirv_cross::SPIRCombinedImageSampler>::MallocDeleter>, 8ul>::reserve(unsigned long)
spirv_cross::SmallVector<unsigned int, 8ul>::reserve(unsigned long)
Line
Count
Source
337
118k
  {
338
118k
    if ((count > (std::numeric_limits<size_t>::max)() / sizeof(T)) ||
339
118k
        (count > (std::numeric_limits<size_t>::max)() / 2))
340
0
    {
341
      // Only way this should ever happen is with garbage input, terminate.
342
0
      std::terminate();
343
0
    }
344
345
118k
    if (count > buffer_capacity)
346
5.41k
    {
347
5.41k
      size_t target_capacity = buffer_capacity;
348
5.41k
      if (target_capacity == 0)
349
0
        target_capacity = 1;
350
351
      // Weird parens works around macro issues on Windows if NOMINMAX is not used.
352
5.41k
      target_capacity = (std::max)(target_capacity, N);
353
354
      // Need to ensure there is a POT value of target capacity which is larger than count,
355
      // otherwise this will overflow.
356
11.8k
      while (target_capacity < count)
357
6.47k
        target_capacity <<= 1u;
358
359
5.41k
      T *new_buffer =
360
5.41k
          target_capacity > N ? static_cast<T *>(malloc(target_capacity * sizeof(T))) : stack_storage.data();
361
362
      // If we actually fail this malloc, we are hosed anyways, there is no reason to attempt recovery.
363
5.41k
      if (!new_buffer)
364
0
        std::terminate();
365
366
      // In case for some reason two allocations both come from same stack.
367
5.41k
      if (new_buffer != this->ptr)
368
5.41k
      {
369
        // We don't deal with types which can throw in move constructor.
370
41.0k
        for (size_t i = 0; i < this->buffer_size; i++)
371
35.6k
        {
372
35.6k
          new (&new_buffer[i]) T(std::move(this->ptr[i]));
373
35.6k
          this->ptr[i].~T();
374
35.6k
        }
375
5.41k
      }
376
377
5.41k
      if (this->ptr != stack_storage.data())
378
18
        free(this->ptr);
379
5.41k
      this->ptr = new_buffer;
380
5.41k
      buffer_capacity = target_capacity;
381
5.41k
    }
382
118k
  }
spirv_cross::SmallVector<spirv_cross::SPIRConstantOp*, 0ul>::reserve(unsigned long)
Line
Count
Source
337
1.01k
  {
338
1.01k
    if ((count > (std::numeric_limits<size_t>::max)() / sizeof(T)) ||
339
1.01k
        (count > (std::numeric_limits<size_t>::max)() / 2))
340
0
    {
341
      // Only way this should ever happen is with garbage input, terminate.
342
0
      std::terminate();
343
0
    }
344
345
1.01k
    if (count > buffer_capacity)
346
13
    {
347
13
      size_t target_capacity = buffer_capacity;
348
13
      if (target_capacity == 0)
349
13
        target_capacity = 1;
350
351
      // Weird parens works around macro issues on Windows if NOMINMAX is not used.
352
13
      target_capacity = (std::max)(target_capacity, N);
353
354
      // Need to ensure there is a POT value of target capacity which is larger than count,
355
      // otherwise this will overflow.
356
65
      while (target_capacity < count)
357
52
        target_capacity <<= 1u;
358
359
13
      T *new_buffer =
360
13
          target_capacity > N ? static_cast<T *>(malloc(target_capacity * sizeof(T))) : stack_storage.data();
361
362
      // If we actually fail this malloc, we are hosed anyways, there is no reason to attempt recovery.
363
13
      if (!new_buffer)
364
0
        std::terminate();
365
366
      // In case for some reason two allocations both come from same stack.
367
13
      if (new_buffer != this->ptr)
368
13
      {
369
        // We don't deal with types which can throw in move constructor.
370
13
        for (size_t i = 0; i < this->buffer_size; i++)
371
0
        {
372
0
          new (&new_buffer[i]) T(std::move(this->ptr[i]));
373
0
          this->ptr[i].~T();
374
0
        }
375
13
      }
376
377
13
      if (this->ptr != stack_storage.data())
378
0
        free(this->ptr);
379
13
      this->ptr = new_buffer;
380
13
      buffer_capacity = target_capacity;
381
13
    }
382
1.01k
  }
spirv_cross::SmallVector<std::__1::unique_ptr<spirv_cross::SPIRConstantOp, spirv_cross::ObjectPool<spirv_cross::SPIRConstantOp>::MallocDeleter>, 8ul>::reserve(unsigned long)
Line
Count
Source
337
13
  {
338
13
    if ((count > (std::numeric_limits<size_t>::max)() / sizeof(T)) ||
339
13
        (count > (std::numeric_limits<size_t>::max)() / 2))
340
0
    {
341
      // Only way this should ever happen is with garbage input, terminate.
342
0
      std::terminate();
343
0
    }
344
345
13
    if (count > buffer_capacity)
346
0
    {
347
0
      size_t target_capacity = buffer_capacity;
348
0
      if (target_capacity == 0)
349
0
        target_capacity = 1;
350
351
      // Weird parens works around macro issues on Windows if NOMINMAX is not used.
352
0
      target_capacity = (std::max)(target_capacity, N);
353
354
      // Need to ensure there is a POT value of target capacity which is larger than count,
355
      // otherwise this will overflow.
356
0
      while (target_capacity < count)
357
0
        target_capacity <<= 1u;
358
359
0
      T *new_buffer =
360
0
          target_capacity > N ? static_cast<T *>(malloc(target_capacity * sizeof(T))) : stack_storage.data();
361
362
      // If we actually fail this malloc, we are hosed anyways, there is no reason to attempt recovery.
363
0
      if (!new_buffer)
364
0
        std::terminate();
365
366
      // In case for some reason two allocations both come from same stack.
367
0
      if (new_buffer != this->ptr)
368
0
      {
369
        // We don't deal with types which can throw in move constructor.
370
0
        for (size_t i = 0; i < this->buffer_size; i++)
371
0
        {
372
0
          new (&new_buffer[i]) T(std::move(this->ptr[i]));
373
0
          this->ptr[i].~T();
374
0
        }
375
0
      }
376
377
0
      if (this->ptr != stack_storage.data())
378
0
        free(this->ptr);
379
0
      this->ptr = new_buffer;
380
0
      buffer_capacity = target_capacity;
381
0
    }
382
13
  }
spirv_cross::SmallVector<spirv_cross::SPIRType*, 0ul>::reserve(unsigned long)
Line
Count
Source
337
31.1k
  {
338
31.1k
    if ((count > (std::numeric_limits<size_t>::max)() / sizeof(T)) ||
339
31.1k
        (count > (std::numeric_limits<size_t>::max)() / 2))
340
0
    {
341
      // Only way this should ever happen is with garbage input, terminate.
342
0
      std::terminate();
343
0
    }
344
345
31.1k
    if (count > buffer_capacity)
346
530
    {
347
530
      size_t target_capacity = buffer_capacity;
348
530
      if (target_capacity == 0)
349
354
        target_capacity = 1;
350
351
      // Weird parens works around macro issues on Windows if NOMINMAX is not used.
352
530
      target_capacity = (std::max)(target_capacity, N);
353
354
      // Need to ensure there is a POT value of target capacity which is larger than count,
355
      // otherwise this will overflow.
356
2.12k
      while (target_capacity < count)
357
1.59k
        target_capacity <<= 1u;
358
359
530
      T *new_buffer =
360
530
          target_capacity > N ? static_cast<T *>(malloc(target_capacity * sizeof(T))) : stack_storage.data();
361
362
      // If we actually fail this malloc, we are hosed anyways, there is no reason to attempt recovery.
363
530
      if (!new_buffer)
364
0
        std::terminate();
365
366
      // In case for some reason two allocations both come from same stack.
367
530
      if (new_buffer != this->ptr)
368
530
      {
369
        // We don't deal with types which can throw in move constructor.
370
3.34k
        for (size_t i = 0; i < this->buffer_size; i++)
371
2.81k
        {
372
2.81k
          new (&new_buffer[i]) T(std::move(this->ptr[i]));
373
2.81k
          this->ptr[i].~T();
374
2.81k
        }
375
530
      }
376
377
530
      if (this->ptr != stack_storage.data())
378
176
        free(this->ptr);
379
530
      this->ptr = new_buffer;
380
530
      buffer_capacity = target_capacity;
381
530
    }
382
31.1k
  }
spirv_cross::SmallVector<std::__1::unique_ptr<spirv_cross::SPIRType, spirv_cross::ObjectPool<spirv_cross::SPIRType>::MallocDeleter>, 8ul>::reserve(unsigned long)
Line
Count
Source
337
442
  {
338
442
    if ((count > (std::numeric_limits<size_t>::max)() / sizeof(T)) ||
339
442
        (count > (std::numeric_limits<size_t>::max)() / 2))
340
0
    {
341
      // Only way this should ever happen is with garbage input, terminate.
342
0
      std::terminate();
343
0
    }
344
345
442
    if (count > buffer_capacity)
346
0
    {
347
0
      size_t target_capacity = buffer_capacity;
348
0
      if (target_capacity == 0)
349
0
        target_capacity = 1;
350
351
      // Weird parens works around macro issues on Windows if NOMINMAX is not used.
352
0
      target_capacity = (std::max)(target_capacity, N);
353
354
      // Need to ensure there is a POT value of target capacity which is larger than count,
355
      // otherwise this will overflow.
356
0
      while (target_capacity < count)
357
0
        target_capacity <<= 1u;
358
359
0
      T *new_buffer =
360
0
          target_capacity > N ? static_cast<T *>(malloc(target_capacity * sizeof(T))) : stack_storage.data();
361
362
      // If we actually fail this malloc, we are hosed anyways, there is no reason to attempt recovery.
363
0
      if (!new_buffer)
364
0
        std::terminate();
365
366
      // In case for some reason two allocations both come from same stack.
367
0
      if (new_buffer != this->ptr)
368
0
      {
369
        // We don't deal with types which can throw in move constructor.
370
0
        for (size_t i = 0; i < this->buffer_size; i++)
371
0
        {
372
0
          new (&new_buffer[i]) T(std::move(this->ptr[i]));
373
0
          this->ptr[i].~T();
374
0
        }
375
0
      }
376
377
0
      if (this->ptr != stack_storage.data())
378
0
        free(this->ptr);
379
0
      this->ptr = new_buffer;
380
0
      buffer_capacity = target_capacity;
381
0
    }
382
442
  }
spirv_cross::SmallVector<bool, 8ul>::reserve(unsigned long)
Line
Count
Source
337
12.6k
  {
338
12.6k
    if ((count > (std::numeric_limits<size_t>::max)() / sizeof(T)) ||
339
12.6k
        (count > (std::numeric_limits<size_t>::max)() / 2))
340
0
    {
341
      // Only way this should ever happen is with garbage input, terminate.
342
0
      std::terminate();
343
0
    }
344
345
12.6k
    if (count > buffer_capacity)
346
546
    {
347
546
      size_t target_capacity = buffer_capacity;
348
546
      if (target_capacity == 0)
349
0
        target_capacity = 1;
350
351
      // Weird parens works around macro issues on Windows if NOMINMAX is not used.
352
546
      target_capacity = (std::max)(target_capacity, N);
353
354
      // Need to ensure there is a POT value of target capacity which is larger than count,
355
      // otherwise this will overflow.
356
2.15k
      while (target_capacity < count)
357
1.61k
        target_capacity <<= 1u;
358
359
546
      T *new_buffer =
360
546
          target_capacity > N ? static_cast<T *>(malloc(target_capacity * sizeof(T))) : stack_storage.data();
361
362
      // If we actually fail this malloc, we are hosed anyways, there is no reason to attempt recovery.
363
546
      if (!new_buffer)
364
0
        std::terminate();
365
366
      // In case for some reason two allocations both come from same stack.
367
546
      if (new_buffer != this->ptr)
368
546
      {
369
        // We don't deal with types which can throw in move constructor.
370
1.34k
        for (size_t i = 0; i < this->buffer_size; i++)
371
800
        {
372
800
          new (&new_buffer[i]) T(std::move(this->ptr[i]));
373
800
          this->ptr[i].~T();
374
800
        }
375
546
      }
376
377
546
      if (this->ptr != stack_storage.data())
378
18
        free(this->ptr);
379
546
      this->ptr = new_buffer;
380
546
      buffer_capacity = target_capacity;
381
546
    }
382
12.6k
  }
spirv_cross::SmallVector<spirv_cross::TypedID<(spirv_cross::Types)1>, 8ul>::reserve(unsigned long)
Line
Count
Source
337
16.1k
  {
338
16.1k
    if ((count > (std::numeric_limits<size_t>::max)() / sizeof(T)) ||
339
16.1k
        (count > (std::numeric_limits<size_t>::max)() / 2))
340
0
    {
341
      // Only way this should ever happen is with garbage input, terminate.
342
0
      std::terminate();
343
0
    }
344
345
16.1k
    if (count > buffer_capacity)
346
50
    {
347
50
      size_t target_capacity = buffer_capacity;
348
50
      if (target_capacity == 0)
349
0
        target_capacity = 1;
350
351
      // Weird parens works around macro issues on Windows if NOMINMAX is not used.
352
50
      target_capacity = (std::max)(target_capacity, N);
353
354
      // Need to ensure there is a POT value of target capacity which is larger than count,
355
      // otherwise this will overflow.
356
194
      while (target_capacity < count)
357
144
        target_capacity <<= 1u;
358
359
50
      T *new_buffer =
360
50
          target_capacity > N ? static_cast<T *>(malloc(target_capacity * sizeof(T))) : stack_storage.data();
361
362
      // If we actually fail this malloc, we are hosed anyways, there is no reason to attempt recovery.
363
50
      if (!new_buffer)
364
0
        std::terminate();
365
366
      // In case for some reason two allocations both come from same stack.
367
50
      if (new_buffer != this->ptr)
368
50
      {
369
        // We don't deal with types which can throw in move constructor.
370
106
        for (size_t i = 0; i < this->buffer_size; i++)
371
56
        {
372
56
          new (&new_buffer[i]) T(std::move(this->ptr[i]));
373
56
          this->ptr[i].~T();
374
56
        }
375
50
      }
376
377
50
      if (this->ptr != stack_storage.data())
378
2
        free(this->ptr);
379
50
      this->ptr = new_buffer;
380
50
      buffer_capacity = target_capacity;
381
50
    }
382
16.1k
  }
spirv_cross::SmallVector<spirv_cross::SPIRExtension*, 0ul>::reserve(unsigned long)
Line
Count
Source
337
5.33k
  {
338
5.33k
    if ((count > (std::numeric_limits<size_t>::max)() / sizeof(T)) ||
339
5.33k
        (count > (std::numeric_limits<size_t>::max)() / 2))
340
0
    {
341
      // Only way this should ever happen is with garbage input, terminate.
342
0
      std::terminate();
343
0
    }
344
345
5.33k
    if (count > buffer_capacity)
346
284
    {
347
284
      size_t target_capacity = buffer_capacity;
348
284
      if (target_capacity == 0)
349
284
        target_capacity = 1;
350
351
      // Weird parens works around macro issues on Windows if NOMINMAX is not used.
352
284
      target_capacity = (std::max)(target_capacity, N);
353
354
      // Need to ensure there is a POT value of target capacity which is larger than count,
355
      // otherwise this will overflow.
356
1.42k
      while (target_capacity < count)
357
1.13k
        target_capacity <<= 1u;
358
359
284
      T *new_buffer =
360
284
          target_capacity > N ? static_cast<T *>(malloc(target_capacity * sizeof(T))) : stack_storage.data();
361
362
      // If we actually fail this malloc, we are hosed anyways, there is no reason to attempt recovery.
363
284
      if (!new_buffer)
364
0
        std::terminate();
365
366
      // In case for some reason two allocations both come from same stack.
367
284
      if (new_buffer != this->ptr)
368
284
      {
369
        // We don't deal with types which can throw in move constructor.
370
284
        for (size_t i = 0; i < this->buffer_size; i++)
371
0
        {
372
0
          new (&new_buffer[i]) T(std::move(this->ptr[i]));
373
0
          this->ptr[i].~T();
374
0
        }
375
284
      }
376
377
284
      if (this->ptr != stack_storage.data())
378
0
        free(this->ptr);
379
284
      this->ptr = new_buffer;
380
284
      buffer_capacity = target_capacity;
381
284
    }
382
5.33k
  }
spirv_cross::SmallVector<std::__1::unique_ptr<spirv_cross::SPIRExtension, spirv_cross::ObjectPool<spirv_cross::SPIRExtension>::MallocDeleter>, 8ul>::reserve(unsigned long)
Line
Count
Source
337
284
  {
338
284
    if ((count > (std::numeric_limits<size_t>::max)() / sizeof(T)) ||
339
284
        (count > (std::numeric_limits<size_t>::max)() / 2))
340
0
    {
341
      // Only way this should ever happen is with garbage input, terminate.
342
0
      std::terminate();
343
0
    }
344
345
284
    if (count > buffer_capacity)
346
0
    {
347
0
      size_t target_capacity = buffer_capacity;
348
0
      if (target_capacity == 0)
349
0
        target_capacity = 1;
350
351
      // Weird parens works around macro issues on Windows if NOMINMAX is not used.
352
0
      target_capacity = (std::max)(target_capacity, N);
353
354
      // Need to ensure there is a POT value of target capacity which is larger than count,
355
      // otherwise this will overflow.
356
0
      while (target_capacity < count)
357
0
        target_capacity <<= 1u;
358
359
0
      T *new_buffer =
360
0
          target_capacity > N ? static_cast<T *>(malloc(target_capacity * sizeof(T))) : stack_storage.data();
361
362
      // If we actually fail this malloc, we are hosed anyways, there is no reason to attempt recovery.
363
0
      if (!new_buffer)
364
0
        std::terminate();
365
366
      // In case for some reason two allocations both come from same stack.
367
0
      if (new_buffer != this->ptr)
368
0
      {
369
        // We don't deal with types which can throw in move constructor.
370
0
        for (size_t i = 0; i < this->buffer_size; i++)
371
0
        {
372
0
          new (&new_buffer[i]) T(std::move(this->ptr[i]));
373
0
          this->ptr[i].~T();
374
0
        }
375
0
      }
376
377
0
      if (this->ptr != stack_storage.data())
378
0
        free(this->ptr);
379
0
      this->ptr = new_buffer;
380
0
      buffer_capacity = target_capacity;
381
0
    }
382
284
  }
Unexecuted instantiation: spirv_cross::SmallVector<spirv_cross::SPIRExpression*, 0ul>::reserve(unsigned long)
Unexecuted instantiation: spirv_cross::SmallVector<std::__1::unique_ptr<spirv_cross::SPIRExpression, spirv_cross::ObjectPool<spirv_cross::SPIRExpression>::MallocDeleter>, 8ul>::reserve(unsigned long)
spirv_cross::SmallVector<spirv_cross::TypedID<(spirv_cross::Types)0>, 8ul>::reserve(unsigned long)
Line
Count
Source
337
46.9k
  {
338
46.9k
    if ((count > (std::numeric_limits<size_t>::max)() / sizeof(T)) ||
339
46.9k
        (count > (std::numeric_limits<size_t>::max)() / 2))
340
0
    {
341
      // Only way this should ever happen is with garbage input, terminate.
342
0
      std::terminate();
343
0
    }
344
345
46.9k
    if (count > buffer_capacity)
346
2.30k
    {
347
2.30k
      size_t target_capacity = buffer_capacity;
348
2.30k
      if (target_capacity == 0)
349
0
        target_capacity = 1;
350
351
      // Weird parens works around macro issues on Windows if NOMINMAX is not used.
352
2.30k
      target_capacity = (std::max)(target_capacity, N);
353
354
      // Need to ensure there is a POT value of target capacity which is larger than count,
355
      // otherwise this will overflow.
356
4.60k
      while (target_capacity < count)
357
2.30k
        target_capacity <<= 1u;
358
359
2.30k
      T *new_buffer =
360
2.30k
          target_capacity > N ? static_cast<T *>(malloc(target_capacity * sizeof(T))) : stack_storage.data();
361
362
      // If we actually fail this malloc, we are hosed anyways, there is no reason to attempt recovery.
363
2.30k
      if (!new_buffer)
364
0
        std::terminate();
365
366
      // In case for some reason two allocations both come from same stack.
367
2.30k
      if (new_buffer != this->ptr)
368
2.30k
      {
369
        // We don't deal with types which can throw in move constructor.
370
56.8k
        for (size_t i = 0; i < this->buffer_size; i++)
371
54.5k
        {
372
54.5k
          new (&new_buffer[i]) T(std::move(this->ptr[i]));
373
54.5k
          this->ptr[i].~T();
374
54.5k
        }
375
2.30k
      }
376
377
2.30k
      if (this->ptr != stack_storage.data())
378
1.28k
        free(this->ptr);
379
2.30k
      this->ptr = new_buffer;
380
2.30k
      buffer_capacity = target_capacity;
381
2.30k
    }
382
46.9k
  }
spirv_cross::SmallVector<spirv_cross::SPIRFunctionPrototype*, 0ul>::reserve(unsigned long)
Line
Count
Source
337
10.3k
  {
338
10.3k
    if ((count > (std::numeric_limits<size_t>::max)() / sizeof(T)) ||
339
10.3k
        (count > (std::numeric_limits<size_t>::max)() / 2))
340
0
    {
341
      // Only way this should ever happen is with garbage input, terminate.
342
0
      std::terminate();
343
0
    }
344
345
10.3k
    if (count > buffer_capacity)
346
268
    {
347
268
      size_t target_capacity = buffer_capacity;
348
268
      if (target_capacity == 0)
349
268
        target_capacity = 1;
350
351
      // Weird parens works around macro issues on Windows if NOMINMAX is not used.
352
268
      target_capacity = (std::max)(target_capacity, N);
353
354
      // Need to ensure there is a POT value of target capacity which is larger than count,
355
      // otherwise this will overflow.
356
1.34k
      while (target_capacity < count)
357
1.07k
        target_capacity <<= 1u;
358
359
268
      T *new_buffer =
360
268
          target_capacity > N ? static_cast<T *>(malloc(target_capacity * sizeof(T))) : stack_storage.data();
361
362
      // If we actually fail this malloc, we are hosed anyways, there is no reason to attempt recovery.
363
268
      if (!new_buffer)
364
0
        std::terminate();
365
366
      // In case for some reason two allocations both come from same stack.
367
268
      if (new_buffer != this->ptr)
368
268
      {
369
        // We don't deal with types which can throw in move constructor.
370
268
        for (size_t i = 0; i < this->buffer_size; i++)
371
0
        {
372
0
          new (&new_buffer[i]) T(std::move(this->ptr[i]));
373
0
          this->ptr[i].~T();
374
0
        }
375
268
      }
376
377
268
      if (this->ptr != stack_storage.data())
378
0
        free(this->ptr);
379
268
      this->ptr = new_buffer;
380
268
      buffer_capacity = target_capacity;
381
268
    }
382
10.3k
  }
spirv_cross::SmallVector<std::__1::unique_ptr<spirv_cross::SPIRFunctionPrototype, spirv_cross::ObjectPool<spirv_cross::SPIRFunctionPrototype>::MallocDeleter>, 8ul>::reserve(unsigned long)
Line
Count
Source
337
268
  {
338
268
    if ((count > (std::numeric_limits<size_t>::max)() / sizeof(T)) ||
339
268
        (count > (std::numeric_limits<size_t>::max)() / 2))
340
0
    {
341
      // Only way this should ever happen is with garbage input, terminate.
342
0
      std::terminate();
343
0
    }
344
345
268
    if (count > buffer_capacity)
346
0
    {
347
0
      size_t target_capacity = buffer_capacity;
348
0
      if (target_capacity == 0)
349
0
        target_capacity = 1;
350
351
      // Weird parens works around macro issues on Windows if NOMINMAX is not used.
352
0
      target_capacity = (std::max)(target_capacity, N);
353
354
      // Need to ensure there is a POT value of target capacity which is larger than count,
355
      // otherwise this will overflow.
356
0
      while (target_capacity < count)
357
0
        target_capacity <<= 1u;
358
359
0
      T *new_buffer =
360
0
          target_capacity > N ? static_cast<T *>(malloc(target_capacity * sizeof(T))) : stack_storage.data();
361
362
      // If we actually fail this malloc, we are hosed anyways, there is no reason to attempt recovery.
363
0
      if (!new_buffer)
364
0
        std::terminate();
365
366
      // In case for some reason two allocations both come from same stack.
367
0
      if (new_buffer != this->ptr)
368
0
      {
369
        // We don't deal with types which can throw in move constructor.
370
0
        for (size_t i = 0; i < this->buffer_size; i++)
371
0
        {
372
0
          new (&new_buffer[i]) T(std::move(this->ptr[i]));
373
0
          this->ptr[i].~T();
374
0
        }
375
0
      }
376
377
0
      if (this->ptr != stack_storage.data())
378
0
        free(this->ptr);
379
0
      this->ptr = new_buffer;
380
0
      buffer_capacity = target_capacity;
381
0
    }
382
268
  }
spirv_cross::SmallVector<spirv_cross::SPIRBlock*, 0ul>::reserve(unsigned long)
Line
Count
Source
337
20.7k
  {
338
20.7k
    if ((count > (std::numeric_limits<size_t>::max)() / sizeof(T)) ||
339
20.7k
        (count > (std::numeric_limits<size_t>::max)() / 2))
340
0
    {
341
      // Only way this should ever happen is with garbage input, terminate.
342
0
      std::terminate();
343
0
    }
344
345
20.7k
    if (count > buffer_capacity)
346
423
    {
347
423
      size_t target_capacity = buffer_capacity;
348
423
      if (target_capacity == 0)
349
227
        target_capacity = 1;
350
351
      // Weird parens works around macro issues on Windows if NOMINMAX is not used.
352
423
      target_capacity = (std::max)(target_capacity, N);
353
354
      // Need to ensure there is a POT value of target capacity which is larger than count,
355
      // otherwise this will overflow.
356
1.52k
      while (target_capacity < count)
357
1.10k
        target_capacity <<= 1u;
358
359
423
      T *new_buffer =
360
423
          target_capacity > N ? static_cast<T *>(malloc(target_capacity * sizeof(T))) : stack_storage.data();
361
362
      // If we actually fail this malloc, we are hosed anyways, there is no reason to attempt recovery.
363
423
      if (!new_buffer)
364
0
        std::terminate();
365
366
      // In case for some reason two allocations both come from same stack.
367
423
      if (new_buffer != this->ptr)
368
423
      {
369
        // We don't deal with types which can throw in move constructor.
370
5.06k
        for (size_t i = 0; i < this->buffer_size; i++)
371
4.64k
        {
372
4.64k
          new (&new_buffer[i]) T(std::move(this->ptr[i]));
373
4.64k
          this->ptr[i].~T();
374
4.64k
        }
375
423
      }
376
377
423
      if (this->ptr != stack_storage.data())
378
196
        free(this->ptr);
379
423
      this->ptr = new_buffer;
380
423
      buffer_capacity = target_capacity;
381
423
    }
382
20.7k
  }
spirv_cross::SmallVector<std::__1::unique_ptr<spirv_cross::SPIRBlock, spirv_cross::ObjectPool<spirv_cross::SPIRBlock>::MallocDeleter>, 8ul>::reserve(unsigned long)
Line
Count
Source
337
350
  {
338
350
    if ((count > (std::numeric_limits<size_t>::max)() / sizeof(T)) ||
339
350
        (count > (std::numeric_limits<size_t>::max)() / 2))
340
0
    {
341
      // Only way this should ever happen is with garbage input, terminate.
342
0
      std::terminate();
343
0
    }
344
345
350
    if (count > buffer_capacity)
346
0
    {
347
0
      size_t target_capacity = buffer_capacity;
348
0
      if (target_capacity == 0)
349
0
        target_capacity = 1;
350
351
      // Weird parens works around macro issues on Windows if NOMINMAX is not used.
352
0
      target_capacity = (std::max)(target_capacity, N);
353
354
      // Need to ensure there is a POT value of target capacity which is larger than count,
355
      // otherwise this will overflow.
356
0
      while (target_capacity < count)
357
0
        target_capacity <<= 1u;
358
359
0
      T *new_buffer =
360
0
          target_capacity > N ? static_cast<T *>(malloc(target_capacity * sizeof(T))) : stack_storage.data();
361
362
      // If we actually fail this malloc, we are hosed anyways, there is no reason to attempt recovery.
363
0
      if (!new_buffer)
364
0
        std::terminate();
365
366
      // In case for some reason two allocations both come from same stack.
367
0
      if (new_buffer != this->ptr)
368
0
      {
369
        // We don't deal with types which can throw in move constructor.
370
0
        for (size_t i = 0; i < this->buffer_size; i++)
371
0
        {
372
0
          new (&new_buffer[i]) T(std::move(this->ptr[i]));
373
0
          this->ptr[i].~T();
374
0
        }
375
0
      }
376
377
0
      if (this->ptr != stack_storage.data())
378
0
        free(this->ptr);
379
0
      this->ptr = new_buffer;
380
0
      buffer_capacity = target_capacity;
381
0
    }
382
350
  }
spirv_cross::SmallVector<spirv_cross::Instruction, 8ul>::reserve(unsigned long)
Line
Count
Source
337
621k
  {
338
621k
    if ((count > (std::numeric_limits<size_t>::max)() / sizeof(T)) ||
339
621k
        (count > (std::numeric_limits<size_t>::max)() / 2))
340
0
    {
341
      // Only way this should ever happen is with garbage input, terminate.
342
0
      std::terminate();
343
0
    }
344
345
621k
    if (count > buffer_capacity)
346
3.87k
    {
347
3.87k
      size_t target_capacity = buffer_capacity;
348
3.87k
      if (target_capacity == 0)
349
0
        target_capacity = 1;
350
351
      // Weird parens works around macro issues on Windows if NOMINMAX is not used.
352
3.87k
      target_capacity = (std::max)(target_capacity, N);
353
354
      // Need to ensure there is a POT value of target capacity which is larger than count,
355
      // otherwise this will overflow.
356
7.74k
      while (target_capacity < count)
357
3.87k
        target_capacity <<= 1u;
358
359
3.87k
      T *new_buffer =
360
3.87k
          target_capacity > N ? static_cast<T *>(malloc(target_capacity * sizeof(T))) : stack_storage.data();
361
362
      // If we actually fail this malloc, we are hosed anyways, there is no reason to attempt recovery.
363
3.87k
      if (!new_buffer)
364
0
        std::terminate();
365
366
      // In case for some reason two allocations both come from same stack.
367
3.87k
      if (new_buffer != this->ptr)
368
3.87k
      {
369
        // We don't deal with types which can throw in move constructor.
370
803k
        for (size_t i = 0; i < this->buffer_size; i++)
371
799k
        {
372
799k
          new (&new_buffer[i]) T(std::move(this->ptr[i]));
373
799k
          this->ptr[i].~T();
374
799k
        }
375
3.87k
      }
376
377
3.87k
      if (this->ptr != stack_storage.data())
378
2.71k
        free(this->ptr);
379
3.87k
      this->ptr = new_buffer;
380
3.87k
      buffer_capacity = target_capacity;
381
3.87k
    }
382
621k
  }
spirv_cross::SmallVector<spirv_cross::SPIRBlock::Phi, 8ul>::reserve(unsigned long)
Line
Count
Source
337
6.29k
  {
338
6.29k
    if ((count > (std::numeric_limits<size_t>::max)() / sizeof(T)) ||
339
6.29k
        (count > (std::numeric_limits<size_t>::max)() / 2))
340
0
    {
341
      // Only way this should ever happen is with garbage input, terminate.
342
0
      std::terminate();
343
0
    }
344
345
6.29k
    if (count > buffer_capacity)
346
102
    {
347
102
      size_t target_capacity = buffer_capacity;
348
102
      if (target_capacity == 0)
349
0
        target_capacity = 1;
350
351
      // Weird parens works around macro issues on Windows if NOMINMAX is not used.
352
102
      target_capacity = (std::max)(target_capacity, N);
353
354
      // Need to ensure there is a POT value of target capacity which is larger than count,
355
      // otherwise this will overflow.
356
204
      while (target_capacity < count)
357
102
        target_capacity <<= 1u;
358
359
102
      T *new_buffer =
360
102
          target_capacity > N ? static_cast<T *>(malloc(target_capacity * sizeof(T))) : stack_storage.data();
361
362
      // If we actually fail this malloc, we are hosed anyways, there is no reason to attempt recovery.
363
102
      if (!new_buffer)
364
0
        std::terminate();
365
366
      // In case for some reason two allocations both come from same stack.
367
102
      if (new_buffer != this->ptr)
368
102
      {
369
        // We don't deal with types which can throw in move constructor.
370
1.42k
        for (size_t i = 0; i < this->buffer_size; i++)
371
1.32k
        {
372
1.32k
          new (&new_buffer[i]) T(std::move(this->ptr[i]));
373
1.32k
          this->ptr[i].~T();
374
1.32k
        }
375
102
      }
376
377
102
      if (this->ptr != stack_storage.data())
378
47
        free(this->ptr);
379
102
      this->ptr = new_buffer;
380
102
      buffer_capacity = target_capacity;
381
102
    }
382
6.29k
  }
Unexecuted instantiation: spirv_cross::SmallVector<std::__1::pair<spirv_cross::TypedID<(spirv_cross::Types)1>, spirv_cross::TypedID<(spirv_cross::Types)0> >, 8ul>::reserve(unsigned long)
spirv_cross::SmallVector<spirv_cross::SPIRBlock::Case, 8ul>::reserve(unsigned long)
Line
Count
Source
337
1.20k
  {
338
1.20k
    if ((count > (std::numeric_limits<size_t>::max)() / sizeof(T)) ||
339
1.20k
        (count > (std::numeric_limits<size_t>::max)() / 2))
340
0
    {
341
      // Only way this should ever happen is with garbage input, terminate.
342
0
      std::terminate();
343
0
    }
344
345
1.20k
    if (count > buffer_capacity)
346
87
    {
347
87
      size_t target_capacity = buffer_capacity;
348
87
      if (target_capacity == 0)
349
0
        target_capacity = 1;
350
351
      // Weird parens works around macro issues on Windows if NOMINMAX is not used.
352
87
      target_capacity = (std::max)(target_capacity, N);
353
354
      // Need to ensure there is a POT value of target capacity which is larger than count,
355
      // otherwise this will overflow.
356
174
      while (target_capacity < count)
357
87
        target_capacity <<= 1u;
358
359
87
      T *new_buffer =
360
87
          target_capacity > N ? static_cast<T *>(malloc(target_capacity * sizeof(T))) : stack_storage.data();
361
362
      // If we actually fail this malloc, we are hosed anyways, there is no reason to attempt recovery.
363
87
      if (!new_buffer)
364
0
        std::terminate();
365
366
      // In case for some reason two allocations both come from same stack.
367
87
      if (new_buffer != this->ptr)
368
87
      {
369
        // We don't deal with types which can throw in move constructor.
370
871
        for (size_t i = 0; i < this->buffer_size; i++)
371
784
        {
372
784
          new (&new_buffer[i]) T(std::move(this->ptr[i]));
373
784
          this->ptr[i].~T();
374
784
        }
375
87
      }
376
377
87
      if (this->ptr != stack_storage.data())
378
3
        free(this->ptr);
379
87
      this->ptr = new_buffer;
380
87
      buffer_capacity = target_capacity;
381
87
    }
382
1.20k
  }
spirv_cross::SmallVector<spirv_cross::TypedID<(spirv_cross::Types)2>, 8ul>::reserve(unsigned long)
Line
Count
Source
337
19.6k
  {
338
19.6k
    if ((count > (std::numeric_limits<size_t>::max)() / sizeof(T)) ||
339
19.6k
        (count > (std::numeric_limits<size_t>::max)() / 2))
340
0
    {
341
      // Only way this should ever happen is with garbage input, terminate.
342
0
      std::terminate();
343
0
    }
344
345
19.6k
    if (count > buffer_capacity)
346
510
    {
347
510
      size_t target_capacity = buffer_capacity;
348
510
      if (target_capacity == 0)
349
0
        target_capacity = 1;
350
351
      // Weird parens works around macro issues on Windows if NOMINMAX is not used.
352
510
      target_capacity = (std::max)(target_capacity, N);
353
354
      // Need to ensure there is a POT value of target capacity which is larger than count,
355
      // otherwise this will overflow.
356
1.02k
      while (target_capacity < count)
357
510
        target_capacity <<= 1u;
358
359
510
      T *new_buffer =
360
510
          target_capacity > N ? static_cast<T *>(malloc(target_capacity * sizeof(T))) : stack_storage.data();
361
362
      // If we actually fail this malloc, we are hosed anyways, there is no reason to attempt recovery.
363
510
      if (!new_buffer)
364
0
        std::terminate();
365
366
      // In case for some reason two allocations both come from same stack.
367
510
      if (new_buffer != this->ptr)
368
510
      {
369
        // We don't deal with types which can throw in move constructor.
370
17.4k
        for (size_t i = 0; i < this->buffer_size; i++)
371
16.9k
        {
372
16.9k
          new (&new_buffer[i]) T(std::move(this->ptr[i]));
373
16.9k
          this->ptr[i].~T();
374
16.9k
        }
375
510
      }
376
377
510
      if (this->ptr != stack_storage.data())
378
287
        free(this->ptr);
379
510
      this->ptr = new_buffer;
380
510
      buffer_capacity = target_capacity;
381
510
    }
382
19.6k
  }
spirv_cross::SmallVector<spirv_cross::SPIRFunction::Parameter, 8ul>::reserve(unsigned long)
Line
Count
Source
337
166
  {
338
166
    if ((count > (std::numeric_limits<size_t>::max)() / sizeof(T)) ||
339
166
        (count > (std::numeric_limits<size_t>::max)() / 2))
340
0
    {
341
      // Only way this should ever happen is with garbage input, terminate.
342
0
      std::terminate();
343
0
    }
344
345
166
    if (count > buffer_capacity)
346
0
    {
347
0
      size_t target_capacity = buffer_capacity;
348
0
      if (target_capacity == 0)
349
0
        target_capacity = 1;
350
351
      // Weird parens works around macro issues on Windows if NOMINMAX is not used.
352
0
      target_capacity = (std::max)(target_capacity, N);
353
354
      // Need to ensure there is a POT value of target capacity which is larger than count,
355
      // otherwise this will overflow.
356
0
      while (target_capacity < count)
357
0
        target_capacity <<= 1u;
358
359
0
      T *new_buffer =
360
0
          target_capacity > N ? static_cast<T *>(malloc(target_capacity * sizeof(T))) : stack_storage.data();
361
362
      // If we actually fail this malloc, we are hosed anyways, there is no reason to attempt recovery.
363
0
      if (!new_buffer)
364
0
        std::terminate();
365
366
      // In case for some reason two allocations both come from same stack.
367
0
      if (new_buffer != this->ptr)
368
0
      {
369
        // We don't deal with types which can throw in move constructor.
370
0
        for (size_t i = 0; i < this->buffer_size; i++)
371
0
        {
372
0
          new (&new_buffer[i]) T(std::move(this->ptr[i]));
373
0
          this->ptr[i].~T();
374
0
        }
375
0
      }
376
377
0
      if (this->ptr != stack_storage.data())
378
0
        free(this->ptr);
379
0
      this->ptr = new_buffer;
380
0
      buffer_capacity = target_capacity;
381
0
    }
382
166
  }
spirv_cross::SmallVector<spirv_cross::SPIRFunction*, 0ul>::reserve(unsigned long)
Line
Count
Source
337
4.30k
  {
338
4.30k
    if ((count > (std::numeric_limits<size_t>::max)() / sizeof(T)) ||
339
4.30k
        (count > (std::numeric_limits<size_t>::max)() / 2))
340
0
    {
341
      // Only way this should ever happen is with garbage input, terminate.
342
0
      std::terminate();
343
0
    }
344
345
4.30k
    if (count > buffer_capacity)
346
227
    {
347
227
      size_t target_capacity = buffer_capacity;
348
227
      if (target_capacity == 0)
349
227
        target_capacity = 1;
350
351
      // Weird parens works around macro issues on Windows if NOMINMAX is not used.
352
227
      target_capacity = (std::max)(target_capacity, N);
353
354
      // Need to ensure there is a POT value of target capacity which is larger than count,
355
      // otherwise this will overflow.
356
1.13k
      while (target_capacity < count)
357
908
        target_capacity <<= 1u;
358
359
227
      T *new_buffer =
360
227
          target_capacity > N ? static_cast<T *>(malloc(target_capacity * sizeof(T))) : stack_storage.data();
361
362
      // If we actually fail this malloc, we are hosed anyways, there is no reason to attempt recovery.
363
227
      if (!new_buffer)
364
0
        std::terminate();
365
366
      // In case for some reason two allocations both come from same stack.
367
227
      if (new_buffer != this->ptr)
368
227
      {
369
        // We don't deal with types which can throw in move constructor.
370
227
        for (size_t i = 0; i < this->buffer_size; i++)
371
0
        {
372
0
          new (&new_buffer[i]) T(std::move(this->ptr[i]));
373
0
          this->ptr[i].~T();
374
0
        }
375
227
      }
376
377
227
      if (this->ptr != stack_storage.data())
378
0
        free(this->ptr);
379
227
      this->ptr = new_buffer;
380
227
      buffer_capacity = target_capacity;
381
227
    }
382
4.30k
  }
spirv_cross::SmallVector<std::__1::unique_ptr<spirv_cross::SPIRFunction, spirv_cross::ObjectPool<spirv_cross::SPIRFunction>::MallocDeleter>, 8ul>::reserve(unsigned long)
Line
Count
Source
337
227
  {
338
227
    if ((count > (std::numeric_limits<size_t>::max)() / sizeof(T)) ||
339
227
        (count > (std::numeric_limits<size_t>::max)() / 2))
340
0
    {
341
      // Only way this should ever happen is with garbage input, terminate.
342
0
      std::terminate();
343
0
    }
344
345
227
    if (count > buffer_capacity)
346
0
    {
347
0
      size_t target_capacity = buffer_capacity;
348
0
      if (target_capacity == 0)
349
0
        target_capacity = 1;
350
351
      // Weird parens works around macro issues on Windows if NOMINMAX is not used.
352
0
      target_capacity = (std::max)(target_capacity, N);
353
354
      // Need to ensure there is a POT value of target capacity which is larger than count,
355
      // otherwise this will overflow.
356
0
      while (target_capacity < count)
357
0
        target_capacity <<= 1u;
358
359
0
      T *new_buffer =
360
0
          target_capacity > N ? static_cast<T *>(malloc(target_capacity * sizeof(T))) : stack_storage.data();
361
362
      // If we actually fail this malloc, we are hosed anyways, there is no reason to attempt recovery.
363
0
      if (!new_buffer)
364
0
        std::terminate();
365
366
      // In case for some reason two allocations both come from same stack.
367
0
      if (new_buffer != this->ptr)
368
0
      {
369
        // We don't deal with types which can throw in move constructor.
370
0
        for (size_t i = 0; i < this->buffer_size; i++)
371
0
        {
372
0
          new (&new_buffer[i]) T(std::move(this->ptr[i]));
373
0
          this->ptr[i].~T();
374
0
        }
375
0
      }
376
377
0
      if (this->ptr != stack_storage.data())
378
0
        free(this->ptr);
379
0
      this->ptr = new_buffer;
380
0
      buffer_capacity = target_capacity;
381
0
    }
382
227
  }
spirv_cross::SmallVector<spirv_cross::TypedID<(spirv_cross::Types)6>, 8ul>::reserve(unsigned long)
Line
Count
Source
337
9.81k
  {
338
9.81k
    if ((count > (std::numeric_limits<size_t>::max)() / sizeof(T)) ||
339
9.81k
        (count > (std::numeric_limits<size_t>::max)() / 2))
340
0
    {
341
      // Only way this should ever happen is with garbage input, terminate.
342
0
      std::terminate();
343
0
    }
344
345
9.81k
    if (count > buffer_capacity)
346
372
    {
347
372
      size_t target_capacity = buffer_capacity;
348
372
      if (target_capacity == 0)
349
0
        target_capacity = 1;
350
351
      // Weird parens works around macro issues on Windows if NOMINMAX is not used.
352
372
      target_capacity = (std::max)(target_capacity, N);
353
354
      // Need to ensure there is a POT value of target capacity which is larger than count,
355
      // otherwise this will overflow.
356
744
      while (target_capacity < count)
357
372
        target_capacity <<= 1u;
358
359
372
      T *new_buffer =
360
372
          target_capacity > N ? static_cast<T *>(malloc(target_capacity * sizeof(T))) : stack_storage.data();
361
362
      // If we actually fail this malloc, we are hosed anyways, there is no reason to attempt recovery.
363
372
      if (!new_buffer)
364
0
        std::terminate();
365
366
      // In case for some reason two allocations both come from same stack.
367
372
      if (new_buffer != this->ptr)
368
372
      {
369
        // We don't deal with types which can throw in move constructor.
370
11.6k
        for (size_t i = 0; i < this->buffer_size; i++)
371
11.3k
        {
372
11.3k
          new (&new_buffer[i]) T(std::move(this->ptr[i]));
373
11.3k
          this->ptr[i].~T();
374
11.3k
        }
375
372
      }
376
377
372
      if (this->ptr != stack_storage.data())
378
223
        free(this->ptr);
379
372
      this->ptr = new_buffer;
380
372
      buffer_capacity = target_capacity;
381
372
    }
382
9.81k
  }
Unexecuted instantiation: spirv_cross::SmallVector<spirv_cross::SPIRFunction::CombinedImageSamplerParameter, 8ul>::reserve(unsigned long)
Unexecuted instantiation: spirv_cross::SmallVector<std::__1::function<void ()>, 0ul>::reserve(unsigned long)
Unexecuted instantiation: spirv_cross::SmallVector<spirv_cross::SPIRAccessChain*, 0ul>::reserve(unsigned long)
Unexecuted instantiation: spirv_cross::SmallVector<std::__1::unique_ptr<spirv_cross::SPIRAccessChain, spirv_cross::ObjectPool<spirv_cross::SPIRAccessChain>::MallocDeleter>, 8ul>::reserve(unsigned long)
spirv_cross::SmallVector<spirv_cross::SPIRVariable*, 0ul>::reserve(unsigned long)
Line
Count
Source
337
16.8k
  {
338
16.8k
    if ((count > (std::numeric_limits<size_t>::max)() / sizeof(T)) ||
339
16.8k
        (count > (std::numeric_limits<size_t>::max)() / 2))
340
0
    {
341
      // Only way this should ever happen is with garbage input, terminate.
342
0
      std::terminate();
343
0
    }
344
345
16.8k
    if (count > buffer_capacity)
346
394
    {
347
394
      size_t target_capacity = buffer_capacity;
348
394
      if (target_capacity == 0)
349
258
        target_capacity = 1;
350
351
      // Weird parens works around macro issues on Windows if NOMINMAX is not used.
352
394
      target_capacity = (std::max)(target_capacity, N);
353
354
      // Need to ensure there is a POT value of target capacity which is larger than count,
355
      // otherwise this will overflow.
356
1.56k
      while (target_capacity < count)
357
1.16k
        target_capacity <<= 1u;
358
359
394
      T *new_buffer =
360
394
          target_capacity > N ? static_cast<T *>(malloc(target_capacity * sizeof(T))) : stack_storage.data();
361
362
      // If we actually fail this malloc, we are hosed anyways, there is no reason to attempt recovery.
363
394
      if (!new_buffer)
364
0
        std::terminate();
365
366
      // In case for some reason two allocations both come from same stack.
367
394
      if (new_buffer != this->ptr)
368
394
      {
369
        // We don't deal with types which can throw in move constructor.
370
2.79k
        for (size_t i = 0; i < this->buffer_size; i++)
371
2.40k
        {
372
2.40k
          new (&new_buffer[i]) T(std::move(this->ptr[i]));
373
2.40k
          this->ptr[i].~T();
374
2.40k
        }
375
394
      }
376
377
394
      if (this->ptr != stack_storage.data())
378
136
        free(this->ptr);
379
394
      this->ptr = new_buffer;
380
394
      buffer_capacity = target_capacity;
381
394
    }
382
16.8k
  }
spirv_cross::SmallVector<std::__1::unique_ptr<spirv_cross::SPIRVariable, spirv_cross::ObjectPool<spirv_cross::SPIRVariable>::MallocDeleter>, 8ul>::reserve(unsigned long)
Line
Count
Source
337
333
  {
338
333
    if ((count > (std::numeric_limits<size_t>::max)() / sizeof(T)) ||
339
333
        (count > (std::numeric_limits<size_t>::max)() / 2))
340
0
    {
341
      // Only way this should ever happen is with garbage input, terminate.
342
0
      std::terminate();
343
0
    }
344
345
333
    if (count > buffer_capacity)
346
0
    {
347
0
      size_t target_capacity = buffer_capacity;
348
0
      if (target_capacity == 0)
349
0
        target_capacity = 1;
350
351
      // Weird parens works around macro issues on Windows if NOMINMAX is not used.
352
0
      target_capacity = (std::max)(target_capacity, N);
353
354
      // Need to ensure there is a POT value of target capacity which is larger than count,
355
      // otherwise this will overflow.
356
0
      while (target_capacity < count)
357
0
        target_capacity <<= 1u;
358
359
0
      T *new_buffer =
360
0
          target_capacity > N ? static_cast<T *>(malloc(target_capacity * sizeof(T))) : stack_storage.data();
361
362
      // If we actually fail this malloc, we are hosed anyways, there is no reason to attempt recovery.
363
0
      if (!new_buffer)
364
0
        std::terminate();
365
366
      // In case for some reason two allocations both come from same stack.
367
0
      if (new_buffer != this->ptr)
368
0
      {
369
        // We don't deal with types which can throw in move constructor.
370
0
        for (size_t i = 0; i < this->buffer_size; i++)
371
0
        {
372
0
          new (&new_buffer[i]) T(std::move(this->ptr[i]));
373
0
          this->ptr[i].~T();
374
0
        }
375
0
      }
376
377
0
      if (this->ptr != stack_storage.data())
378
0
        free(this->ptr);
379
0
      this->ptr = new_buffer;
380
0
      buffer_capacity = target_capacity;
381
0
    }
382
333
  }
spirv_cross::SmallVector<spirv_cross::TypedID<(spirv_cross::Types)3>, 8ul>::reserve(unsigned long)
Line
Count
Source
337
8.38k
  {
338
8.38k
    if ((count > (std::numeric_limits<size_t>::max)() / sizeof(T)) ||
339
8.38k
        (count > (std::numeric_limits<size_t>::max)() / 2))
340
0
    {
341
      // Only way this should ever happen is with garbage input, terminate.
342
0
      std::terminate();
343
0
    }
344
345
8.38k
    if (count > buffer_capacity)
346
6
    {
347
6
      size_t target_capacity = buffer_capacity;
348
6
      if (target_capacity == 0)
349
0
        target_capacity = 1;
350
351
      // Weird parens works around macro issues on Windows if NOMINMAX is not used.
352
6
      target_capacity = (std::max)(target_capacity, N);
353
354
      // Need to ensure there is a POT value of target capacity which is larger than count,
355
      // otherwise this will overflow.
356
16
      while (target_capacity < count)
357
10
        target_capacity <<= 1u;
358
359
6
      T *new_buffer =
360
6
          target_capacity > N ? static_cast<T *>(malloc(target_capacity * sizeof(T))) : stack_storage.data();
361
362
      // If we actually fail this malloc, we are hosed anyways, there is no reason to attempt recovery.
363
6
      if (!new_buffer)
364
0
        std::terminate();
365
366
      // In case for some reason two allocations both come from same stack.
367
6
      if (new_buffer != this->ptr)
368
6
      {
369
        // We don't deal with types which can throw in move constructor.
370
6
        for (size_t i = 0; i < this->buffer_size; i++)
371
0
        {
372
0
          new (&new_buffer[i]) T(std::move(this->ptr[i]));
373
0
          this->ptr[i].~T();
374
0
        }
375
6
      }
376
377
6
      if (this->ptr != stack_storage.data())
378
0
        free(this->ptr);
379
6
      this->ptr = new_buffer;
380
6
      buffer_capacity = target_capacity;
381
6
    }
382
8.38k
  }
spirv_cross::SmallVector<spirv_cross::SPIRConstant*, 0ul>::reserve(unsigned long)
Line
Count
Source
337
29.4k
  {
338
29.4k
    if ((count > (std::numeric_limits<size_t>::max)() / sizeof(T)) ||
339
29.4k
        (count > (std::numeric_limits<size_t>::max)() / 2))
340
0
    {
341
      // Only way this should ever happen is with garbage input, terminate.
342
0
      std::terminate();
343
0
    }
344
345
29.4k
    if (count > buffer_capacity)
346
596
    {
347
596
      size_t target_capacity = buffer_capacity;
348
596
      if (target_capacity == 0)
349
277
        target_capacity = 1;
350
351
      // Weird parens works around macro issues on Windows if NOMINMAX is not used.
352
596
      target_capacity = (std::max)(target_capacity, N);
353
354
      // Need to ensure there is a POT value of target capacity which is larger than count,
355
      // otherwise this will overflow.
356
2.02k
      while (target_capacity < count)
357
1.42k
        target_capacity <<= 1u;
358
359
596
      T *new_buffer =
360
596
          target_capacity > N ? static_cast<T *>(malloc(target_capacity * sizeof(T))) : stack_storage.data();
361
362
      // If we actually fail this malloc, we are hosed anyways, there is no reason to attempt recovery.
363
596
      if (!new_buffer)
364
0
        std::terminate();
365
366
      // In case for some reason two allocations both come from same stack.
367
596
      if (new_buffer != this->ptr)
368
596
      {
369
        // We don't deal with types which can throw in move constructor.
370
8.62k
        for (size_t i = 0; i < this->buffer_size; i++)
371
8.03k
        {
372
8.03k
          new (&new_buffer[i]) T(std::move(this->ptr[i]));
373
8.03k
          this->ptr[i].~T();
374
8.03k
        }
375
596
      }
376
377
596
      if (this->ptr != stack_storage.data())
378
319
        free(this->ptr);
379
596
      this->ptr = new_buffer;
380
596
      buffer_capacity = target_capacity;
381
596
    }
382
29.4k
  }
spirv_cross::SmallVector<std::__1::unique_ptr<spirv_cross::SPIRConstant, spirv_cross::ObjectPool<spirv_cross::SPIRConstant>::MallocDeleter>, 8ul>::reserve(unsigned long)
Line
Count
Source
337
466
  {
338
466
    if ((count > (std::numeric_limits<size_t>::max)() / sizeof(T)) ||
339
466
        (count > (std::numeric_limits<size_t>::max)() / 2))
340
0
    {
341
      // Only way this should ever happen is with garbage input, terminate.
342
0
      std::terminate();
343
0
    }
344
345
466
    if (count > buffer_capacity)
346
0
    {
347
0
      size_t target_capacity = buffer_capacity;
348
0
      if (target_capacity == 0)
349
0
        target_capacity = 1;
350
351
      // Weird parens works around macro issues on Windows if NOMINMAX is not used.
352
0
      target_capacity = (std::max)(target_capacity, N);
353
354
      // Need to ensure there is a POT value of target capacity which is larger than count,
355
      // otherwise this will overflow.
356
0
      while (target_capacity < count)
357
0
        target_capacity <<= 1u;
358
359
0
      T *new_buffer =
360
0
          target_capacity > N ? static_cast<T *>(malloc(target_capacity * sizeof(T))) : stack_storage.data();
361
362
      // If we actually fail this malloc, we are hosed anyways, there is no reason to attempt recovery.
363
0
      if (!new_buffer)
364
0
        std::terminate();
365
366
      // In case for some reason two allocations both come from same stack.
367
0
      if (new_buffer != this->ptr)
368
0
      {
369
        // We don't deal with types which can throw in move constructor.
370
0
        for (size_t i = 0; i < this->buffer_size; i++)
371
0
        {
372
0
          new (&new_buffer[i]) T(std::move(this->ptr[i]));
373
0
          this->ptr[i].~T();
374
0
        }
375
0
      }
376
377
0
      if (this->ptr != stack_storage.data())
378
0
        free(this->ptr);
379
0
      this->ptr = new_buffer;
380
0
      buffer_capacity = target_capacity;
381
0
    }
382
466
  }
spirv_cross::SmallVector<spv::Capability, 8ul>::reserve(unsigned long)
Line
Count
Source
337
3.60k
  {
338
3.60k
    if ((count > (std::numeric_limits<size_t>::max)() / sizeof(T)) ||
339
3.60k
        (count > (std::numeric_limits<size_t>::max)() / 2))
340
0
    {
341
      // Only way this should ever happen is with garbage input, terminate.
342
0
      std::terminate();
343
0
    }
344
345
3.60k
    if (count > buffer_capacity)
346
57
    {
347
57
      size_t target_capacity = buffer_capacity;
348
57
      if (target_capacity == 0)
349
0
        target_capacity = 1;
350
351
      // Weird parens works around macro issues on Windows if NOMINMAX is not used.
352
57
      target_capacity = (std::max)(target_capacity, N);
353
354
      // Need to ensure there is a POT value of target capacity which is larger than count,
355
      // otherwise this will overflow.
356
114
      while (target_capacity < count)
357
57
        target_capacity <<= 1u;
358
359
57
      T *new_buffer =
360
57
          target_capacity > N ? static_cast<T *>(malloc(target_capacity * sizeof(T))) : stack_storage.data();
361
362
      // If we actually fail this malloc, we are hosed anyways, there is no reason to attempt recovery.
363
57
      if (!new_buffer)
364
0
        std::terminate();
365
366
      // In case for some reason two allocations both come from same stack.
367
57
      if (new_buffer != this->ptr)
368
57
      {
369
        // We don't deal with types which can throw in move constructor.
370
4.92k
        for (size_t i = 0; i < this->buffer_size; i++)
371
4.86k
        {
372
4.86k
          new (&new_buffer[i]) T(std::move(this->ptr[i]));
373
4.86k
          this->ptr[i].~T();
374
4.86k
        }
375
57
      }
376
377
57
      if (this->ptr != stack_storage.data())
378
45
        free(this->ptr);
379
57
      this->ptr = new_buffer;
380
57
      buffer_capacity = target_capacity;
381
57
    }
382
3.60k
  }
spirv_cross::SmallVector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, 8ul>::reserve(unsigned long)
Line
Count
Source
337
313k
  {
338
313k
    if ((count > (std::numeric_limits<size_t>::max)() / sizeof(T)) ||
339
313k
        (count > (std::numeric_limits<size_t>::max)() / 2))
340
0
    {
341
      // Only way this should ever happen is with garbage input, terminate.
342
0
      std::terminate();
343
0
    }
344
345
313k
    if (count > buffer_capacity)
346
306
    {
347
306
      size_t target_capacity = buffer_capacity;
348
306
      if (target_capacity == 0)
349
0
        target_capacity = 1;
350
351
      // Weird parens works around macro issues on Windows if NOMINMAX is not used.
352
306
      target_capacity = (std::max)(target_capacity, N);
353
354
      // Need to ensure there is a POT value of target capacity which is larger than count,
355
      // otherwise this will overflow.
356
612
      while (target_capacity < count)
357
306
        target_capacity <<= 1u;
358
359
306
      T *new_buffer =
360
306
          target_capacity > N ? static_cast<T *>(malloc(target_capacity * sizeof(T))) : stack_storage.data();
361
362
      // If we actually fail this malloc, we are hosed anyways, there is no reason to attempt recovery.
363
306
      if (!new_buffer)
364
0
        std::terminate();
365
366
      // In case for some reason two allocations both come from same stack.
367
306
      if (new_buffer != this->ptr)
368
306
      {
369
        // We don't deal with types which can throw in move constructor.
370
394k
        for (size_t i = 0; i < this->buffer_size; i++)
371
394k
        {
372
394k
          new (&new_buffer[i]) T(std::move(this->ptr[i]));
373
394k
          this->ptr[i].~T();
374
394k
        }
375
306
      }
376
377
306
      if (this->ptr != stack_storage.data())
378
272
        free(this->ptr);
379
306
      this->ptr = new_buffer;
380
306
      buffer_capacity = target_capacity;
381
306
    }
382
313k
  }
spirv_cross::SmallVector<std::__1::pair<unsigned int, unsigned int>, 8ul>::reserve(unsigned long)
Line
Count
Source
337
2.82k
  {
338
2.82k
    if ((count > (std::numeric_limits<size_t>::max)() / sizeof(T)) ||
339
2.82k
        (count > (std::numeric_limits<size_t>::max)() / 2))
340
0
    {
341
      // Only way this should ever happen is with garbage input, terminate.
342
0
      std::terminate();
343
0
    }
344
345
2.82k
    if (count > buffer_capacity)
346
60
    {
347
60
      size_t target_capacity = buffer_capacity;
348
60
      if (target_capacity == 0)
349
0
        target_capacity = 1;
350
351
      // Weird parens works around macro issues on Windows if NOMINMAX is not used.
352
60
      target_capacity = (std::max)(target_capacity, N);
353
354
      // Need to ensure there is a POT value of target capacity which is larger than count,
355
      // otherwise this will overflow.
356
120
      while (target_capacity < count)
357
60
        target_capacity <<= 1u;
358
359
60
      T *new_buffer =
360
60
          target_capacity > N ? static_cast<T *>(malloc(target_capacity * sizeof(T))) : stack_storage.data();
361
362
      // If we actually fail this malloc, we are hosed anyways, there is no reason to attempt recovery.
363
60
      if (!new_buffer)
364
0
        std::terminate();
365
366
      // In case for some reason two allocations both come from same stack.
367
60
      if (new_buffer != this->ptr)
368
60
      {
369
        // We don't deal with types which can throw in move constructor.
370
3.74k
        for (size_t i = 0; i < this->buffer_size; i++)
371
3.68k
        {
372
3.68k
          new (&new_buffer[i]) T(std::move(this->ptr[i]));
373
3.68k
          this->ptr[i].~T();
374
3.68k
        }
375
60
      }
376
377
60
      if (this->ptr != stack_storage.data())
378
44
        free(this->ptr);
379
60
      this->ptr = new_buffer;
380
60
      buffer_capacity = target_capacity;
381
60
    }
382
2.82k
  }
spirv_cross::SmallVector<unsigned char, 8ul>::reserve(unsigned long)
Line
Count
Source
337
2.48k
  {
338
2.48k
    if ((count > (std::numeric_limits<size_t>::max)() / sizeof(T)) ||
339
2.48k
        (count > (std::numeric_limits<size_t>::max)() / 2))
340
0
    {
341
      // Only way this should ever happen is with garbage input, terminate.
342
0
      std::terminate();
343
0
    }
344
345
2.48k
    if (count > buffer_capacity)
346
559
    {
347
559
      size_t target_capacity = buffer_capacity;
348
559
      if (target_capacity == 0)
349
0
        target_capacity = 1;
350
351
      // Weird parens works around macro issues on Windows if NOMINMAX is not used.
352
559
      target_capacity = (std::max)(target_capacity, N);
353
354
      // Need to ensure there is a POT value of target capacity which is larger than count,
355
      // otherwise this will overflow.
356
4.69k
      while (target_capacity < count)
357
4.13k
        target_capacity <<= 1u;
358
359
559
      T *new_buffer =
360
559
          target_capacity > N ? static_cast<T *>(malloc(target_capacity * sizeof(T))) : stack_storage.data();
361
362
      // If we actually fail this malloc, we are hosed anyways, there is no reason to attempt recovery.
363
559
      if (!new_buffer)
364
0
        std::terminate();
365
366
      // In case for some reason two allocations both come from same stack.
367
559
      if (new_buffer != this->ptr)
368
559
      {
369
        // We don't deal with types which can throw in move constructor.
370
686
        for (size_t i = 0; i < this->buffer_size; i++)
371
127
        {
372
127
          new (&new_buffer[i]) T(std::move(this->ptr[i]));
373
127
          this->ptr[i].~T();
374
127
        }
375
559
      }
376
377
559
      if (this->ptr != stack_storage.data())
378
1
        free(this->ptr);
379
559
      this->ptr = new_buffer;
380
559
      buffer_capacity = target_capacity;
381
559
    }
382
2.48k
  }
spirv_cross::SmallVector<spirv_cross::Meta::Decoration, 0ul>::reserve(unsigned long)
Line
Count
Source
337
464
  {
338
464
    if ((count > (std::numeric_limits<size_t>::max)() / sizeof(T)) ||
339
464
        (count > (std::numeric_limits<size_t>::max)() / 2))
340
0
    {
341
      // Only way this should ever happen is with garbage input, terminate.
342
0
      std::terminate();
343
0
    }
344
345
464
    if (count > buffer_capacity)
346
459
    {
347
459
      size_t target_capacity = buffer_capacity;
348
459
      if (target_capacity == 0)
349
381
        target_capacity = 1;
350
351
      // Weird parens works around macro issues on Windows if NOMINMAX is not used.
352
459
      target_capacity = (std::max)(target_capacity, N);
353
354
      // Need to ensure there is a POT value of target capacity which is larger than count,
355
      // otherwise this will overflow.
356
1.20k
      while (target_capacity < count)
357
745
        target_capacity <<= 1u;
358
359
459
      T *new_buffer =
360
459
          target_capacity > N ? static_cast<T *>(malloc(target_capacity * sizeof(T))) : stack_storage.data();
361
362
      // If we actually fail this malloc, we are hosed anyways, there is no reason to attempt recovery.
363
459
      if (!new_buffer)
364
0
        std::terminate();
365
366
      // In case for some reason two allocations both come from same stack.
367
459
      if (new_buffer != this->ptr)
368
459
      {
369
        // We don't deal with types which can throw in move constructor.
370
269k
        for (size_t i = 0; i < this->buffer_size; i++)
371
268k
        {
372
268k
          new (&new_buffer[i]) T(std::move(this->ptr[i]));
373
268k
          this->ptr[i].~T();
374
268k
        }
375
459
      }
376
377
459
      if (this->ptr != stack_storage.data())
378
78
        free(this->ptr);
379
459
      this->ptr = new_buffer;
380
459
      buffer_capacity = target_capacity;
381
459
    }
382
464
  }
spirv_cross::SmallVector<spirv_cross::Variant, 8ul>::reserve(unsigned long)
Line
Count
Source
337
37.8M
  {
338
37.8M
    if ((count > (std::numeric_limits<size_t>::max)() / sizeof(T)) ||
339
37.8M
        (count > (std::numeric_limits<size_t>::max)() / 2))
340
0
    {
341
      // Only way this should ever happen is with garbage input, terminate.
342
0
      std::terminate();
343
0
    }
344
345
37.8M
    if (count > buffer_capacity)
346
559
    {
347
559
      size_t target_capacity = buffer_capacity;
348
559
      if (target_capacity == 0)
349
0
        target_capacity = 1;
350
351
      // Weird parens works around macro issues on Windows if NOMINMAX is not used.
352
559
      target_capacity = (std::max)(target_capacity, N);
353
354
      // Need to ensure there is a POT value of target capacity which is larger than count,
355
      // otherwise this will overflow.
356
4.69k
      while (target_capacity < count)
357
4.13k
        target_capacity <<= 1u;
358
359
559
      T *new_buffer =
360
559
          target_capacity > N ? static_cast<T *>(malloc(target_capacity * sizeof(T))) : stack_storage.data();
361
362
      // If we actually fail this malloc, we are hosed anyways, there is no reason to attempt recovery.
363
559
      if (!new_buffer)
364
0
        std::terminate();
365
366
      // In case for some reason two allocations both come from same stack.
367
559
      if (new_buffer != this->ptr)
368
559
      {
369
        // We don't deal with types which can throw in move constructor.
370
686
        for (size_t i = 0; i < this->buffer_size; i++)
371
127
        {
372
127
          new (&new_buffer[i]) T(std::move(this->ptr[i]));
373
127
          this->ptr[i].~T();
374
127
        }
375
559
      }
376
377
559
      if (this->ptr != stack_storage.data())
378
1
        free(this->ptr);
379
559
      this->ptr = new_buffer;
380
559
      buffer_capacity = target_capacity;
381
559
    }
382
37.8M
  }
383
384
  void insert(T *itr, const T *insert_begin, const T *insert_end) SPIRV_CROSS_NOEXCEPT
385
  {
386
    auto count = size_t(insert_end - insert_begin);
387
    if (itr == this->end())
388
    {
389
      reserve(this->buffer_size + count);
390
      for (size_t i = 0; i < count; i++, insert_begin++)
391
        new (&this->ptr[this->buffer_size + i]) T(*insert_begin);
392
      this->buffer_size += count;
393
    }
394
    else
395
    {
396
      if (this->buffer_size + count > buffer_capacity)
397
      {
398
        auto target_capacity = this->buffer_size + count;
399
        if (target_capacity == 0)
400
          target_capacity = 1;
401
        if (target_capacity < N)
402
          target_capacity = N;
403
404
        while (target_capacity < count)
405
          target_capacity <<= 1u;
406
407
        // Need to allocate new buffer. Move everything to a new buffer.
408
        T *new_buffer =
409
            target_capacity > N ? static_cast<T *>(malloc(target_capacity * sizeof(T))) : stack_storage.data();
410
411
        // If we actually fail this malloc, we are hosed anyways, there is no reason to attempt recovery.
412
        if (!new_buffer)
413
          std::terminate();
414
415
        // First, move elements from source buffer to new buffer.
416
        // We don't deal with types which can throw in move constructor.
417
        auto *target_itr = new_buffer;
418
        auto *original_source_itr = this->begin();
419
420
        if (new_buffer != this->ptr)
421
        {
422
          while (original_source_itr != itr)
423
          {
424
            new (target_itr) T(std::move(*original_source_itr));
425
            original_source_itr->~T();
426
            ++original_source_itr;
427
            ++target_itr;
428
          }
429
        }
430
431
        // Copy-construct new elements.
432
        for (auto *source_itr = insert_begin; source_itr != insert_end; ++source_itr, ++target_itr)
433
          new (target_itr) T(*source_itr);
434
435
        // Move over the other half.
436
        if (new_buffer != this->ptr || insert_begin != insert_end)
437
        {
438
          while (original_source_itr != this->end())
439
          {
440
            new (target_itr) T(std::move(*original_source_itr));
441
            original_source_itr->~T();
442
            ++original_source_itr;
443
            ++target_itr;
444
          }
445
        }
446
447
        if (this->ptr != stack_storage.data())
448
          free(this->ptr);
449
        this->ptr = new_buffer;
450
        buffer_capacity = target_capacity;
451
      }
452
      else
453
      {
454
        // Move in place, need to be a bit careful about which elements are constructed and which are not.
455
        // Move the end and construct the new elements.
456
        auto *target_itr = this->end() + count;
457
        auto *source_itr = this->end();
458
        while (target_itr != this->end() && source_itr != itr)
459
        {
460
          --target_itr;
461
          --source_itr;
462
          new (target_itr) T(std::move(*source_itr));
463
        }
464
465
        // For already constructed elements we can move-assign.
466
        std::move_backward(itr, source_itr, target_itr);
467
468
        // For the inserts which go to already constructed elements, we can do a plain copy.
469
        while (itr != this->end() && insert_begin != insert_end)
470
          *itr++ = *insert_begin++;
471
472
        // For inserts into newly allocated memory, we must copy-construct instead.
473
        while (insert_begin != insert_end)
474
        {
475
          new (itr) T(*insert_begin);
476
          ++itr;
477
          ++insert_begin;
478
        }
479
      }
480
481
      this->buffer_size += count;
482
    }
483
  }
484
485
  void insert(T *itr, const T &value) SPIRV_CROSS_NOEXCEPT
486
  {
487
    insert(itr, &value, &value + 1);
488
  }
489
490
  T *erase(T *itr) SPIRV_CROSS_NOEXCEPT
491
  {
492
    std::move(itr + 1, this->end(), itr);
493
    this->ptr[--this->buffer_size].~T();
494
    return itr;
495
  }
496
497
  void erase(T *start_erase, T *end_erase) SPIRV_CROSS_NOEXCEPT
498
18
  {
499
18
    if (end_erase == this->end())
500
18
    {
501
18
      resize(size_t(start_erase - this->begin()));
502
18
    }
503
0
    else
504
0
    {
505
0
      auto new_size = this->buffer_size - (end_erase - start_erase);
506
0
      std::move(end_erase, this->end(), start_erase);
507
0
      resize(new_size);
508
0
    }
509
18
  }
510
511
  void resize(size_t new_size) SPIRV_CROSS_NOEXCEPT
512
79.8k
  {
513
79.8k
    if (new_size < this->buffer_size)
514
64.5k
    {
515
129k
      for (size_t i = new_size; i < this->buffer_size; i++)
516
64.5k
        this->ptr[i].~T();
517
64.5k
    }
518
15.2k
    else if (new_size > this->buffer_size)
519
4.45k
    {
520
4.45k
      reserve(new_size);
521
43.8M
      for (size_t i = this->buffer_size; i < new_size; i++)
522
43.8M
        new (&this->ptr[i]) T();
523
4.45k
    }
524
525
79.8k
    this->buffer_size = new_size;
526
79.8k
  }
spirv_cross::SmallVector<spirv_cross::SPIRUndef*, 0ul>::resize(unsigned long)
Line
Count
Source
512
1.81k
  {
513
1.81k
    if (new_size < this->buffer_size)
514
1.81k
    {
515
3.62k
      for (size_t i = new_size; i < this->buffer_size; i++)
516
1.81k
        this->ptr[i].~T();
517
1.81k
    }
518
0
    else if (new_size > this->buffer_size)
519
0
    {
520
0
      reserve(new_size);
521
0
      for (size_t i = this->buffer_size; i < new_size; i++)
522
0
        new (&this->ptr[i]) T();
523
0
    }
524
525
1.81k
    this->buffer_size = new_size;
526
1.81k
  }
spirv_cross::SmallVector<spirv_cross::SPIRString*, 0ul>::resize(unsigned long)
Line
Count
Source
512
886
  {
513
886
    if (new_size < this->buffer_size)
514
886
    {
515
1.77k
      for (size_t i = new_size; i < this->buffer_size; i++)
516
886
        this->ptr[i].~T();
517
886
    }
518
0
    else if (new_size > this->buffer_size)
519
0
    {
520
0
      reserve(new_size);
521
0
      for (size_t i = this->buffer_size; i < new_size; i++)
522
0
        new (&this->ptr[i]) T();
523
0
    }
524
525
886
    this->buffer_size = new_size;
526
886
  }
Unexecuted instantiation: spirv_cross::SmallVector<spirv_cross::SPIRCombinedImageSampler*, 0ul>::resize(unsigned long)
spirv_cross::SmallVector<spirv_cross::SPIRConstantOp*, 0ul>::resize(unsigned long)
Line
Count
Source
512
791
  {
513
791
    if (new_size < this->buffer_size)
514
791
    {
515
1.58k
      for (size_t i = new_size; i < this->buffer_size; i++)
516
791
        this->ptr[i].~T();
517
791
    }
518
0
    else if (new_size > this->buffer_size)
519
0
    {
520
0
      reserve(new_size);
521
0
      for (size_t i = this->buffer_size; i < new_size; i++)
522
0
        new (&this->ptr[i]) T();
523
0
    }
524
525
791
    this->buffer_size = new_size;
526
791
  }
spirv_cross::SmallVector<spirv_cross::SPIRType*, 0ul>::resize(unsigned long)
Line
Count
Source
512
22.2k
  {
513
22.2k
    if (new_size < this->buffer_size)
514
22.2k
    {
515
44.5k
      for (size_t i = new_size; i < this->buffer_size; i++)
516
22.2k
        this->ptr[i].~T();
517
22.2k
    }
518
0
    else if (new_size > this->buffer_size)
519
0
    {
520
0
      reserve(new_size);
521
0
      for (size_t i = this->buffer_size; i < new_size; i++)
522
0
        new (&this->ptr[i]) T();
523
0
    }
524
525
22.2k
    this->buffer_size = new_size;
526
22.2k
  }
spirv_cross::SmallVector<spirv_cross::SPIRExtension*, 0ul>::resize(unsigned long)
Line
Count
Source
512
508
  {
513
508
    if (new_size < this->buffer_size)
514
508
    {
515
1.01k
      for (size_t i = new_size; i < this->buffer_size; i++)
516
508
        this->ptr[i].~T();
517
508
    }
518
0
    else if (new_size > this->buffer_size)
519
0
    {
520
0
      reserve(new_size);
521
0
      for (size_t i = this->buffer_size; i < new_size; i++)
522
0
        new (&this->ptr[i]) T();
523
0
    }
524
525
508
    this->buffer_size = new_size;
526
508
  }
Unexecuted instantiation: spirv_cross::SmallVector<spirv_cross::SPIRExpression*, 0ul>::resize(unsigned long)
spirv_cross::SmallVector<spirv_cross::SPIRFunctionPrototype*, 0ul>::resize(unsigned long)
Line
Count
Source
512
5.83k
  {
513
5.83k
    if (new_size < this->buffer_size)
514
5.83k
    {
515
11.6k
      for (size_t i = new_size; i < this->buffer_size; i++)
516
5.83k
        this->ptr[i].~T();
517
5.83k
    }
518
0
    else if (new_size > this->buffer_size)
519
0
    {
520
0
      reserve(new_size);
521
0
      for (size_t i = this->buffer_size; i < new_size; i++)
522
0
        new (&this->ptr[i]) T();
523
0
    }
524
525
5.83k
    this->buffer_size = new_size;
526
5.83k
  }
spirv_cross::SmallVector<spirv_cross::SPIRBlock*, 0ul>::resize(unsigned long)
Line
Count
Source
512
9.80k
  {
513
9.80k
    if (new_size < this->buffer_size)
514
9.80k
    {
515
19.6k
      for (size_t i = new_size; i < this->buffer_size; i++)
516
9.80k
        this->ptr[i].~T();
517
9.80k
    }
518
0
    else if (new_size > this->buffer_size)
519
0
    {
520
0
      reserve(new_size);
521
0
      for (size_t i = this->buffer_size; i < new_size; i++)
522
0
        new (&this->ptr[i]) T();
523
0
    }
524
525
9.80k
    this->buffer_size = new_size;
526
9.80k
  }
spirv_cross::SmallVector<spirv_cross::SPIRFunction*, 0ul>::resize(unsigned long)
Line
Count
Source
512
450
  {
513
450
    if (new_size < this->buffer_size)
514
450
    {
515
900
      for (size_t i = new_size; i < this->buffer_size; i++)
516
450
        this->ptr[i].~T();
517
450
    }
518
0
    else if (new_size > this->buffer_size)
519
0
    {
520
0
      reserve(new_size);
521
0
      for (size_t i = this->buffer_size; i < new_size; i++)
522
0
        new (&this->ptr[i]) T();
523
0
    }
524
525
450
    this->buffer_size = new_size;
526
450
  }
Unexecuted instantiation: spirv_cross::SmallVector<spirv_cross::SPIRAccessChain*, 0ul>::resize(unsigned long)
spirv_cross::SmallVector<spirv_cross::SPIRVariable*, 0ul>::resize(unsigned long)
Line
Count
Source
512
9.50k
  {
513
9.50k
    if (new_size < this->buffer_size)
514
9.50k
    {
515
19.0k
      for (size_t i = new_size; i < this->buffer_size; i++)
516
9.50k
        this->ptr[i].~T();
517
9.50k
    }
518
0
    else if (new_size > this->buffer_size)
519
0
    {
520
0
      reserve(new_size);
521
0
      for (size_t i = this->buffer_size; i < new_size; i++)
522
0
        new (&this->ptr[i]) T();
523
0
    }
524
525
9.50k
    this->buffer_size = new_size;
526
9.50k
  }
spirv_cross::SmallVector<spirv_cross::SPIRConstant*, 0ul>::resize(unsigned long)
Line
Count
Source
512
12.6k
  {
513
12.6k
    if (new_size < this->buffer_size)
514
12.6k
    {
515
25.3k
      for (size_t i = new_size; i < this->buffer_size; i++)
516
12.6k
        this->ptr[i].~T();
517
12.6k
    }
518
0
    else if (new_size > this->buffer_size)
519
0
    {
520
0
      reserve(new_size);
521
0
      for (size_t i = this->buffer_size; i < new_size; i++)
522
0
        new (&this->ptr[i]) T();
523
0
    }
524
525
12.6k
    this->buffer_size = new_size;
526
12.6k
  }
spirv_cross::SmallVector<unsigned char, 8ul>::resize(unsigned long)
Line
Count
Source
512
2.49k
  {
513
2.49k
    if (new_size < this->buffer_size)
514
0
    {
515
0
      for (size_t i = new_size; i < this->buffer_size; i++)
516
0
        this->ptr[i].~T();
517
0
    }
518
2.49k
    else if (new_size > this->buffer_size)
519
2.48k
    {
520
2.48k
      reserve(new_size);
521
37.8M
      for (size_t i = this->buffer_size; i < new_size; i++)
522
37.8M
        new (&this->ptr[i]) T();
523
2.48k
    }
524
525
2.49k
    this->buffer_size = new_size;
526
2.49k
  }
spirv_cross::SmallVector<spirv_cross::Meta::Decoration, 0ul>::resize(unsigned long)
Line
Count
Source
512
10.9k
  {
513
10.9k
    if (new_size < this->buffer_size)
514
0
    {
515
0
      for (size_t i = new_size; i < this->buffer_size; i++)
516
0
        this->ptr[i].~T();
517
0
    }
518
10.9k
    else if (new_size > this->buffer_size)
519
464
    {
520
464
      reserve(new_size);
521
5.93M
      for (size_t i = this->buffer_size; i < new_size; i++)
522
5.93M
        new (&this->ptr[i]) T();
523
464
    }
524
525
10.9k
    this->buffer_size = new_size;
526
10.9k
  }
spirv_cross::SmallVector<spirv_cross::TypedID<(spirv_cross::Types)0>, 8ul>::resize(unsigned long)
Line
Count
Source
512
18
  {
513
18
    if (new_size < this->buffer_size)
514
18
    {
515
36
      for (size_t i = new_size; i < this->buffer_size; i++)
516
18
        this->ptr[i].~T();
517
18
    }
518
0
    else if (new_size > this->buffer_size)
519
0
    {
520
0
      reserve(new_size);
521
0
      for (size_t i = this->buffer_size; i < new_size; i++)
522
0
        new (&this->ptr[i]) T();
523
0
    }
524
525
18
    this->buffer_size = new_size;
526
18
  }
spirv_cross::SmallVector<unsigned int, 8ul>::resize(unsigned long)
Line
Count
Source
512
1.87k
  {
513
1.87k
    if (new_size < this->buffer_size)
514
0
    {
515
0
      for (size_t i = new_size; i < this->buffer_size; i++)
516
0
        this->ptr[i].~T();
517
0
    }
518
1.87k
    else if (new_size > this->buffer_size)
519
1.50k
    {
520
1.50k
      reserve(new_size);
521
6.02k
      for (size_t i = this->buffer_size; i < new_size; i++)
522
4.51k
        new (&this->ptr[i]) T();
523
1.50k
    }
524
525
1.87k
    this->buffer_size = new_size;
526
1.87k
  }
527
528
private:
529
  size_t buffer_capacity = 0;
530
  AlignedBuffer<T, N> stack_storage;
531
};
532
533
// A vector without stack storage.
534
// Could also be a typedef-ed to std::vector,
535
// but might as well use the one we have.
536
template <typename T>
537
using Vector = SmallVector<T, 0>;
538
539
#else // SPIRV_CROSS_FORCE_STL_TYPES
540
541
template <typename T, size_t N = 8>
542
using SmallVector = std::vector<T>;
543
template <typename T>
544
using Vector = std::vector<T>;
545
template <typename T>
546
using VectorView = std::vector<T>;
547
548
#endif // SPIRV_CROSS_FORCE_STL_TYPES
549
550
// An object pool which we use for allocating IVariant-derived objects.
551
// We know we are going to allocate a bunch of objects of each type,
552
// so amortize the mallocs.
553
class ObjectPoolBase
554
{
555
public:
556
7.80k
  virtual ~ObjectPoolBase() = default;
557
  virtual void deallocate_opaque(void *ptr) = 0;
558
};
559
560
template <typename T>
561
class ObjectPool : public ObjectPoolBase
562
{
563
public:
564
  explicit ObjectPool(unsigned start_object_count_ = 16)
565
7.80k
      : start_object_count(start_object_count_)
566
7.80k
  {
567
7.80k
  }
spirv_cross::ObjectPool<spirv_cross::SPIRType>::ObjectPool(unsigned int)
Line
Count
Source
565
600
      : start_object_count(start_object_count_)
566
600
  {
567
600
  }
spirv_cross::ObjectPool<spirv_cross::SPIRVariable>::ObjectPool(unsigned int)
Line
Count
Source
565
600
      : start_object_count(start_object_count_)
566
600
  {
567
600
  }
spirv_cross::ObjectPool<spirv_cross::SPIRConstant>::ObjectPool(unsigned int)
Line
Count
Source
565
600
      : start_object_count(start_object_count_)
566
600
  {
567
600
  }
spirv_cross::ObjectPool<spirv_cross::SPIRFunction>::ObjectPool(unsigned int)
Line
Count
Source
565
600
      : start_object_count(start_object_count_)
566
600
  {
567
600
  }
spirv_cross::ObjectPool<spirv_cross::SPIRFunctionPrototype>::ObjectPool(unsigned int)
Line
Count
Source
565
600
      : start_object_count(start_object_count_)
566
600
  {
567
600
  }
spirv_cross::ObjectPool<spirv_cross::SPIRBlock>::ObjectPool(unsigned int)
Line
Count
Source
565
600
      : start_object_count(start_object_count_)
566
600
  {
567
600
  }
spirv_cross::ObjectPool<spirv_cross::SPIRExtension>::ObjectPool(unsigned int)
Line
Count
Source
565
600
      : start_object_count(start_object_count_)
566
600
  {
567
600
  }
spirv_cross::ObjectPool<spirv_cross::SPIRExpression>::ObjectPool(unsigned int)
Line
Count
Source
565
600
      : start_object_count(start_object_count_)
566
600
  {
567
600
  }
spirv_cross::ObjectPool<spirv_cross::SPIRConstantOp>::ObjectPool(unsigned int)
Line
Count
Source
565
600
      : start_object_count(start_object_count_)
566
600
  {
567
600
  }
spirv_cross::ObjectPool<spirv_cross::SPIRCombinedImageSampler>::ObjectPool(unsigned int)
Line
Count
Source
565
600
      : start_object_count(start_object_count_)
566
600
  {
567
600
  }
spirv_cross::ObjectPool<spirv_cross::SPIRAccessChain>::ObjectPool(unsigned int)
Line
Count
Source
565
600
      : start_object_count(start_object_count_)
566
600
  {
567
600
  }
spirv_cross::ObjectPool<spirv_cross::SPIRUndef>::ObjectPool(unsigned int)
Line
Count
Source
565
600
      : start_object_count(start_object_count_)
566
600
  {
567
600
  }
spirv_cross::ObjectPool<spirv_cross::SPIRString>::ObjectPool(unsigned int)
Line
Count
Source
565
600
      : start_object_count(start_object_count_)
566
600
  {
567
600
  }
568
569
  template <typename... P>
570
  T *allocate(P &&... p)
571
64.5k
  {
572
64.5k
    if (vacants.empty())
573
2.45k
    {
574
2.45k
      unsigned num_objects = start_object_count << memory.size();
575
2.45k
      T *ptr = static_cast<T *>(malloc(num_objects * sizeof(T)));
576
2.45k
      if (!ptr)
577
0
        return nullptr;
578
579
2.45k
      vacants.reserve(num_objects);
580
58.6k
      for (unsigned i = 0; i < num_objects; i++)
581
56.2k
        vacants.push_back(&ptr[i]);
582
583
2.45k
      memory.emplace_back(ptr);
584
2.45k
    }
585
586
64.5k
    T *ptr = vacants.back();
587
64.5k
    vacants.pop_back();
588
64.5k
    new (ptr) T(std::forward<P>(p)...);
589
64.5k
    return ptr;
590
64.5k
  }
Unexecuted instantiation: spirv_cross::SPIRUndef* spirv_cross::ObjectPool<spirv_cross::SPIRUndef>::allocate<spirv_cross::SPIRUndef&>(spirv_cross::SPIRUndef&)
Unexecuted instantiation: spirv_cross::SPIRString* spirv_cross::ObjectPool<spirv_cross::SPIRString>::allocate<spirv_cross::SPIRString&>(spirv_cross::SPIRString&)
Unexecuted instantiation: spirv_cross::SPIRCombinedImageSampler* spirv_cross::ObjectPool<spirv_cross::SPIRCombinedImageSampler>::allocate<spirv_cross::SPIRCombinedImageSampler&>(spirv_cross::SPIRCombinedImageSampler&)
Unexecuted instantiation: spirv_cross::SPIRConstantOp* spirv_cross::ObjectPool<spirv_cross::SPIRConstantOp>::allocate<spirv_cross::SPIRConstantOp&>(spirv_cross::SPIRConstantOp&)
spirv_cross::SPIRType* spirv_cross::ObjectPool<spirv_cross::SPIRType>::allocate<spirv_cross::SPIRType&>(spirv_cross::SPIRType&)
Line
Count
Source
571
3.45k
  {
572
3.45k
    if (vacants.empty())
573
30
    {
574
30
      unsigned num_objects = start_object_count << memory.size();
575
30
      T *ptr = static_cast<T *>(malloc(num_objects * sizeof(T)));
576
30
      if (!ptr)
577
0
        return nullptr;
578
579
30
      vacants.reserve(num_objects);
580
990
      for (unsigned i = 0; i < num_objects; i++)
581
960
        vacants.push_back(&ptr[i]);
582
583
30
      memory.emplace_back(ptr);
584
30
    }
585
586
3.45k
    T *ptr = vacants.back();
587
3.45k
    vacants.pop_back();
588
3.45k
    new (ptr) T(std::forward<P>(p)...);
589
3.45k
    return ptr;
590
3.45k
  }
Unexecuted instantiation: spirv_cross::SPIRExtension* spirv_cross::ObjectPool<spirv_cross::SPIRExtension>::allocate<spirv_cross::SPIRExtension&>(spirv_cross::SPIRExtension&)
Unexecuted instantiation: spirv_cross::SPIRExpression* spirv_cross::ObjectPool<spirv_cross::SPIRExpression>::allocate<spirv_cross::SPIRExpression&>(spirv_cross::SPIRExpression&)
Unexecuted instantiation: spirv_cross::SPIRFunctionPrototype* spirv_cross::ObjectPool<spirv_cross::SPIRFunctionPrototype>::allocate<spirv_cross::SPIRFunctionPrototype&>(spirv_cross::SPIRFunctionPrototype&)
Unexecuted instantiation: spirv_cross::SPIRBlock* spirv_cross::ObjectPool<spirv_cross::SPIRBlock>::allocate<spirv_cross::SPIRBlock&>(spirv_cross::SPIRBlock&)
Unexecuted instantiation: spirv_cross::SPIRFunction* spirv_cross::ObjectPool<spirv_cross::SPIRFunction>::allocate<spirv_cross::SPIRFunction&>(spirv_cross::SPIRFunction&)
Unexecuted instantiation: spirv_cross::SPIRAccessChain* spirv_cross::ObjectPool<spirv_cross::SPIRAccessChain>::allocate<spirv_cross::SPIRAccessChain&>(spirv_cross::SPIRAccessChain&)
Unexecuted instantiation: spirv_cross::SPIRVariable* spirv_cross::ObjectPool<spirv_cross::SPIRVariable>::allocate<spirv_cross::SPIRVariable&>(spirv_cross::SPIRVariable&)
Unexecuted instantiation: spirv_cross::SPIRConstant* spirv_cross::ObjectPool<spirv_cross::SPIRConstant>::allocate<spirv_cross::SPIRConstant&>(spirv_cross::SPIRConstant&)
spirv_cross::SPIRString* spirv_cross::ObjectPool<spirv_cross::SPIRString>::allocate<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&&)
Line
Count
Source
571
886
  {
572
886
    if (vacants.empty())
573
4
    {
574
4
      unsigned num_objects = start_object_count << memory.size();
575
4
      T *ptr = static_cast<T *>(malloc(num_objects * sizeof(T)));
576
4
      if (!ptr)
577
0
        return nullptr;
578
579
4
      vacants.reserve(num_objects);
580
68
      for (unsigned i = 0; i < num_objects; i++)
581
64
        vacants.push_back(&ptr[i]);
582
583
4
      memory.emplace_back(ptr);
584
4
    }
585
586
886
    T *ptr = vacants.back();
587
886
    vacants.pop_back();
588
886
    new (ptr) T(std::forward<P>(p)...);
589
886
    return ptr;
590
886
  }
spirv_cross::SPIRUndef* spirv_cross::ObjectPool<spirv_cross::SPIRUndef>::allocate<unsigned int&>(unsigned int&)
Line
Count
Source
571
1.81k
  {
572
1.81k
    if (vacants.empty())
573
71
    {
574
71
      unsigned num_objects = start_object_count << memory.size();
575
71
      T *ptr = static_cast<T *>(malloc(num_objects * sizeof(T)));
576
71
      if (!ptr)
577
0
        return nullptr;
578
579
71
      vacants.reserve(num_objects);
580
1.20k
      for (unsigned i = 0; i < num_objects; i++)
581
1.13k
        vacants.push_back(&ptr[i]);
582
583
71
      memory.emplace_back(ptr);
584
71
    }
585
586
1.81k
    T *ptr = vacants.back();
587
1.81k
    vacants.pop_back();
588
1.81k
    new (ptr) T(std::forward<P>(p)...);
589
1.81k
    return ptr;
590
1.81k
  }
spirv_cross::SPIRExtension* spirv_cross::ObjectPool<spirv_cross::SPIRExtension>::allocate<spirv_cross::SPIRExtension::Extension&>(spirv_cross::SPIRExtension::Extension&)
Line
Count
Source
571
508
  {
572
508
    if (vacants.empty())
573
284
    {
574
284
      unsigned num_objects = start_object_count << memory.size();
575
284
      T *ptr = static_cast<T *>(malloc(num_objects * sizeof(T)));
576
284
      if (!ptr)
577
0
        return nullptr;
578
579
284
      vacants.reserve(num_objects);
580
4.82k
      for (unsigned i = 0; i < num_objects; i++)
581
4.54k
        vacants.push_back(&ptr[i]);
582
583
284
      memory.emplace_back(ptr);
584
284
    }
585
586
508
    T *ptr = vacants.back();
587
508
    vacants.pop_back();
588
508
    new (ptr) T(std::forward<P>(p)...);
589
508
    return ptr;
590
508
  }
spirv_cross::SPIRType* spirv_cross::ObjectPool<spirv_cross::SPIRType>::allocate<spv::Op&>(spv::Op&)
Line
Count
Source
571
18.7k
  {
572
18.7k
    if (vacants.empty())
573
410
    {
574
410
      unsigned num_objects = start_object_count << memory.size();
575
410
      T *ptr = static_cast<T *>(malloc(num_objects * sizeof(T)));
576
410
      if (!ptr)
577
0
        return nullptr;
578
579
410
      vacants.reserve(num_objects);
580
7.86k
      for (unsigned i = 0; i < num_objects; i++)
581
7.45k
        vacants.push_back(&ptr[i]);
582
583
410
      memory.emplace_back(ptr);
584
410
    }
585
586
18.7k
    T *ptr = vacants.back();
587
18.7k
    vacants.pop_back();
588
18.7k
    new (ptr) T(std::forward<P>(p)...);
589
18.7k
    return ptr;
590
18.7k
  }
spirv_cross::SPIRFunctionPrototype* spirv_cross::ObjectPool<spirv_cross::SPIRFunctionPrototype>::allocate<unsigned int&>(unsigned int&)
Line
Count
Source
571
5.83k
  {
572
5.83k
    if (vacants.empty())
573
268
    {
574
268
      unsigned num_objects = start_object_count << memory.size();
575
268
      T *ptr = static_cast<T *>(malloc(num_objects * sizeof(T)));
576
268
      if (!ptr)
577
0
        return nullptr;
578
579
268
      vacants.reserve(num_objects);
580
4.55k
      for (unsigned i = 0; i < num_objects; i++)
581
4.28k
        vacants.push_back(&ptr[i]);
582
583
268
      memory.emplace_back(ptr);
584
268
    }
585
586
5.83k
    T *ptr = vacants.back();
587
5.83k
    vacants.pop_back();
588
5.83k
    new (ptr) T(std::forward<P>(p)...);
589
5.83k
    return ptr;
590
5.83k
  }
spirv_cross::SPIRVariable* spirv_cross::ObjectPool<spirv_cross::SPIRVariable>::allocate<unsigned int&, spv::StorageClass&, unsigned int&>(unsigned int&, spv::StorageClass&, unsigned int&)
Line
Count
Source
571
6.43k
  {
572
6.43k
    if (vacants.empty())
573
276
    {
574
276
      unsigned num_objects = start_object_count << memory.size();
575
276
      T *ptr = static_cast<T *>(malloc(num_objects * sizeof(T)));
576
276
      if (!ptr)
577
0
        return nullptr;
578
579
276
      vacants.reserve(num_objects);
580
5.42k
      for (unsigned i = 0; i < num_objects; i++)
581
5.15k
        vacants.push_back(&ptr[i]);
582
583
276
      memory.emplace_back(ptr);
584
276
    }
585
586
6.43k
    T *ptr = vacants.back();
587
6.43k
    vacants.pop_back();
588
6.43k
    new (ptr) T(std::forward<P>(p)...);
589
6.43k
    return ptr;
590
6.43k
  }
spirv_cross::SPIRVariable* spirv_cross::ObjectPool<spirv_cross::SPIRVariable>::allocate<unsigned int&, spv::StorageClass>(unsigned int&, spv::StorageClass&&)
Line
Count
Source
571
3.07k
  {
572
3.07k
    if (vacants.empty())
573
57
    {
574
57
      unsigned num_objects = start_object_count << memory.size();
575
57
      T *ptr = static_cast<T *>(malloc(num_objects * sizeof(T)));
576
57
      if (!ptr)
577
0
        return nullptr;
578
579
57
      vacants.reserve(num_objects);
580
1.88k
      for (unsigned i = 0; i < num_objects; i++)
581
1.82k
        vacants.push_back(&ptr[i]);
582
583
57
      memory.emplace_back(ptr);
584
57
    }
585
586
3.07k
    T *ptr = vacants.back();
587
3.07k
    vacants.pop_back();
588
3.07k
    new (ptr) T(std::forward<P>(p)...);
589
3.07k
    return ptr;
590
3.07k
  }
spirv_cross::SPIRConstant* spirv_cross::ObjectPool<spirv_cross::SPIRConstant>::allocate<unsigned int const&, unsigned long, bool>(unsigned int const&, unsigned long&&, bool&&)
Line
Count
Source
571
18
  {
572
18
    if (vacants.empty())
573
5
    {
574
5
      unsigned num_objects = start_object_count << memory.size();
575
5
      T *ptr = static_cast<T *>(malloc(num_objects * sizeof(T)));
576
5
      if (!ptr)
577
0
        return nullptr;
578
579
5
      vacants.reserve(num_objects);
580
101
      for (unsigned i = 0; i < num_objects; i++)
581
96
        vacants.push_back(&ptr[i]);
582
583
5
      memory.emplace_back(ptr);
584
5
    }
585
586
18
    T *ptr = vacants.back();
587
18
    vacants.pop_back();
588
18
    new (ptr) T(std::forward<P>(p)...);
589
18
    return ptr;
590
18
  }
spirv_cross::SPIRConstant* spirv_cross::ObjectPool<spirv_cross::SPIRConstant>::allocate<unsigned int const&, unsigned int const&, bool>(unsigned int const&, unsigned int const&, bool&&)
Line
Count
Source
571
3.90k
  {
572
3.90k
    if (vacants.empty())
573
306
    {
574
306
      unsigned num_objects = start_object_count << memory.size();
575
306
      T *ptr = static_cast<T *>(malloc(num_objects * sizeof(T)));
576
306
      if (!ptr)
577
0
        return nullptr;
578
579
306
      vacants.reserve(num_objects);
580
6.54k
      for (unsigned i = 0; i < num_objects; i++)
581
6.24k
        vacants.push_back(&ptr[i]);
582
583
306
      memory.emplace_back(ptr);
584
306
    }
585
586
3.90k
    T *ptr = vacants.back();
587
3.90k
    vacants.pop_back();
588
3.90k
    new (ptr) T(std::forward<P>(p)...);
589
3.90k
    return ptr;
590
3.90k
  }
spirv_cross::SPIRConstant* spirv_cross::ObjectPool<spirv_cross::SPIRConstant>::allocate<unsigned int const&, unsigned int, bool>(unsigned int const&, unsigned int&&, bool&&)
Line
Count
Source
571
613
  {
572
613
    if (vacants.empty())
573
17
    {
574
17
      unsigned num_objects = start_object_count << memory.size();
575
17
      T *ptr = static_cast<T *>(malloc(num_objects * sizeof(T)));
576
17
      if (!ptr)
577
0
        return nullptr;
578
579
17
      vacants.reserve(num_objects);
580
321
      for (unsigned i = 0; i < num_objects; i++)
581
304
        vacants.push_back(&ptr[i]);
582
583
17
      memory.emplace_back(ptr);
584
17
    }
585
586
613
    T *ptr = vacants.back();
587
613
    vacants.pop_back();
588
613
    new (ptr) T(std::forward<P>(p)...);
589
613
    return ptr;
590
613
  }
spirv_cross::SPIRConstant* spirv_cross::ObjectPool<spirv_cross::SPIRConstant>::allocate<unsigned int&, unsigned int const*, unsigned int, bool>(unsigned int&, unsigned int const*&&, unsigned int&&, bool&&)
Line
Count
Source
571
409
  {
572
409
    if (vacants.empty())
573
0
    {
574
0
      unsigned num_objects = start_object_count << memory.size();
575
0
      T *ptr = static_cast<T *>(malloc(num_objects * sizeof(T)));
576
0
      if (!ptr)
577
0
        return nullptr;
578
579
0
      vacants.reserve(num_objects);
580
0
      for (unsigned i = 0; i < num_objects; i++)
581
0
        vacants.push_back(&ptr[i]);
582
583
0
      memory.emplace_back(ptr);
584
0
    }
585
586
409
    T *ptr = vacants.back();
587
409
    vacants.pop_back();
588
409
    new (ptr) T(std::forward<P>(p)...);
589
409
    return ptr;
590
409
  }
spirv_cross::SPIRConstant* spirv_cross::ObjectPool<spirv_cross::SPIRConstant>::allocate<unsigned int&, spirv_cross::SPIRConstant const* (&) [4], unsigned int&, bool>(unsigned int&, spirv_cross::SPIRConstant const* (&) [4], unsigned int&, bool&&)
Line
Count
Source
571
669
  {
572
669
    if (vacants.empty())
573
12
    {
574
12
      unsigned num_objects = start_object_count << memory.size();
575
12
      T *ptr = static_cast<T *>(malloc(num_objects * sizeof(T)));
576
12
      if (!ptr)
577
0
        return nullptr;
578
579
12
      vacants.reserve(num_objects);
580
396
      for (unsigned i = 0; i < num_objects; i++)
581
384
        vacants.push_back(&ptr[i]);
582
583
12
      memory.emplace_back(ptr);
584
12
    }
585
586
669
    T *ptr = vacants.back();
587
669
    vacants.pop_back();
588
669
    new (ptr) T(std::forward<P>(p)...);
589
669
    return ptr;
590
669
  }
spirv_cross::SPIRFunction* spirv_cross::ObjectPool<spirv_cross::SPIRFunction>::allocate<unsigned int&, unsigned int&>(unsigned int&, unsigned int&)
Line
Count
Source
571
450
  {
572
450
    if (vacants.empty())
573
227
    {
574
227
      unsigned num_objects = start_object_count << memory.size();
575
227
      T *ptr = static_cast<T *>(malloc(num_objects * sizeof(T)));
576
227
      if (!ptr)
577
0
        return nullptr;
578
579
227
      vacants.reserve(num_objects);
580
3.85k
      for (unsigned i = 0; i < num_objects; i++)
581
3.63k
        vacants.push_back(&ptr[i]);
582
583
227
      memory.emplace_back(ptr);
584
227
    }
585
586
450
    T *ptr = vacants.back();
587
450
    vacants.pop_back();
588
450
    new (ptr) T(std::forward<P>(p)...);
589
450
    return ptr;
590
450
  }
spirv_cross::SPIRBlock* spirv_cross::ObjectPool<spirv_cross::SPIRBlock>::allocate<>()
Line
Count
Source
571
9.80k
  {
572
9.80k
    if (vacants.empty())
573
350
    {
574
350
      unsigned num_objects = start_object_count << memory.size();
575
350
      T *ptr = static_cast<T *>(malloc(num_objects * sizeof(T)));
576
350
      if (!ptr)
577
0
        return nullptr;
578
579
350
      vacants.reserve(num_objects);
580
10.9k
      for (unsigned i = 0; i < num_objects; i++)
581
10.5k
        vacants.push_back(&ptr[i]);
582
583
350
      memory.emplace_back(ptr);
584
350
    }
585
586
9.80k
    T *ptr = vacants.back();
587
9.80k
    vacants.pop_back();
588
9.80k
    new (ptr) T(std::forward<P>(p)...);
589
9.80k
    return ptr;
590
9.80k
  }
spirv_cross::SPIRType* spirv_cross::ObjectPool<spirv_cross::SPIRType>::allocate<spv::Op>(spv::Op&&)
Line
Count
Source
571
28
  {
572
28
    if (vacants.empty())
573
2
    {
574
2
      unsigned num_objects = start_object_count << memory.size();
575
2
      T *ptr = static_cast<T *>(malloc(num_objects * sizeof(T)));
576
2
      if (!ptr)
577
0
        return nullptr;
578
579
2
      vacants.reserve(num_objects);
580
66
      for (unsigned i = 0; i < num_objects; i++)
581
64
        vacants.push_back(&ptr[i]);
582
583
2
      memory.emplace_back(ptr);
584
2
    }
585
586
28
    T *ptr = vacants.back();
587
28
    vacants.pop_back();
588
28
    new (ptr) T(std::forward<P>(p)...);
589
28
    return ptr;
590
28
  }
spirv_cross::SPIRConstant* spirv_cross::ObjectPool<spirv_cross::SPIRConstant>::allocate<unsigned int&>(unsigned int&)
Line
Count
Source
571
5.19k
  {
572
5.19k
    if (vacants.empty())
573
85
    {
574
85
      unsigned num_objects = start_object_count << memory.size();
575
85
      T *ptr = static_cast<T *>(malloc(num_objects * sizeof(T)));
576
85
      if (!ptr)
577
0
        return nullptr;
578
579
85
      vacants.reserve(num_objects);
580
6.32k
      for (unsigned i = 0; i < num_objects; i++)
581
6.24k
        vacants.push_back(&ptr[i]);
582
583
85
      memory.emplace_back(ptr);
584
85
    }
585
586
5.19k
    T *ptr = vacants.back();
587
5.19k
    vacants.pop_back();
588
5.19k
    new (ptr) T(std::forward<P>(p)...);
589
5.19k
    return ptr;
590
5.19k
  }
spirv_cross::SPIRConstantOp* spirv_cross::ObjectPool<spirv_cross::SPIRConstantOp>::allocate<unsigned int&, spv::Op&, unsigned int const*, unsigned int>(unsigned int&, spv::Op&, unsigned int const*&&, unsigned int&&)
Line
Count
Source
571
791
  {
572
791
    if (vacants.empty())
573
13
    {
574
13
      unsigned num_objects = start_object_count << memory.size();
575
13
      T *ptr = static_cast<T *>(malloc(num_objects * sizeof(T)));
576
13
      if (!ptr)
577
0
        return nullptr;
578
579
13
      vacants.reserve(num_objects);
580
221
      for (unsigned i = 0; i < num_objects; i++)
581
208
        vacants.push_back(&ptr[i]);
582
583
13
      memory.emplace_back(ptr);
584
13
    }
585
586
791
    T *ptr = vacants.back();
587
791
    vacants.pop_back();
588
791
    new (ptr) T(std::forward<P>(p)...);
589
791
    return ptr;
590
791
  }
spirv_cross::SPIRConstant* spirv_cross::ObjectPool<spirv_cross::SPIRConstant>::allocate<unsigned int&, unsigned int*, unsigned int, bool>(unsigned int&, unsigned int*&&, unsigned int&&, bool&&)
Line
Count
Source
571
1.87k
  {
572
1.87k
    if (vacants.empty())
573
41
    {
574
41
      unsigned num_objects = start_object_count << memory.size();
575
41
      T *ptr = static_cast<T *>(malloc(num_objects * sizeof(T)));
576
41
      if (!ptr)
577
0
        return nullptr;
578
579
41
      vacants.reserve(num_objects);
580
3.11k
      for (unsigned i = 0; i < num_objects; i++)
581
3.07k
        vacants.push_back(&ptr[i]);
582
583
41
      memory.emplace_back(ptr);
584
41
    }
585
586
1.87k
    T *ptr = vacants.back();
587
1.87k
    vacants.pop_back();
588
1.87k
    new (ptr) T(std::forward<P>(p)...);
589
1.87k
    return ptr;
590
1.87k
  }
591
592
  void deallocate(T *ptr)
593
64.5k
  {
594
64.5k
    ptr->~T();
595
64.5k
    vacants.push_back(ptr);
596
64.5k
  }
spirv_cross::ObjectPool<spirv_cross::SPIRType>::deallocate(spirv_cross::SPIRType*)
Line
Count
Source
593
22.2k
  {
594
22.2k
    ptr->~T();
595
22.2k
    vacants.push_back(ptr);
596
22.2k
  }
spirv_cross::ObjectPool<spirv_cross::SPIRVariable>::deallocate(spirv_cross::SPIRVariable*)
Line
Count
Source
593
9.50k
  {
594
9.50k
    ptr->~T();
595
9.50k
    vacants.push_back(ptr);
596
9.50k
  }
spirv_cross::ObjectPool<spirv_cross::SPIRConstant>::deallocate(spirv_cross::SPIRConstant*)
Line
Count
Source
593
12.6k
  {
594
12.6k
    ptr->~T();
595
12.6k
    vacants.push_back(ptr);
596
12.6k
  }
spirv_cross::ObjectPool<spirv_cross::SPIRFunction>::deallocate(spirv_cross::SPIRFunction*)
Line
Count
Source
593
450
  {
594
450
    ptr->~T();
595
450
    vacants.push_back(ptr);
596
450
  }
spirv_cross::ObjectPool<spirv_cross::SPIRFunctionPrototype>::deallocate(spirv_cross::SPIRFunctionPrototype*)
Line
Count
Source
593
5.83k
  {
594
5.83k
    ptr->~T();
595
5.83k
    vacants.push_back(ptr);
596
5.83k
  }
spirv_cross::ObjectPool<spirv_cross::SPIRBlock>::deallocate(spirv_cross::SPIRBlock*)
Line
Count
Source
593
9.80k
  {
594
9.80k
    ptr->~T();
595
9.80k
    vacants.push_back(ptr);
596
9.80k
  }
spirv_cross::ObjectPool<spirv_cross::SPIRExtension>::deallocate(spirv_cross::SPIRExtension*)
Line
Count
Source
593
508
  {
594
508
    ptr->~T();
595
508
    vacants.push_back(ptr);
596
508
  }
Unexecuted instantiation: spirv_cross::ObjectPool<spirv_cross::SPIRExpression>::deallocate(spirv_cross::SPIRExpression*)
spirv_cross::ObjectPool<spirv_cross::SPIRConstantOp>::deallocate(spirv_cross::SPIRConstantOp*)
Line
Count
Source
593
791
  {
594
791
    ptr->~T();
595
791
    vacants.push_back(ptr);
596
791
  }
Unexecuted instantiation: spirv_cross::ObjectPool<spirv_cross::SPIRCombinedImageSampler>::deallocate(spirv_cross::SPIRCombinedImageSampler*)
Unexecuted instantiation: spirv_cross::ObjectPool<spirv_cross::SPIRAccessChain>::deallocate(spirv_cross::SPIRAccessChain*)
spirv_cross::ObjectPool<spirv_cross::SPIRUndef>::deallocate(spirv_cross::SPIRUndef*)
Line
Count
Source
593
1.81k
  {
594
1.81k
    ptr->~T();
595
1.81k
    vacants.push_back(ptr);
596
1.81k
  }
spirv_cross::ObjectPool<spirv_cross::SPIRString>::deallocate(spirv_cross::SPIRString*)
Line
Count
Source
593
886
  {
594
886
    ptr->~T();
595
886
    vacants.push_back(ptr);
596
886
  }
597
598
  void deallocate_opaque(void *ptr) override
599
64.5k
  {
600
64.5k
    deallocate(static_cast<T *>(ptr));
601
64.5k
  }
spirv_cross::ObjectPool<spirv_cross::SPIRType>::deallocate_opaque(void*)
Line
Count
Source
599
22.2k
  {
600
22.2k
    deallocate(static_cast<T *>(ptr));
601
22.2k
  }
spirv_cross::ObjectPool<spirv_cross::SPIRVariable>::deallocate_opaque(void*)
Line
Count
Source
599
9.50k
  {
600
9.50k
    deallocate(static_cast<T *>(ptr));
601
9.50k
  }
spirv_cross::ObjectPool<spirv_cross::SPIRConstant>::deallocate_opaque(void*)
Line
Count
Source
599
12.6k
  {
600
12.6k
    deallocate(static_cast<T *>(ptr));
601
12.6k
  }
spirv_cross::ObjectPool<spirv_cross::SPIRFunction>::deallocate_opaque(void*)
Line
Count
Source
599
450
  {
600
450
    deallocate(static_cast<T *>(ptr));
601
450
  }
spirv_cross::ObjectPool<spirv_cross::SPIRFunctionPrototype>::deallocate_opaque(void*)
Line
Count
Source
599
5.83k
  {
600
5.83k
    deallocate(static_cast<T *>(ptr));
601
5.83k
  }
spirv_cross::ObjectPool<spirv_cross::SPIRBlock>::deallocate_opaque(void*)
Line
Count
Source
599
9.80k
  {
600
9.80k
    deallocate(static_cast<T *>(ptr));
601
9.80k
  }
spirv_cross::ObjectPool<spirv_cross::SPIRExtension>::deallocate_opaque(void*)
Line
Count
Source
599
508
  {
600
508
    deallocate(static_cast<T *>(ptr));
601
508
  }
Unexecuted instantiation: spirv_cross::ObjectPool<spirv_cross::SPIRExpression>::deallocate_opaque(void*)
spirv_cross::ObjectPool<spirv_cross::SPIRConstantOp>::deallocate_opaque(void*)
Line
Count
Source
599
791
  {
600
791
    deallocate(static_cast<T *>(ptr));
601
791
  }
Unexecuted instantiation: spirv_cross::ObjectPool<spirv_cross::SPIRCombinedImageSampler>::deallocate_opaque(void*)
Unexecuted instantiation: spirv_cross::ObjectPool<spirv_cross::SPIRAccessChain>::deallocate_opaque(void*)
spirv_cross::ObjectPool<spirv_cross::SPIRUndef>::deallocate_opaque(void*)
Line
Count
Source
599
1.81k
  {
600
1.81k
    deallocate(static_cast<T *>(ptr));
601
1.81k
  }
spirv_cross::ObjectPool<spirv_cross::SPIRString>::deallocate_opaque(void*)
Line
Count
Source
599
886
  {
600
886
    deallocate(static_cast<T *>(ptr));
601
886
  }
602
603
  void clear()
604
  {
605
    vacants.clear();
606
    memory.clear();
607
  }
608
609
protected:
610
  Vector<T *> vacants;
611
612
  struct MallocDeleter
613
  {
614
    void operator()(T *ptr)
615
2.45k
    {
616
2.45k
      ::free(ptr);
617
2.45k
    }
spirv_cross::ObjectPool<spirv_cross::SPIRUndef>::MallocDeleter::operator()(spirv_cross::SPIRUndef*)
Line
Count
Source
615
71
    {
616
71
      ::free(ptr);
617
71
    }
spirv_cross::ObjectPool<spirv_cross::SPIRString>::MallocDeleter::operator()(spirv_cross::SPIRString*)
Line
Count
Source
615
4
    {
616
4
      ::free(ptr);
617
4
    }
Unexecuted instantiation: spirv_cross::ObjectPool<spirv_cross::SPIRCombinedImageSampler>::MallocDeleter::operator()(spirv_cross::SPIRCombinedImageSampler*)
spirv_cross::ObjectPool<spirv_cross::SPIRConstantOp>::MallocDeleter::operator()(spirv_cross::SPIRConstantOp*)
Line
Count
Source
615
13
    {
616
13
      ::free(ptr);
617
13
    }
spirv_cross::ObjectPool<spirv_cross::SPIRType>::MallocDeleter::operator()(spirv_cross::SPIRType*)
Line
Count
Source
615
442
    {
616
442
      ::free(ptr);
617
442
    }
spirv_cross::ObjectPool<spirv_cross::SPIRExtension>::MallocDeleter::operator()(spirv_cross::SPIRExtension*)
Line
Count
Source
615
284
    {
616
284
      ::free(ptr);
617
284
    }
Unexecuted instantiation: spirv_cross::ObjectPool<spirv_cross::SPIRExpression>::MallocDeleter::operator()(spirv_cross::SPIRExpression*)
spirv_cross::ObjectPool<spirv_cross::SPIRFunctionPrototype>::MallocDeleter::operator()(spirv_cross::SPIRFunctionPrototype*)
Line
Count
Source
615
268
    {
616
268
      ::free(ptr);
617
268
    }
spirv_cross::ObjectPool<spirv_cross::SPIRBlock>::MallocDeleter::operator()(spirv_cross::SPIRBlock*)
Line
Count
Source
615
350
    {
616
350
      ::free(ptr);
617
350
    }
spirv_cross::ObjectPool<spirv_cross::SPIRFunction>::MallocDeleter::operator()(spirv_cross::SPIRFunction*)
Line
Count
Source
615
227
    {
616
227
      ::free(ptr);
617
227
    }
Unexecuted instantiation: spirv_cross::ObjectPool<spirv_cross::SPIRAccessChain>::MallocDeleter::operator()(spirv_cross::SPIRAccessChain*)
spirv_cross::ObjectPool<spirv_cross::SPIRVariable>::MallocDeleter::operator()(spirv_cross::SPIRVariable*)
Line
Count
Source
615
333
    {
616
333
      ::free(ptr);
617
333
    }
spirv_cross::ObjectPool<spirv_cross::SPIRConstant>::MallocDeleter::operator()(spirv_cross::SPIRConstant*)
Line
Count
Source
615
466
    {
616
466
      ::free(ptr);
617
466
    }
618
  };
619
620
  SmallVector<std::unique_ptr<T, MallocDeleter>> memory;
621
  unsigned start_object_count;
622
};
623
624
template <size_t StackSize = 4096, size_t BlockSize = 4096>
625
class StringStream
626
{
627
public:
628
  StringStream()
629
  {
630
    reset();
631
  }
632
633
  ~StringStream()
634
  {
635
    reset();
636
  }
637
638
  // Disable copies and moves. Makes it easier to implement, and we don't need it.
639
  StringStream(const StringStream &) = delete;
640
  void operator=(const StringStream &) = delete;
641
642
  template <typename T, typename std::enable_if<!std::is_floating_point<T>::value, int>::type = 0>
643
  StringStream &operator<<(const T &t)
644
  {
645
    auto s = std::to_string(t);
646
    append(s.data(), s.size());
647
    return *this;
648
  }
649
650
  // Only overload this to make float/double conversions ambiguous.
651
  StringStream &operator<<(uint32_t v)
652
  {
653
    auto s = std::to_string(v);
654
    append(s.data(), s.size());
655
    return *this;
656
  }
657
658
  StringStream &operator<<(char c)
659
  {
660
    append(&c, 1);
661
    return *this;
662
  }
663
664
  StringStream &operator<<(const std::string &s)
665
0
  {
666
0
    append(s.data(), s.size());
667
0
    return *this;
668
0
  }
669
670
  StringStream &operator<<(const char *s)
671
0
  {
672
0
    append(s, strlen(s));
673
0
    return *this;
674
0
  }
675
676
  template <size_t N>
677
  StringStream &operator<<(const char (&s)[N])
678
  {
679
    append(s, strlen(s));
680
    return *this;
681
  }
682
683
  std::string str() const
684
0
  {
685
0
    std::string ret;
686
0
    size_t target_size = 0;
687
0
    for (auto &saved : saved_buffers)
688
0
      target_size += saved.offset;
689
0
    target_size += current_buffer.offset;
690
0
    ret.reserve(target_size);
691
0
692
0
    for (auto &saved : saved_buffers)
693
0
      ret.insert(ret.end(), saved.buffer, saved.buffer + saved.offset);
694
0
    ret.insert(ret.end(), current_buffer.buffer, current_buffer.buffer + current_buffer.offset);
695
0
    return ret;
696
0
  }
697
698
  void reset()
699
0
  {
700
0
    for (auto &saved : saved_buffers)
701
0
      if (saved.buffer != stack_buffer)
702
0
        free(saved.buffer);
703
0
    if (current_buffer.buffer != stack_buffer)
704
0
      free(current_buffer.buffer);
705
0
706
0
    saved_buffers.clear();
707
0
    current_buffer.buffer = stack_buffer;
708
0
    current_buffer.offset = 0;
709
0
    current_buffer.size = sizeof(stack_buffer);
710
0
  }
711
712
private:
713
  struct Buffer
714
  {
715
    char *buffer = nullptr;
716
    size_t offset = 0;
717
    size_t size = 0;
718
  };
719
  Buffer current_buffer;
720
  char stack_buffer[StackSize];
721
  SmallVector<Buffer> saved_buffers;
722
723
  void append(const char *s, size_t len)
724
0
  {
725
0
    size_t avail = current_buffer.size - current_buffer.offset;
726
0
    if (avail < len)
727
0
    {
728
0
      if (avail > 0)
729
0
      {
730
0
        memcpy(current_buffer.buffer + current_buffer.offset, s, avail);
731
0
        s += avail;
732
0
        len -= avail;
733
0
        current_buffer.offset += avail;
734
0
      }
735
0
736
0
      saved_buffers.push_back(current_buffer);
737
0
      size_t target_size = len > BlockSize ? len : BlockSize;
738
0
      current_buffer.buffer = static_cast<char *>(malloc(target_size));
739
0
      if (!current_buffer.buffer)
740
0
        SPIRV_CROSS_THROW("Out of memory.");
741
0
742
0
      memcpy(current_buffer.buffer, s, len);
743
0
      current_buffer.offset = len;
744
0
      current_buffer.size = target_size;
745
0
    }
746
0
    else
747
0
    {
748
0
      memcpy(current_buffer.buffer + current_buffer.offset, s, len);
749
0
      current_buffer.offset += len;
750
0
    }
751
0
  }
752
};
753
754
} // namespace SPIRV_CROSS_NAMESPACE
755
756
#endif