Coverage Report

Created: 2026-07-16 06:29

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
120k
  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
842k
      : index_(MapValueAlternative<T>::kIndex) {
91
842k
    static_assert(alignof(T) <= kMapValueVariantAlign);
92
842k
    static_assert(sizeof(T) <= kMapValueVariantSize);
93
842k
    static_assert(std::is_trivially_copyable_v<T>);
94
95
842k
    ::new (static_cast<void*>(&raw_[0])) T(std::forward<Args>(args)...);
96
842k
  }
cel::common_internal::MapValueVariant::MapValueVariant<cel::CustomMapValue>(std::__1::in_place_type_t<cel::CustomMapValue>)
Line
Count
Source
90
120k
      : index_(MapValueAlternative<T>::kIndex) {
91
120k
    static_assert(alignof(T) <= kMapValueVariantAlign);
92
120k
    static_assert(sizeof(T) <= kMapValueVariantSize);
93
120k
    static_assert(std::is_trivially_copyable_v<T>);
94
95
120k
    ::new (static_cast<void*>(&raw_[0])) T(std::forward<Args>(args)...);
96
120k
  }
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
117k
      : index_(MapValueAlternative<T>::kIndex) {
91
117k
    static_assert(alignof(T) <= kMapValueVariantAlign);
92
117k
    static_assert(sizeof(T) <= kMapValueVariantSize);
93
117k
    static_assert(std::is_trivially_copyable_v<T>);
94
95
117k
    ::new (static_cast<void*>(&raw_[0])) T(std::forward<Args>(args)...);
96
117k
  }
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&)
Line
Count
Source
90
274k
      : index_(MapValueAlternative<T>::kIndex) {
91
274k
    static_assert(alignof(T) <= kMapValueVariantAlign);
92
274k
    static_assert(sizeof(T) <= kMapValueVariantSize);
93
274k
    static_assert(std::is_trivially_copyable_v<T>);
94
95
274k
    ::new (static_cast<void*>(&raw_[0])) T(std::forward<Args>(args)...);
96
274k
  }
Unexecuted instantiation: cel::common_internal::MapValueVariant::MapValueVariant<cel::ParsedJsonMapValue, cel::ParsedJsonMapValue const&>(std::__1::in_place_type_t<cel::ParsedJsonMapValue>, cel::ParsedJsonMapValue const&)
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
32.1k
      : index_(MapValueAlternative<T>::kIndex) {
91
32.1k
    static_assert(alignof(T) <= kMapValueVariantAlign);
92
32.1k
    static_assert(sizeof(T) <= kMapValueVariantSize);
93
32.1k
    static_assert(std::is_trivially_copyable_v<T>);
94
95
32.1k
    ::new (static_cast<void*>(&raw_[0])) T(std::forward<Args>(args)...);
96
32.1k
  }
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&&)
Line
Count
Source
90
298k
      : index_(MapValueAlternative<T>::kIndex) {
91
298k
    static_assert(alignof(T) <= kMapValueVariantAlign);
92
298k
    static_assert(sizeof(T) <= kMapValueVariantSize);
93
298k
    static_assert(std::is_trivially_copyable_v<T>);
94
95
298k
    ::new (static_cast<void*>(&raw_[0])) T(std::forward<Args>(args)...);
96
298k
  }
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
849k
  const T& Get() const& ABSL_ATTRIBUTE_LIFETIME_BOUND {
130
849k
    ABSL_DCHECK(Is<T>());
131
132
849k
    return *At<T>();
133
849k
  }
Unexecuted instantiation: cel::ParsedMapFieldValue const& cel::common_internal::MapValueVariant::Get<cel::ParsedMapFieldValue>() const &
Unexecuted instantiation: cel::ParsedJsonMapValue const& cel::common_internal::MapValueVariant::Get<cel::ParsedJsonMapValue>() const &
cel::common_internal::LegacyMapValue const& cel::common_internal::MapValueVariant::Get<cel::common_internal::LegacyMapValue>() const &
Line
Count
Source
129
574k
  const T& Get() const& ABSL_ATTRIBUTE_LIFETIME_BOUND {
130
574k
    ABSL_DCHECK(Is<T>());
131
132
574k
    return *At<T>();
133
574k
  }
cel::CustomMapValue const& cel::common_internal::MapValueVariant::Get<cel::CustomMapValue>() const &
Line
Count
Source
129
275k
  const T& Get() const& ABSL_ATTRIBUTE_LIFETIME_BOUND {
130
275k
    ABSL_DCHECK(Is<T>());
131
132
275k
    return *At<T>();
133
275k
  }
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
849k
  decltype(auto) Visit(Visitor&& visitor) const {
167
849k
    switch (index_) {
168
275k
      case MapValueIndex::kCustom:
169
275k
        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
574k
      case MapValueIndex::kLegacy:
175
574k
        return std::forward<Visitor>(visitor)(Get<LegacyMapValue>());
176
849k
    }
177
849k
  }
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
3.47k
  decltype(auto) Visit(Visitor&& visitor) const {
167
3.47k
    switch (index_) {
168
3.46k
      case MapValueIndex::kCustom:
169
3.46k
        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
3
      case MapValueIndex::kLegacy:
175
3
        return std::forward<Visitor>(visitor)(Get<LegacyMapValue>());
176
3.47k
    }
177
3.47k
  }
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
178k
  decltype(auto) Visit(Visitor&& visitor) const {
167
178k
    switch (index_) {
168
69.4k
      case MapValueIndex::kCustom:
169
69.4k
        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
108k
      case MapValueIndex::kLegacy:
175
108k
        return std::forward<Visitor>(visitor)(Get<LegacyMapValue>());
176
178k
    }
177
178k
  }
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
190k
  decltype(auto) Visit(Visitor&& visitor) const {
167
190k
    switch (index_) {
168
26.7k
      case MapValueIndex::kCustom:
169
26.7k
        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
163k
      case MapValueIndex::kLegacy:
175
163k
        return std::forward<Visitor>(visitor)(Get<LegacyMapValue>());
176
190k
    }
177
190k
  }
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
16.7k
  decltype(auto) Visit(Visitor&& visitor) const {
167
16.7k
    switch (index_) {
168
13.0k
      case MapValueIndex::kCustom:
169
13.0k
        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
3.70k
      case MapValueIndex::kLegacy:
175
3.70k
        return std::forward<Visitor>(visitor)(Get<LegacyMapValue>());
176
16.7k
    }
177
16.7k
  }
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
10.0k
  decltype(auto) Visit(Visitor&& visitor) const {
167
10.0k
    switch (index_) {
168
9.93k
      case MapValueIndex::kCustom:
169
9.93k
        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
70
      case MapValueIndex::kLegacy:
175
70
        return std::forward<Visitor>(visitor)(Get<LegacyMapValue>());
176
10.0k
    }
177
10.0k
  }
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
451k
  decltype(auto) Visit(Visitor&& visitor) const {
167
451k
    switch (index_) {
168
152k
      case MapValueIndex::kCustom:
169
152k
        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
298k
      case MapValueIndex::kLegacy:
175
298k
        return std::forward<Visitor>(visitor)(Get<LegacyMapValue>());
176
451k
    }
177
451k
  }
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
849k
      ABSL_ATTRIBUTE_LIFETIME_BOUND {
199
849k
    static_assert(alignof(T) <= kMapValueVariantAlign);
200
849k
    static_assert(sizeof(T) <= kMapValueVariantSize);
201
849k
    static_assert(std::is_trivially_copyable_v<T>);
202
203
849k
    return std::launder(reinterpret_cast<const T*>(&raw_[0]));
204
849k
  }
Unexecuted instantiation: cel::ParsedMapFieldValue const* cel::common_internal::MapValueVariant::At<cel::ParsedMapFieldValue>() const
Unexecuted instantiation: cel::ParsedJsonMapValue const* cel::common_internal::MapValueVariant::At<cel::ParsedJsonMapValue>() const
cel::common_internal::LegacyMapValue const* cel::common_internal::MapValueVariant::At<cel::common_internal::LegacyMapValue>() const
Line
Count
Source
198
574k
      ABSL_ATTRIBUTE_LIFETIME_BOUND {
199
574k
    static_assert(alignof(T) <= kMapValueVariantAlign);
200
574k
    static_assert(sizeof(T) <= kMapValueVariantSize);
201
574k
    static_assert(std::is_trivially_copyable_v<T>);
202
203
574k
    return std::launder(reinterpret_cast<const T*>(&raw_[0]));
204
574k
  }
cel::CustomMapValue const* cel::common_internal::MapValueVariant::At<cel::CustomMapValue>() const
Line
Count
Source
198
275k
      ABSL_ATTRIBUTE_LIFETIME_BOUND {
199
275k
    static_assert(alignof(T) <= kMapValueVariantAlign);
200
275k
    static_assert(sizeof(T) <= kMapValueVariantSize);
201
275k
    static_assert(std::is_trivially_copyable_v<T>);
202
203
275k
    return std::launder(reinterpret_cast<const T*>(&raw_[0]));
204
275k
  }
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_