Coverage Report

Created: 2026-09-03 06:30

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/proc/self/cwd/common/values/map_value_variant.h
Line
Count
Source
1
// Copyright 2025 Google LLC
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
//     https://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14
15
#ifndef THIRD_PARTY_CEL_CPP_COMMON_VALUES_MAP_VALUE_VARIANT_H_
16
#define THIRD_PARTY_CEL_CPP_COMMON_VALUES_MAP_VALUE_VARIANT_H_
17
18
#include <cstddef>
19
#include <cstdint>
20
#include <type_traits>
21
22
#include "absl/base/attributes.h"
23
#include "absl/base/nullability.h"
24
#include "absl/log/absl_check.h"
25
#include "absl/meta/type_traits.h"
26
#include "absl/utility/utility.h"
27
#include "common/values/custom_map_value.h"
28
#include "common/values/legacy_map_value.h"
29
#include "common/values/parsed_json_map_value.h"
30
#include "common/values/parsed_map_field_value.h"
31
32
namespace cel::common_internal {
33
34
enum class MapValueIndex : uint16_t {
35
  kCustom = 0,
36
  kParsedField,
37
  kParsedJson,
38
  kLegacy,
39
};
40
41
template <typename T>
42
struct MapValueAlternative;
43
44
template <>
45
struct MapValueAlternative<CustomMapValue> {
46
  static constexpr MapValueIndex kIndex = MapValueIndex::kCustom;
47
};
48
49
template <>
50
struct MapValueAlternative<ParsedMapFieldValue> {
51
  static constexpr MapValueIndex kIndex = MapValueIndex::kParsedField;
52
};
53
54
template <>
55
struct MapValueAlternative<ParsedJsonMapValue> {
56
  static constexpr MapValueIndex kIndex = MapValueIndex::kParsedJson;
57
};
58
59
template <>
60
struct MapValueAlternative<LegacyMapValue> {
61
  static constexpr MapValueIndex kIndex = MapValueIndex::kLegacy;
62
};
63
64
template <typename T, typename = void>
65
struct IsMapValueAlternative : std::false_type {};
66
67
template <typename T>
68
struct IsMapValueAlternative<T, std::void_t<decltype(MapValueAlternative<T>{})>>
69
    : std::true_type {};
70
71
template <typename T>
72
inline constexpr bool IsMapValueAlternativeV = IsMapValueAlternative<T>::value;
73
74
inline constexpr size_t kMapValueVariantAlign = 8;
75
inline constexpr size_t kMapValueVariantSize = 24;
76
77
// MapValueVariant is a subset of alternatives from the main ValueVariant that
78
// is only maps. It is not stored directly in ValueVariant.
79
class alignas(kMapValueVariantAlign) MapValueVariant final {
80
 public:
81
412k
  MapValueVariant() : MapValueVariant(absl::in_place_type<CustomMapValue>) {}
82
83
  MapValueVariant(const MapValueVariant&) = default;
84
  MapValueVariant(MapValueVariant&&) = default;
85
  MapValueVariant& operator=(const MapValueVariant&) = default;
86
  MapValueVariant& operator=(MapValueVariant&&) = default;
87
88
  template <typename T, typename... Args>
89
  explicit MapValueVariant(absl::in_place_type_t<T>, Args&&... args)
90
1.05M
      : index_(MapValueAlternative<T>::kIndex) {
91
1.05M
    static_assert(alignof(T) <= kMapValueVariantAlign);
92
1.05M
    static_assert(sizeof(T) <= kMapValueVariantSize);
93
1.05M
    static_assert(std::is_trivially_copyable_v<T>);
94
95
1.05M
    ::new (static_cast<void*>(&raw_[0])) T(std::forward<Args>(args)...);
96
1.05M
  }
cel::common_internal::MapValueVariant::MapValueVariant<cel::CustomMapValue>(std::__1::in_place_type_t<cel::CustomMapValue>)
Line
Count
Source
90
412k
      : index_(MapValueAlternative<T>::kIndex) {
91
412k
    static_assert(alignof(T) <= kMapValueVariantAlign);
92
412k
    static_assert(sizeof(T) <= kMapValueVariantSize);
93
412k
    static_assert(std::is_trivially_copyable_v<T>);
94
95
412k
    ::new (static_cast<void*>(&raw_[0])) T(std::forward<Args>(args)...);
96
412k
  }
cel::common_internal::MapValueVariant::MapValueVariant<cel::CustomMapValue, cel::CustomMapValue const&>(std::__1::in_place_type_t<cel::CustomMapValue>, cel::CustomMapValue const&)
Line
Count
Source
90
354k
      : index_(MapValueAlternative<T>::kIndex) {
91
354k
    static_assert(alignof(T) <= kMapValueVariantAlign);
92
354k
    static_assert(sizeof(T) <= kMapValueVariantSize);
93
354k
    static_assert(std::is_trivially_copyable_v<T>);
94
95
354k
    ::new (static_cast<void*>(&raw_[0])) T(std::forward<Args>(args)...);
96
354k
  }
Unexecuted instantiation: cel::common_internal::MapValueVariant::MapValueVariant<cel::common_internal::LegacyMapValue, cel::common_internal::LegacyMapValue const&>(std::__1::in_place_type_t<cel::common_internal::LegacyMapValue>, cel::common_internal::LegacyMapValue const&)
cel::common_internal::MapValueVariant::MapValueVariant<cel::ParsedJsonMapValue, cel::ParsedJsonMapValue const&>(std::__1::in_place_type_t<cel::ParsedJsonMapValue>, cel::ParsedJsonMapValue const&)
Line
Count
Source
90
24.5k
      : index_(MapValueAlternative<T>::kIndex) {
91
24.5k
    static_assert(alignof(T) <= kMapValueVariantAlign);
92
24.5k
    static_assert(sizeof(T) <= kMapValueVariantSize);
93
24.5k
    static_assert(std::is_trivially_copyable_v<T>);
94
95
24.5k
    ::new (static_cast<void*>(&raw_[0])) T(std::forward<Args>(args)...);
96
24.5k
  }
Unexecuted instantiation: cel::common_internal::MapValueVariant::MapValueVariant<cel::ParsedMapFieldValue, cel::ParsedMapFieldValue const&>(std::__1::in_place_type_t<cel::ParsedMapFieldValue>, cel::ParsedMapFieldValue const&)
cel::common_internal::MapValueVariant::MapValueVariant<cel::CustomMapValue, cel::CustomMapValue>(std::__1::in_place_type_t<cel::CustomMapValue>, cel::CustomMapValue&&)
Line
Count
Source
90
260k
      : index_(MapValueAlternative<T>::kIndex) {
91
260k
    static_assert(alignof(T) <= kMapValueVariantAlign);
92
260k
    static_assert(sizeof(T) <= kMapValueVariantSize);
93
260k
    static_assert(std::is_trivially_copyable_v<T>);
94
95
260k
    ::new (static_cast<void*>(&raw_[0])) T(std::forward<Args>(args)...);
96
260k
  }
Unexecuted instantiation: cel::common_internal::MapValueVariant::MapValueVariant<cel::common_internal::LegacyMapValue, cel::common_internal::LegacyMapValue>(std::__1::in_place_type_t<cel::common_internal::LegacyMapValue>, cel::common_internal::LegacyMapValue&&)
Unexecuted instantiation: cel::common_internal::MapValueVariant::MapValueVariant<cel::ParsedJsonMapValue, cel::ParsedJsonMapValue>(std::__1::in_place_type_t<cel::ParsedJsonMapValue>, cel::ParsedJsonMapValue&&)
Unexecuted instantiation: cel::common_internal::MapValueVariant::MapValueVariant<cel::ParsedMapFieldValue, cel::ParsedMapFieldValue>(std::__1::in_place_type_t<cel::ParsedMapFieldValue>, cel::ParsedMapFieldValue&&)
97
98
  template <typename T, typename = std::enable_if_t<
99
                            IsMapValueAlternativeV<absl::remove_cvref_t<T>>>>
100
  explicit MapValueVariant(T&& value)
101
      : MapValueVariant(absl::in_place_type<absl::remove_cvref_t<T>>,
102
                        std::forward<T>(value)) {}
103
104
  template <typename T>
105
  void Assign(T&& value) {
106
    using U = absl::remove_cvref_t<T>;
107
108
    static_assert(alignof(U) <= kMapValueVariantAlign);
109
    static_assert(sizeof(U) <= kMapValueVariantSize);
110
    static_assert(std::is_trivially_copyable_v<U>);
111
112
    index_ = MapValueAlternative<U>::kIndex;
113
    ::new (static_cast<void*>(&raw_[0])) U(std::forward<T>(value));
114
  }
115
116
  template <typename T>
117
0
  bool Is() const {
118
0
    return index_ == MapValueAlternative<T>::kIndex;
119
0
  }
Unexecuted instantiation: bool cel::common_internal::MapValueVariant::Is<cel::CustomMapValue>() const
Unexecuted instantiation: bool cel::common_internal::MapValueVariant::Is<cel::ParsedMapFieldValue>() const
Unexecuted instantiation: bool cel::common_internal::MapValueVariant::Is<cel::ParsedJsonMapValue>() const
Unexecuted instantiation: bool cel::common_internal::MapValueVariant::Is<cel::common_internal::LegacyMapValue>() const
120
121
  template <typename T>
122
      T& Get() & ABSL_ATTRIBUTE_LIFETIME_BOUND {
123
    ABSL_DCHECK(Is<T>());
124
125
    return *At<T>();
126
  }
127
128
  template <typename T>
129
1.26M
  const T& Get() const& ABSL_ATTRIBUTE_LIFETIME_BOUND {
130
1.26M
    ABSL_DCHECK(Is<T>());
131
132
1.26M
    return *At<T>();
133
1.26M
  }
Unexecuted instantiation: cel::ParsedMapFieldValue const& cel::common_internal::MapValueVariant::Get<cel::ParsedMapFieldValue>() const &
cel::ParsedJsonMapValue const& cel::common_internal::MapValueVariant::Get<cel::ParsedJsonMapValue>() const &
Line
Count
Source
129
65.9k
  const T& Get() const& ABSL_ATTRIBUTE_LIFETIME_BOUND {
130
65.9k
    ABSL_DCHECK(Is<T>());
131
132
65.9k
    return *At<T>();
133
65.9k
  }
Unexecuted instantiation: cel::common_internal::LegacyMapValue const& cel::common_internal::MapValueVariant::Get<cel::common_internal::LegacyMapValue>() const &
cel::CustomMapValue const& cel::common_internal::MapValueVariant::Get<cel::CustomMapValue>() const &
Line
Count
Source
129
1.19M
  const T& Get() const& ABSL_ATTRIBUTE_LIFETIME_BOUND {
130
1.19M
    ABSL_DCHECK(Is<T>());
131
132
1.19M
    return *At<T>();
133
1.19M
  }
134
135
  template <typename T>
136
0
      T&& Get() && ABSL_ATTRIBUTE_LIFETIME_BOUND {
137
0
    ABSL_DCHECK(Is<T>());
138
139
0
    return std::move(*At<T>());
140
0
  }
141
142
  template <typename T>
143
  const T&& Get() const&& ABSL_ATTRIBUTE_LIFETIME_BOUND {
144
    ABSL_DCHECK(Is<T>());
145
146
    return std::move(*At<T>());
147
  }
148
149
  template <typename T>
150
0
  T* absl_nullable As() ABSL_ATTRIBUTE_LIFETIME_BOUND {
151
0
    if (Is<T>()) {
152
0
      return At<T>();
153
0
    }
154
0
    return nullptr;
155
0
  }
156
157
  template <typename T>
158
0
  const T* absl_nullable As() const ABSL_ATTRIBUTE_LIFETIME_BOUND {
159
0
    if (Is<T>()) {
160
0
      return At<T>();
161
0
    }
162
0
    return nullptr;
163
0
  }
164
165
  template <typename Visitor>
166
1.26M
  decltype(auto) Visit(Visitor&& visitor) const {
167
1.26M
    switch (index_) {
168
1.19M
      case MapValueIndex::kCustom:
169
1.19M
        return std::forward<Visitor>(visitor)(Get<CustomMapValue>());
170
0
      case MapValueIndex::kParsedField:
171
0
        return std::forward<Visitor>(visitor)(Get<ParsedMapFieldValue>());
172
65.9k
      case MapValueIndex::kParsedJson:
173
65.9k
        return std::forward<Visitor>(visitor)(Get<ParsedJsonMapValue>());
174
0
      case MapValueIndex::kLegacy:
175
0
        return std::forward<Visitor>(visitor)(Get<LegacyMapValue>());
176
1.26M
    }
177
1.26M
  }
Unexecuted instantiation: map_value.cc:decltype(auto) cel::common_internal::MapValueVariant::Visit<cel::MapValue::GetTypeId() const::$_0>(cel::MapValue::GetTypeId() const::$_0&&) const
Unexecuted instantiation: map_value.cc:decltype(auto) cel::common_internal::MapValueVariant::Visit<cel::MapValue::DebugString() const::$_0>(cel::MapValue::DebugString() const::$_0&&) const
Unexecuted instantiation: map_value.cc:decltype(auto) cel::common_internal::MapValueVariant::Visit<cel::MapValue::SerializeTo(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::io::ZeroCopyOutputStream*) const::$_0>(cel::MapValue::SerializeTo(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::io::ZeroCopyOutputStream*) const::$_0&&) const
Unexecuted instantiation: map_value.cc:decltype(auto) cel::common_internal::MapValueVariant::Visit<cel::MapValue::ConvertToJson(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0>(cel::MapValue::ConvertToJson(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0&&) const
Unexecuted instantiation: map_value.cc:decltype(auto) cel::common_internal::MapValueVariant::Visit<cel::MapValue::ConvertToJsonObject(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0>(cel::MapValue::ConvertToJsonObject(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0&&) const
Unexecuted instantiation: map_value.cc:decltype(auto) cel::common_internal::MapValueVariant::Visit<cel::MapValue::Equal(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0>(cel::MapValue::Equal(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0&&) const
Unexecuted instantiation: map_value.cc:decltype(auto) cel::common_internal::MapValueVariant::Visit<cel::MapValue::IsZeroValue() const::$_0>(cel::MapValue::IsZeroValue() const::$_0&&) const
Unexecuted instantiation: map_value.cc:decltype(auto) cel::common_internal::MapValueVariant::Visit<cel::MapValue::IsEmpty() const::$_0>(cel::MapValue::IsEmpty() const::$_0&&) const
map_value.cc:decltype(auto) cel::common_internal::MapValueVariant::Visit<cel::MapValue::Size() const::$_0>(cel::MapValue::Size() const::$_0&&) const
Line
Count
Source
166
30.4k
  decltype(auto) Visit(Visitor&& visitor) const {
167
30.4k
    switch (index_) {
168
30.0k
      case MapValueIndex::kCustom:
169
30.0k
        return std::forward<Visitor>(visitor)(Get<CustomMapValue>());
170
0
      case MapValueIndex::kParsedField:
171
0
        return std::forward<Visitor>(visitor)(Get<ParsedMapFieldValue>());
172
470
      case MapValueIndex::kParsedJson:
173
470
        return std::forward<Visitor>(visitor)(Get<ParsedJsonMapValue>());
174
0
      case MapValueIndex::kLegacy:
175
0
        return std::forward<Visitor>(visitor)(Get<LegacyMapValue>());
176
30.4k
    }
177
30.4k
  }
map_value.cc:decltype(auto) cel::common_internal::MapValueVariant::Visit<cel::MapValue::Get(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0>(cel::MapValue::Get(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0&&) const
Line
Count
Source
166
37.0k
  decltype(auto) Visit(Visitor&& visitor) const {
167
37.0k
    switch (index_) {
168
35.8k
      case MapValueIndex::kCustom:
169
35.8k
        return std::forward<Visitor>(visitor)(Get<CustomMapValue>());
170
0
      case MapValueIndex::kParsedField:
171
0
        return std::forward<Visitor>(visitor)(Get<ParsedMapFieldValue>());
172
1.21k
      case MapValueIndex::kParsedJson:
173
1.21k
        return std::forward<Visitor>(visitor)(Get<ParsedJsonMapValue>());
174
0
      case MapValueIndex::kLegacy:
175
0
        return std::forward<Visitor>(visitor)(Get<LegacyMapValue>());
176
37.0k
    }
177
37.0k
  }
map_value.cc:decltype(auto) cel::common_internal::MapValueVariant::Visit<cel::MapValue::Find(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0>(cel::MapValue::Find(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0&&) const
Line
Count
Source
166
497k
  decltype(auto) Visit(Visitor&& visitor) const {
167
497k
    switch (index_) {
168
435k
      case MapValueIndex::kCustom:
169
435k
        return std::forward<Visitor>(visitor)(Get<CustomMapValue>());
170
0
      case MapValueIndex::kParsedField:
171
0
        return std::forward<Visitor>(visitor)(Get<ParsedMapFieldValue>());
172
62.3k
      case MapValueIndex::kParsedJson:
173
62.3k
        return std::forward<Visitor>(visitor)(Get<ParsedJsonMapValue>());
174
0
      case MapValueIndex::kLegacy:
175
0
        return std::forward<Visitor>(visitor)(Get<LegacyMapValue>());
176
497k
    }
177
497k
  }
map_value.cc:decltype(auto) cel::common_internal::MapValueVariant::Visit<cel::MapValue::Has(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0>(cel::MapValue::Has(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0&&) const
Line
Count
Source
166
9.43k
  decltype(auto) Visit(Visitor&& visitor) const {
167
9.43k
    switch (index_) {
168
8.14k
      case MapValueIndex::kCustom:
169
8.14k
        return std::forward<Visitor>(visitor)(Get<CustomMapValue>());
170
0
      case MapValueIndex::kParsedField:
171
0
        return std::forward<Visitor>(visitor)(Get<ParsedMapFieldValue>());
172
1.29k
      case MapValueIndex::kParsedJson:
173
1.29k
        return std::forward<Visitor>(visitor)(Get<ParsedJsonMapValue>());
174
0
      case MapValueIndex::kLegacy:
175
0
        return std::forward<Visitor>(visitor)(Get<LegacyMapValue>());
176
9.43k
    }
177
9.43k
  }
Unexecuted instantiation: map_value.cc:decltype(auto) cel::common_internal::MapValueVariant::Visit<cel::MapValue::ListKeys(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::ListValue*) const::$_0>(cel::MapValue::ListKeys(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::ListValue*) const::$_0&&) const
Unexecuted instantiation: map_value.cc:decltype(auto) cel::common_internal::MapValueVariant::Visit<cel::MapValue::ForEach(absl::lts_20260526::FunctionRef<absl::lts_20260526::StatusOr<bool> (cel::Value const&, cel::Value const&)>, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*) const::$_0>(cel::MapValue::ForEach(absl::lts_20260526::FunctionRef<absl::lts_20260526::StatusOr<bool> (cel::Value const&, cel::Value const&)>, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*) const::$_0&&) const
map_value.cc:decltype(auto) cel::common_internal::MapValueVariant::Visit<cel::MapValue::NewIterator() const::$_0>(cel::MapValue::NewIterator() const::$_0&&) const
Line
Count
Source
166
13.9k
  decltype(auto) Visit(Visitor&& visitor) const {
167
13.9k
    switch (index_) {
168
13.3k
      case MapValueIndex::kCustom:
169
13.3k
        return std::forward<Visitor>(visitor)(Get<CustomMapValue>());
170
0
      case MapValueIndex::kParsedField:
171
0
        return std::forward<Visitor>(visitor)(Get<ParsedMapFieldValue>());
172
589
      case MapValueIndex::kParsedJson:
173
589
        return std::forward<Visitor>(visitor)(Get<ParsedJsonMapValue>());
174
0
      case MapValueIndex::kLegacy:
175
0
        return std::forward<Visitor>(visitor)(Get<LegacyMapValue>());
176
13.9k
    }
177
13.9k
  }
Unexecuted instantiation: map_value.cc:decltype(auto) cel::common_internal::MapValueVariant::Visit<cel::MapValue::ToValueVariant() const &::$_0>(cel::MapValue::ToValueVariant() const &::$_0&&) const
map_value.cc:decltype(auto) cel::common_internal::MapValueVariant::Visit<cel::MapValue::ToValueVariant() &&::$_0>(cel::MapValue::ToValueVariant() &&::$_0&&) const
Line
Count
Source
166
672k
  decltype(auto) Visit(Visitor&& visitor) const {
167
672k
    switch (index_) {
168
672k
      case MapValueIndex::kCustom:
169
672k
        return std::forward<Visitor>(visitor)(Get<CustomMapValue>());
170
0
      case MapValueIndex::kParsedField:
171
0
        return std::forward<Visitor>(visitor)(Get<ParsedMapFieldValue>());
172
0
      case MapValueIndex::kParsedJson:
173
0
        return std::forward<Visitor>(visitor)(Get<ParsedJsonMapValue>());
174
0
      case MapValueIndex::kLegacy:
175
0
        return std::forward<Visitor>(visitor)(Get<LegacyMapValue>());
176
672k
    }
177
672k
  }
178
179
0
  friend void swap(MapValueVariant& lhs, MapValueVariant& rhs) noexcept {
180
0
    using std::swap;
181
0
    swap(lhs.index_, rhs.index_);
182
0
    swap(lhs.raw_, rhs.raw_);
183
0
  }
184
185
 private:
186
  template <typename T>
187
  ABSL_ATTRIBUTE_ALWAYS_INLINE T* absl_nonnull At()
188
0
      ABSL_ATTRIBUTE_LIFETIME_BOUND {
189
0
    static_assert(alignof(T) <= kMapValueVariantAlign);
190
0
    static_assert(sizeof(T) <= kMapValueVariantSize);
191
0
    static_assert(std::is_trivially_copyable_v<T>);
192
193
0
    return std::launder(reinterpret_cast<T*>(&raw_[0]));
194
0
  }
195
196
  template <typename T>
197
  ABSL_ATTRIBUTE_ALWAYS_INLINE const T* absl_nonnull At() const
198
1.26M
      ABSL_ATTRIBUTE_LIFETIME_BOUND {
199
1.26M
    static_assert(alignof(T) <= kMapValueVariantAlign);
200
1.26M
    static_assert(sizeof(T) <= kMapValueVariantSize);
201
1.26M
    static_assert(std::is_trivially_copyable_v<T>);
202
203
1.26M
    return std::launder(reinterpret_cast<const T*>(&raw_[0]));
204
1.26M
  }
Unexecuted instantiation: cel::ParsedMapFieldValue const* cel::common_internal::MapValueVariant::At<cel::ParsedMapFieldValue>() const
cel::ParsedJsonMapValue const* cel::common_internal::MapValueVariant::At<cel::ParsedJsonMapValue>() const
Line
Count
Source
198
65.9k
      ABSL_ATTRIBUTE_LIFETIME_BOUND {
199
65.9k
    static_assert(alignof(T) <= kMapValueVariantAlign);
200
65.9k
    static_assert(sizeof(T) <= kMapValueVariantSize);
201
65.9k
    static_assert(std::is_trivially_copyable_v<T>);
202
203
65.9k
    return std::launder(reinterpret_cast<const T*>(&raw_[0]));
204
65.9k
  }
Unexecuted instantiation: cel::common_internal::LegacyMapValue const* cel::common_internal::MapValueVariant::At<cel::common_internal::LegacyMapValue>() const
cel::CustomMapValue const* cel::common_internal::MapValueVariant::At<cel::CustomMapValue>() const
Line
Count
Source
198
1.19M
      ABSL_ATTRIBUTE_LIFETIME_BOUND {
199
1.19M
    static_assert(alignof(T) <= kMapValueVariantAlign);
200
1.19M
    static_assert(sizeof(T) <= kMapValueVariantSize);
201
1.19M
    static_assert(std::is_trivially_copyable_v<T>);
202
203
1.19M
    return std::launder(reinterpret_cast<const T*>(&raw_[0]));
204
1.19M
  }
205
206
  MapValueIndex index_ = MapValueIndex::kCustom;
207
  alignas(8) std::byte raw_[kMapValueVariantSize];
208
};
209
210
}  // namespace cel::common_internal
211
212
#endif  // THIRD_PARTY_CEL_CPP_COMMON_VALUES_MAP_VALUE_VARIANT_H_