Coverage Report

Created: 2026-09-14 06:52

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/proc/self/cwd/common/value.cc
Line
Count
Source
1
// Copyright 2023 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
#include "common/value.h"
16
17
#include <cstddef>
18
#include <cstdint>
19
#include <memory>
20
#include <optional>
21
#include <ostream>
22
#include <string>
23
#include <type_traits>
24
#include <utility>
25
#include <variant>
26
27
#include "google/protobuf/struct.pb.h"
28
#include "absl/base/attributes.h"
29
#include "absl/base/nullability.h"
30
#include "absl/base/optimization.h"
31
#include "absl/functional/overload.h"
32
#include "absl/log/absl_check.h"
33
#include "absl/log/absl_log.h"
34
#include "absl/meta/type_traits.h"
35
#include "absl/status/status.h"
36
#include "absl/status/statusor.h"
37
#include "absl/strings/cord.h"
38
#include "absl/strings/str_cat.h"
39
#include "absl/strings/string_view.h"
40
#include "absl/time/time.h"
41
#include "absl/types/optional.h"
42
#include "absl/types/variant.h"
43
#include "common/allocator.h"
44
#include "common/memory.h"
45
#include "common/optional_ref.h"
46
#include "common/type.h"
47
#include "common/value_kind.h"
48
#include "common/values/list_value_builder.h"
49
#include "common/values/map_value_builder.h"
50
#include "common/values/struct_value_builder.h"
51
#include "common/values/values.h"
52
#include "internal/number.h"
53
#include "internal/protobuf_runtime_version.h"
54
#include "internal/status_macros.h"
55
#include "internal/well_known_types.h"
56
#include "runtime/runtime_options.h"
57
#include "google/protobuf/arena.h"
58
#include "google/protobuf/descriptor.h"
59
#include "google/protobuf/message.h"
60
61
#undef GetMessage
62
63
namespace cel {
64
namespace {
65
66
google::protobuf::Arena* absl_nonnull MessageArenaOr(
67
    const google::protobuf::Message* absl_nonnull message,
68
436k
    google::protobuf::Arena* absl_nonnull or_arena) {
69
436k
  google::protobuf::Arena* absl_nullable arena = message->GetArena();
70
436k
  if (arena == nullptr) {
71
0
    arena = or_arena;
72
0
  }
73
436k
  return arena;
74
436k
}
75
76
}  // namespace
77
78
5.88k
Type Value::GetRuntimeType() const {
79
5.88k
  switch (kind()) {
80
0
    case ValueKind::kNull:
81
0
      return NullType();
82
738
    case ValueKind::kBool:
83
738
      return BoolType();
84
303
    case ValueKind::kInt:
85
303
      return IntType();
86
1.50k
    case ValueKind::kUint:
87
1.50k
      return UintType();
88
273
    case ValueKind::kDouble:
89
273
      return DoubleType();
90
702
    case ValueKind::kString:
91
702
      return StringType();
92
1.17k
    case ValueKind::kBytes:
93
1.17k
      return BytesType();
94
1
    case ValueKind::kStruct:
95
1
      return this->GetStruct().GetRuntimeType();
96
304
    case ValueKind::kDuration:
97
304
      return DurationType();
98
0
    case ValueKind::kTimestamp:
99
0
      return TimestampType();
100
106
    case ValueKind::kList:
101
106
      return ListType();
102
246
    case ValueKind::kMap:
103
246
      return MapType();
104
0
    case ValueKind::kUnknown:
105
0
      return UnknownType();
106
526
    case ValueKind::kType:
107
526
      return TypeType();
108
0
    case ValueKind::kError:
109
0
      return ErrorType();
110
0
    case ValueKind::kOpaque:
111
0
      return this->GetOpaque().GetRuntimeType();
112
0
    default:
113
0
      return cel::Type();
114
5.88k
  }
115
5.88k
}
116
117
namespace {
118
119
template <typename T>
120
struct IsMonostate : std::is_same<absl::remove_cvref_t<T>, std::monostate> {};
121
122
}  // namespace
123
124
2.16k
absl::string_view Value::GetTypeName() const {
125
2.16k
  return variant_.Visit([](const auto& alternative) -> absl::string_view {
126
2.16k
    return alternative.GetTypeName();
127
2.16k
  });
Unexecuted instantiation: value.cc:std::__1::basic_string_view<char, std::__1::char_traits<char> > cel::Value::GetTypeName() const::$_0::operator()<cel::NullValue>(cel::NullValue const&) const
value.cc:std::__1::basic_string_view<char, std::__1::char_traits<char> > cel::Value::GetTypeName() const::$_0::operator()<cel::BoolValue>(cel::BoolValue const&) const
Line
Count
Source
125
354
  return variant_.Visit([](const auto& alternative) -> absl::string_view {
126
354
    return alternative.GetTypeName();
127
354
  });
value.cc:std::__1::basic_string_view<char, std::__1::char_traits<char> > cel::Value::GetTypeName() const::$_0::operator()<cel::IntValue>(cel::IntValue const&) const
Line
Count
Source
125
1
  return variant_.Visit([](const auto& alternative) -> absl::string_view {
126
1
    return alternative.GetTypeName();
127
1
  });
value.cc:std::__1::basic_string_view<char, std::__1::char_traits<char> > cel::Value::GetTypeName() const::$_0::operator()<cel::UintValue>(cel::UintValue const&) const
Line
Count
Source
125
1.07k
  return variant_.Visit([](const auto& alternative) -> absl::string_view {
126
1.07k
    return alternative.GetTypeName();
127
1.07k
  });
value.cc:std::__1::basic_string_view<char, std::__1::char_traits<char> > cel::Value::GetTypeName() const::$_0::operator()<cel::DoubleValue>(cel::DoubleValue const&) const
Line
Count
Source
125
226
  return variant_.Visit([](const auto& alternative) -> absl::string_view {
126
226
    return alternative.GetTypeName();
127
226
  });
Unexecuted instantiation: value.cc:std::__1::basic_string_view<char, std::__1::char_traits<char> > cel::Value::GetTypeName() const::$_0::operator()<cel::DurationValue>(cel::DurationValue const&) const
Unexecuted instantiation: value.cc:std::__1::basic_string_view<char, std::__1::char_traits<char> > cel::Value::GetTypeName() const::$_0::operator()<cel::TimestampValue>(cel::TimestampValue const&) const
value.cc:std::__1::basic_string_view<char, std::__1::char_traits<char> > cel::Value::GetTypeName() const::$_0::operator()<cel::TypeValue>(cel::TypeValue const&) const
Line
Count
Source
125
234
  return variant_.Visit([](const auto& alternative) -> absl::string_view {
126
234
    return alternative.GetTypeName();
127
234
  });
Unexecuted instantiation: value.cc:std::__1::basic_string_view<char, std::__1::char_traits<char> > cel::Value::GetTypeName() const::$_0::operator()<cel::common_internal::LegacyListValue>(cel::common_internal::LegacyListValue const&) const
Unexecuted instantiation: value.cc:std::__1::basic_string_view<char, std::__1::char_traits<char> > cel::Value::GetTypeName() const::$_0::operator()<cel::ParsedJsonListValue>(cel::ParsedJsonListValue const&) const
Unexecuted instantiation: value.cc:std::__1::basic_string_view<char, std::__1::char_traits<char> > cel::Value::GetTypeName() const::$_0::operator()<cel::ParsedRepeatedFieldValue>(cel::ParsedRepeatedFieldValue const&) const
value.cc:std::__1::basic_string_view<char, std::__1::char_traits<char> > cel::Value::GetTypeName() const::$_0::operator()<cel::CustomListValue>(cel::CustomListValue const&) const
Line
Count
Source
125
274
  return variant_.Visit([](const auto& alternative) -> absl::string_view {
126
274
    return alternative.GetTypeName();
127
274
  });
Unexecuted instantiation: value.cc:std::__1::basic_string_view<char, std::__1::char_traits<char> > cel::Value::GetTypeName() const::$_0::operator()<cel::common_internal::LegacyMapValue>(cel::common_internal::LegacyMapValue const&) const
Unexecuted instantiation: value.cc:std::__1::basic_string_view<char, std::__1::char_traits<char> > cel::Value::GetTypeName() const::$_0::operator()<cel::ParsedJsonMapValue>(cel::ParsedJsonMapValue const&) const
Unexecuted instantiation: value.cc:std::__1::basic_string_view<char, std::__1::char_traits<char> > cel::Value::GetTypeName() const::$_0::operator()<cel::ParsedMapFieldValue>(cel::ParsedMapFieldValue const&) const
Unexecuted instantiation: value.cc:std::__1::basic_string_view<char, std::__1::char_traits<char> > cel::Value::GetTypeName() const::$_0::operator()<cel::CustomMapValue>(cel::CustomMapValue const&) const
Unexecuted instantiation: value.cc:std::__1::basic_string_view<char, std::__1::char_traits<char> > cel::Value::GetTypeName() const::$_0::operator()<cel::common_internal::LegacyStructValue>(cel::common_internal::LegacyStructValue const&) const
Unexecuted instantiation: value.cc:std::__1::basic_string_view<char, std::__1::char_traits<char> > cel::Value::GetTypeName() const::$_0::operator()<cel::ParsedMessageValue>(cel::ParsedMessageValue const&) const
Unexecuted instantiation: value.cc:std::__1::basic_string_view<char, std::__1::char_traits<char> > cel::Value::GetTypeName() const::$_0::operator()<cel::CustomStructValue>(cel::CustomStructValue const&) const
Unexecuted instantiation: value.cc:std::__1::basic_string_view<char, std::__1::char_traits<char> > cel::Value::GetTypeName() const::$_0::operator()<cel::OpaqueValue>(cel::OpaqueValue const&) const
Unexecuted instantiation: value.cc:std::__1::basic_string_view<char, std::__1::char_traits<char> > cel::Value::GetTypeName() const::$_0::operator()<cel::BytesValue>(cel::BytesValue const&) const
Unexecuted instantiation: value.cc:std::__1::basic_string_view<char, std::__1::char_traits<char> > cel::Value::GetTypeName() const::$_0::operator()<cel::StringValue>(cel::StringValue const&) const
Unexecuted instantiation: value.cc:std::__1::basic_string_view<char, std::__1::char_traits<char> > cel::Value::GetTypeName() const::$_0::operator()<cel::ErrorValue>(cel::ErrorValue const&) const
Unexecuted instantiation: value.cc:std::__1::basic_string_view<char, std::__1::char_traits<char> > cel::Value::GetTypeName() const::$_0::operator()<cel::UnknownValue>(cel::UnknownValue const&) const
128
2.16k
}
129
130
412k
std::string Value::DebugString() const {
131
412k
  return variant_.Visit([](const auto& alternative) -> std::string {
132
412k
    return alternative.DebugString();
133
412k
  });
Unexecuted instantiation: value.cc:std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > cel::Value::DebugString() const::$_0::operator()<cel::NullValue>(cel::NullValue const&) const
value.cc:std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > cel::Value::DebugString() const::$_0::operator()<cel::BoolValue>(cel::BoolValue const&) const
Line
Count
Source
131
1.56k
  return variant_.Visit([](const auto& alternative) -> std::string {
132
1.56k
    return alternative.DebugString();
133
1.56k
  });
value.cc:std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > cel::Value::DebugString() const::$_0::operator()<cel::IntValue>(cel::IntValue const&) const
Line
Count
Source
131
339k
  return variant_.Visit([](const auto& alternative) -> std::string {
132
339k
    return alternative.DebugString();
133
339k
  });
value.cc:std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > cel::Value::DebugString() const::$_0::operator()<cel::UintValue>(cel::UintValue const&) const
Line
Count
Source
131
301
  return variant_.Visit([](const auto& alternative) -> std::string {
132
301
    return alternative.DebugString();
133
301
  });
value.cc:std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > cel::Value::DebugString() const::$_0::operator()<cel::DoubleValue>(cel::DoubleValue const&) const
Line
Count
Source
131
27.6k
  return variant_.Visit([](const auto& alternative) -> std::string {
132
27.6k
    return alternative.DebugString();
133
27.6k
  });
Unexecuted instantiation: value.cc:std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > cel::Value::DebugString() const::$_0::operator()<cel::DurationValue>(cel::DurationValue const&) const
Unexecuted instantiation: value.cc:std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > cel::Value::DebugString() const::$_0::operator()<cel::TimestampValue>(cel::TimestampValue const&) const
Unexecuted instantiation: value.cc:std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > cel::Value::DebugString() const::$_0::operator()<cel::TypeValue>(cel::TypeValue const&) const
Unexecuted instantiation: value.cc:std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > cel::Value::DebugString() const::$_0::operator()<cel::common_internal::LegacyListValue>(cel::common_internal::LegacyListValue const&) const
Unexecuted instantiation: value.cc:std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > cel::Value::DebugString() const::$_0::operator()<cel::ParsedJsonListValue>(cel::ParsedJsonListValue const&) const
Unexecuted instantiation: value.cc:std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > cel::Value::DebugString() const::$_0::operator()<cel::ParsedRepeatedFieldValue>(cel::ParsedRepeatedFieldValue const&) const
Unexecuted instantiation: value.cc:std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > cel::Value::DebugString() const::$_0::operator()<cel::CustomListValue>(cel::CustomListValue const&) const
Unexecuted instantiation: value.cc:std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > cel::Value::DebugString() const::$_0::operator()<cel::common_internal::LegacyMapValue>(cel::common_internal::LegacyMapValue const&) const
Unexecuted instantiation: value.cc:std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > cel::Value::DebugString() const::$_0::operator()<cel::ParsedJsonMapValue>(cel::ParsedJsonMapValue const&) const
Unexecuted instantiation: value.cc:std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > cel::Value::DebugString() const::$_0::operator()<cel::ParsedMapFieldValue>(cel::ParsedMapFieldValue const&) const
Unexecuted instantiation: value.cc:std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > cel::Value::DebugString() const::$_0::operator()<cel::CustomMapValue>(cel::CustomMapValue const&) const
Unexecuted instantiation: value.cc:std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > cel::Value::DebugString() const::$_0::operator()<cel::common_internal::LegacyStructValue>(cel::common_internal::LegacyStructValue const&) const
Unexecuted instantiation: value.cc:std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > cel::Value::DebugString() const::$_0::operator()<cel::ParsedMessageValue>(cel::ParsedMessageValue const&) const
Unexecuted instantiation: value.cc:std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > cel::Value::DebugString() const::$_0::operator()<cel::CustomStructValue>(cel::CustomStructValue const&) const
Unexecuted instantiation: value.cc:std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > cel::Value::DebugString() const::$_0::operator()<cel::OpaqueValue>(cel::OpaqueValue const&) const
Unexecuted instantiation: value.cc:std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > cel::Value::DebugString() const::$_0::operator()<cel::BytesValue>(cel::BytesValue const&) const
value.cc:std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > cel::Value::DebugString() const::$_0::operator()<cel::StringValue>(cel::StringValue const&) const
Line
Count
Source
131
43.3k
  return variant_.Visit([](const auto& alternative) -> std::string {
132
43.3k
    return alternative.DebugString();
133
43.3k
  });
Unexecuted instantiation: value.cc:std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > cel::Value::DebugString() const::$_0::operator()<cel::ErrorValue>(cel::ErrorValue const&) const
Unexecuted instantiation: value.cc:std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > cel::Value::DebugString() const::$_0::operator()<cel::UnknownValue>(cel::UnknownValue const&) const
134
412k
}
135
136
absl::Status Value::SerializeTo(
137
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
138
    google::protobuf::MessageFactory* absl_nonnull message_factory,
139
0
    google::protobuf::io::ZeroCopyOutputStream* absl_nonnull output) const {
140
0
  ABSL_DCHECK(descriptor_pool != nullptr);
141
0
  ABSL_DCHECK(message_factory != nullptr);
142
0
  ABSL_DCHECK(output != nullptr);
143
144
0
  return variant_.Visit([&](const auto& alternative) -> absl::Status {
145
0
    return alternative.SerializeTo(descriptor_pool, message_factory, output);
146
0
  });
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::SerializeTo(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::io::ZeroCopyOutputStream*) const::$_0::operator()<cel::NullValue>(cel::NullValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::SerializeTo(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::io::ZeroCopyOutputStream*) const::$_0::operator()<cel::BoolValue>(cel::BoolValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::SerializeTo(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::io::ZeroCopyOutputStream*) const::$_0::operator()<cel::IntValue>(cel::IntValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::SerializeTo(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::io::ZeroCopyOutputStream*) const::$_0::operator()<cel::UintValue>(cel::UintValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::SerializeTo(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::io::ZeroCopyOutputStream*) const::$_0::operator()<cel::DoubleValue>(cel::DoubleValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::SerializeTo(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::io::ZeroCopyOutputStream*) const::$_0::operator()<cel::DurationValue>(cel::DurationValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::SerializeTo(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::io::ZeroCopyOutputStream*) const::$_0::operator()<cel::TimestampValue>(cel::TimestampValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::SerializeTo(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::io::ZeroCopyOutputStream*) const::$_0::operator()<cel::TypeValue>(cel::TypeValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::SerializeTo(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::io::ZeroCopyOutputStream*) const::$_0::operator()<cel::common_internal::LegacyListValue>(cel::common_internal::LegacyListValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::SerializeTo(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::io::ZeroCopyOutputStream*) const::$_0::operator()<cel::ParsedJsonListValue>(cel::ParsedJsonListValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::SerializeTo(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::io::ZeroCopyOutputStream*) const::$_0::operator()<cel::ParsedRepeatedFieldValue>(cel::ParsedRepeatedFieldValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::SerializeTo(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::io::ZeroCopyOutputStream*) const::$_0::operator()<cel::CustomListValue>(cel::CustomListValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::SerializeTo(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::io::ZeroCopyOutputStream*) const::$_0::operator()<cel::common_internal::LegacyMapValue>(cel::common_internal::LegacyMapValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::SerializeTo(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::io::ZeroCopyOutputStream*) const::$_0::operator()<cel::ParsedJsonMapValue>(cel::ParsedJsonMapValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::SerializeTo(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::io::ZeroCopyOutputStream*) const::$_0::operator()<cel::ParsedMapFieldValue>(cel::ParsedMapFieldValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::SerializeTo(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::io::ZeroCopyOutputStream*) const::$_0::operator()<cel::CustomMapValue>(cel::CustomMapValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::SerializeTo(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::io::ZeroCopyOutputStream*) const::$_0::operator()<cel::common_internal::LegacyStructValue>(cel::common_internal::LegacyStructValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::SerializeTo(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::io::ZeroCopyOutputStream*) const::$_0::operator()<cel::ParsedMessageValue>(cel::ParsedMessageValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::SerializeTo(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::io::ZeroCopyOutputStream*) const::$_0::operator()<cel::CustomStructValue>(cel::CustomStructValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::SerializeTo(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::io::ZeroCopyOutputStream*) const::$_0::operator()<cel::OpaqueValue>(cel::OpaqueValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::SerializeTo(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::io::ZeroCopyOutputStream*) const::$_0::operator()<cel::BytesValue>(cel::BytesValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::SerializeTo(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::io::ZeroCopyOutputStream*) const::$_0::operator()<cel::StringValue>(cel::StringValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::SerializeTo(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::io::ZeroCopyOutputStream*) const::$_0::operator()<cel::ErrorValue>(cel::ErrorValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::SerializeTo(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::io::ZeroCopyOutputStream*) const::$_0::operator()<cel::UnknownValue>(cel::UnknownValue const&) const
147
0
}
148
149
absl::Status Value::ConvertToJson(
150
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
151
    google::protobuf::MessageFactory* absl_nonnull message_factory,
152
8.98M
    google::protobuf::Message* absl_nonnull json) const {
153
8.98M
  ABSL_DCHECK(descriptor_pool != nullptr);
154
8.98M
  ABSL_DCHECK(message_factory != nullptr);
155
8.98M
  ABSL_DCHECK(json != nullptr);
156
8.98M
  ABSL_DCHECK_EQ(json->GetDescriptor()->well_known_type(),
157
8.98M
                 google::protobuf::Descriptor::WELLKNOWNTYPE_VALUE);
158
159
8.98M
  return variant_.Visit([descriptor_pool, message_factory,
160
8.98M
                         json](const auto& alternative) -> absl::Status {
161
8.98M
    return alternative.ConvertToJson(descriptor_pool, message_factory, json);
162
8.98M
  });
value.cc:absl::lts_20260526::Status cel::Value::ConvertToJson(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0::operator()<cel::NullValue>(cel::NullValue const&) const
Line
Count
Source
160
986
                         json](const auto& alternative) -> absl::Status {
161
986
    return alternative.ConvertToJson(descriptor_pool, message_factory, json);
162
986
  });
value.cc:absl::lts_20260526::Status cel::Value::ConvertToJson(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0::operator()<cel::BoolValue>(cel::BoolValue const&) const
Line
Count
Source
160
382k
                         json](const auto& alternative) -> absl::Status {
161
382k
    return alternative.ConvertToJson(descriptor_pool, message_factory, json);
162
382k
  });
value.cc:absl::lts_20260526::Status cel::Value::ConvertToJson(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0::operator()<cel::IntValue>(cel::IntValue const&) const
Line
Count
Source
160
8.47M
                         json](const auto& alternative) -> absl::Status {
161
8.47M
    return alternative.ConvertToJson(descriptor_pool, message_factory, json);
162
8.47M
  });
value.cc:absl::lts_20260526::Status cel::Value::ConvertToJson(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0::operator()<cel::UintValue>(cel::UintValue const&) const
Line
Count
Source
160
25.3k
                         json](const auto& alternative) -> absl::Status {
161
25.3k
    return alternative.ConvertToJson(descriptor_pool, message_factory, json);
162
25.3k
  });
value.cc:absl::lts_20260526::Status cel::Value::ConvertToJson(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0::operator()<cel::DoubleValue>(cel::DoubleValue const&) const
Line
Count
Source
160
53.1k
                         json](const auto& alternative) -> absl::Status {
161
53.1k
    return alternative.ConvertToJson(descriptor_pool, message_factory, json);
162
53.1k
  });
value.cc:absl::lts_20260526::Status cel::Value::ConvertToJson(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0::operator()<cel::DurationValue>(cel::DurationValue const&) const
Line
Count
Source
160
9.30k
                         json](const auto& alternative) -> absl::Status {
161
9.30k
    return alternative.ConvertToJson(descriptor_pool, message_factory, json);
162
9.30k
  });
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJson(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0::operator()<cel::TimestampValue>(cel::TimestampValue const&) const
value.cc:absl::lts_20260526::Status cel::Value::ConvertToJson(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0::operator()<cel::TypeValue>(cel::TypeValue const&) const
Line
Count
Source
160
32
                         json](const auto& alternative) -> absl::Status {
161
32
    return alternative.ConvertToJson(descriptor_pool, message_factory, json);
162
32
  });
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJson(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0::operator()<cel::common_internal::LegacyListValue>(cel::common_internal::LegacyListValue const&) const
value.cc:absl::lts_20260526::Status cel::Value::ConvertToJson(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0::operator()<cel::ParsedJsonListValue>(cel::ParsedJsonListValue const&) const
Line
Count
Source
160
348
                         json](const auto& alternative) -> absl::Status {
161
348
    return alternative.ConvertToJson(descriptor_pool, message_factory, json);
162
348
  });
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJson(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0::operator()<cel::ParsedRepeatedFieldValue>(cel::ParsedRepeatedFieldValue const&) const
value.cc:absl::lts_20260526::Status cel::Value::ConvertToJson(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0::operator()<cel::CustomListValue>(cel::CustomListValue const&) const
Line
Count
Source
160
1.29k
                         json](const auto& alternative) -> absl::Status {
161
1.29k
    return alternative.ConvertToJson(descriptor_pool, message_factory, json);
162
1.29k
  });
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJson(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0::operator()<cel::common_internal::LegacyMapValue>(cel::common_internal::LegacyMapValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJson(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0::operator()<cel::ParsedJsonMapValue>(cel::ParsedJsonMapValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJson(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0::operator()<cel::ParsedMapFieldValue>(cel::ParsedMapFieldValue const&) const
value.cc:absl::lts_20260526::Status cel::Value::ConvertToJson(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0::operator()<cel::CustomMapValue>(cel::CustomMapValue const&) const
Line
Count
Source
160
21.6k
                         json](const auto& alternative) -> absl::Status {
161
21.6k
    return alternative.ConvertToJson(descriptor_pool, message_factory, json);
162
21.6k
  });
value.cc:absl::lts_20260526::Status cel::Value::ConvertToJson(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0::operator()<cel::common_internal::LegacyStructValue>(cel::common_internal::LegacyStructValue const&) const
Line
Count
Source
160
144
                         json](const auto& alternative) -> absl::Status {
161
144
    return alternative.ConvertToJson(descriptor_pool, message_factory, json);
162
144
  });
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJson(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0::operator()<cel::ParsedMessageValue>(cel::ParsedMessageValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJson(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0::operator()<cel::CustomStructValue>(cel::CustomStructValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJson(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0::operator()<cel::OpaqueValue>(cel::OpaqueValue const&) const
value.cc:absl::lts_20260526::Status cel::Value::ConvertToJson(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0::operator()<cel::BytesValue>(cel::BytesValue const&) const
Line
Count
Source
160
4.48k
                         json](const auto& alternative) -> absl::Status {
161
4.48k
    return alternative.ConvertToJson(descriptor_pool, message_factory, json);
162
4.48k
  });
value.cc:absl::lts_20260526::Status cel::Value::ConvertToJson(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0::operator()<cel::StringValue>(cel::StringValue const&) const
Line
Count
Source
160
8.76k
                         json](const auto& alternative) -> absl::Status {
161
8.76k
    return alternative.ConvertToJson(descriptor_pool, message_factory, json);
162
8.76k
  });
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJson(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0::operator()<cel::ErrorValue>(cel::ErrorValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJson(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0::operator()<cel::UnknownValue>(cel::UnknownValue const&) const
163
8.98M
}
164
165
absl::Status Value::ConvertToJsonArray(
166
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
167
    google::protobuf::MessageFactory* absl_nonnull message_factory,
168
367k
    google::protobuf::Message* absl_nonnull json) const {
169
367k
  ABSL_DCHECK(descriptor_pool != nullptr);
170
367k
  ABSL_DCHECK(message_factory != nullptr);
171
367k
  ABSL_DCHECK(json != nullptr);
172
367k
  ABSL_DCHECK_EQ(json->GetDescriptor()->well_known_type(),
173
367k
                 google::protobuf::Descriptor::WELLKNOWNTYPE_LISTVALUE);
174
175
367k
  return variant_.Visit(absl::Overload(
176
367k
      [](std::monostate) -> absl::Status {
177
367k
        return absl::InternalError("use of invalid Value");
178
367k
      },
179
367k
      [descriptor_pool, message_factory, json](
180
367k
          const common_internal::LegacyListValue& alternative) -> absl::Status {
181
0
        return alternative.ConvertToJsonArray(descriptor_pool, message_factory,
182
0
                                              json);
183
0
      },
184
367k
      [descriptor_pool, message_factory,
185
367k
       json](const CustomListValue& alternative) -> absl::Status {
186
367k
        return alternative.ConvertToJsonArray(descriptor_pool, message_factory,
187
367k
                                              json);
188
367k
      },
189
367k
      [descriptor_pool, message_factory,
190
367k
       json](const ParsedRepeatedFieldValue& alternative) -> absl::Status {
191
0
        return alternative.ConvertToJsonArray(descriptor_pool, message_factory,
192
0
                                              json);
193
0
      },
194
367k
      [descriptor_pool, message_factory,
195
367k
       json](const ParsedJsonListValue& alternative) -> absl::Status {
196
0
        return alternative.ConvertToJsonArray(descriptor_pool, message_factory,
197
0
                                              json);
198
0
      },
199
367k
      [](const auto& alternative) -> absl::Status {
200
16
        return TypeConversionError(alternative.GetTypeName(),
201
16
                                   "google.protobuf.ListValue")
202
16
            .NativeValue();
203
16
      }));
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonArray(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_5::operator()<cel::NullValue>(cel::NullValue const&) const
value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonArray(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_5::operator()<cel::BoolValue>(cel::BoolValue const&) const
Line
Count
Source
199
4
      [](const auto& alternative) -> absl::Status {
200
4
        return TypeConversionError(alternative.GetTypeName(),
201
4
                                   "google.protobuf.ListValue")
202
4
            .NativeValue();
203
4
      }));
value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonArray(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_5::operator()<cel::IntValue>(cel::IntValue const&) const
Line
Count
Source
199
5
      [](const auto& alternative) -> absl::Status {
200
5
        return TypeConversionError(alternative.GetTypeName(),
201
5
                                   "google.protobuf.ListValue")
202
5
            .NativeValue();
203
5
      }));
value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonArray(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_5::operator()<cel::UintValue>(cel::UintValue const&) const
Line
Count
Source
199
1
      [](const auto& alternative) -> absl::Status {
200
1
        return TypeConversionError(alternative.GetTypeName(),
201
1
                                   "google.protobuf.ListValue")
202
1
            .NativeValue();
203
1
      }));
value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonArray(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_5::operator()<cel::DoubleValue>(cel::DoubleValue const&) const
Line
Count
Source
199
2
      [](const auto& alternative) -> absl::Status {
200
2
        return TypeConversionError(alternative.GetTypeName(),
201
2
                                   "google.protobuf.ListValue")
202
2
            .NativeValue();
203
2
      }));
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonArray(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_5::operator()<cel::DurationValue>(cel::DurationValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonArray(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_5::operator()<cel::TimestampValue>(cel::TimestampValue const&) const
value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonArray(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_5::operator()<cel::TypeValue>(cel::TypeValue const&) const
Line
Count
Source
199
1
      [](const auto& alternative) -> absl::Status {
200
1
        return TypeConversionError(alternative.GetTypeName(),
201
1
                                   "google.protobuf.ListValue")
202
1
            .NativeValue();
203
1
      }));
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonArray(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_5::operator()<cel::common_internal::LegacyMapValue>(cel::common_internal::LegacyMapValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonArray(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_5::operator()<cel::ParsedJsonMapValue>(cel::ParsedJsonMapValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonArray(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_5::operator()<cel::ParsedMapFieldValue>(cel::ParsedMapFieldValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonArray(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_5::operator()<cel::CustomMapValue>(cel::CustomMapValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonArray(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_5::operator()<cel::common_internal::LegacyStructValue>(cel::common_internal::LegacyStructValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonArray(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_5::operator()<cel::ParsedMessageValue>(cel::ParsedMessageValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonArray(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_5::operator()<cel::CustomStructValue>(cel::CustomStructValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonArray(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_5::operator()<cel::OpaqueValue>(cel::OpaqueValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonArray(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_5::operator()<cel::BytesValue>(cel::BytesValue const&) const
value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonArray(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_5::operator()<cel::StringValue>(cel::StringValue const&) const
Line
Count
Source
199
3
      [](const auto& alternative) -> absl::Status {
200
3
        return TypeConversionError(alternative.GetTypeName(),
201
3
                                   "google.protobuf.ListValue")
202
3
            .NativeValue();
203
3
      }));
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonArray(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_5::operator()<cel::ErrorValue>(cel::ErrorValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonArray(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_5::operator()<cel::UnknownValue>(cel::UnknownValue const&) const
204
367k
}
205
206
absl::Status Value::ConvertToJsonObject(
207
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
208
    google::protobuf::MessageFactory* absl_nonnull message_factory,
209
0
    google::protobuf::Message* absl_nonnull json) const {
210
0
  ABSL_DCHECK(descriptor_pool != nullptr);
211
0
  ABSL_DCHECK(message_factory != nullptr);
212
0
  ABSL_DCHECK(json != nullptr);
213
0
  ABSL_DCHECK_EQ(json->GetDescriptor()->well_known_type(),
214
0
                 google::protobuf::Descriptor::WELLKNOWNTYPE_STRUCT);
215
216
0
  return variant_.Visit(absl::Overload(
217
0
      [](std::monostate) -> absl::Status {
218
0
        return absl::InternalError("use of invalid Value");
219
0
      },
220
0
      [descriptor_pool, message_factory, json](
221
0
          const common_internal::LegacyMapValue& alternative) -> absl::Status {
222
0
        return alternative.ConvertToJsonObject(descriptor_pool, message_factory,
223
0
                                               json);
224
0
      },
225
0
      [descriptor_pool, message_factory,
226
0
       json](const CustomMapValue& alternative) -> absl::Status {
227
0
        return alternative.ConvertToJsonObject(descriptor_pool, message_factory,
228
0
                                               json);
229
0
      },
230
0
      [descriptor_pool, message_factory,
231
0
       json](const ParsedMapFieldValue& alternative) -> absl::Status {
232
0
        return alternative.ConvertToJsonObject(descriptor_pool, message_factory,
233
0
                                               json);
234
0
      },
235
0
      [descriptor_pool, message_factory,
236
0
       json](const ParsedJsonMapValue& alternative) -> absl::Status {
237
0
        return alternative.ConvertToJsonObject(descriptor_pool, message_factory,
238
0
                                               json);
239
0
      },
240
0
      [descriptor_pool, message_factory,
241
0
       json](const common_internal::LegacyStructValue& alternative)
242
0
          -> absl::Status {
243
0
        return alternative.ConvertToJsonObject(descriptor_pool, message_factory,
244
0
                                               json);
245
0
      },
246
0
      [descriptor_pool, message_factory,
247
0
       json](const CustomStructValue& alternative) -> absl::Status {
248
0
        return alternative.ConvertToJsonObject(descriptor_pool, message_factory,
249
0
                                               json);
250
0
      },
251
0
      [descriptor_pool, message_factory,
252
0
       json](const ParsedMessageValue& alternative) -> absl::Status {
253
0
        return alternative.ConvertToJsonObject(descriptor_pool, message_factory,
254
0
                                               json);
255
0
      },
256
0
      [](const auto& alternative) -> absl::Status {
257
0
        return TypeConversionError(alternative.GetTypeName(),
258
0
                                   "google.protobuf.Struct")
259
0
            .NativeValue();
260
0
      }));
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonObject(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_8::operator()<cel::NullValue>(cel::NullValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonObject(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_8::operator()<cel::BoolValue>(cel::BoolValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonObject(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_8::operator()<cel::IntValue>(cel::IntValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonObject(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_8::operator()<cel::UintValue>(cel::UintValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonObject(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_8::operator()<cel::DoubleValue>(cel::DoubleValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonObject(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_8::operator()<cel::DurationValue>(cel::DurationValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonObject(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_8::operator()<cel::TimestampValue>(cel::TimestampValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonObject(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_8::operator()<cel::TypeValue>(cel::TypeValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonObject(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_8::operator()<cel::common_internal::LegacyListValue>(cel::common_internal::LegacyListValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonObject(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_8::operator()<cel::ParsedJsonListValue>(cel::ParsedJsonListValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonObject(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_8::operator()<cel::ParsedRepeatedFieldValue>(cel::ParsedRepeatedFieldValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonObject(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_8::operator()<cel::CustomListValue>(cel::CustomListValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonObject(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_8::operator()<cel::OpaqueValue>(cel::OpaqueValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonObject(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_8::operator()<cel::BytesValue>(cel::BytesValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonObject(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_8::operator()<cel::StringValue>(cel::StringValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonObject(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_8::operator()<cel::ErrorValue>(cel::ErrorValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonObject(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_8::operator()<cel::UnknownValue>(cel::UnknownValue const&) const
261
0
}
262
263
absl::Status Value::Equal(
264
    const Value& other,
265
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
266
    google::protobuf::MessageFactory* absl_nonnull message_factory,
267
435k
    google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull result) const {
268
435k
  ABSL_DCHECK(descriptor_pool != nullptr);
269
435k
  ABSL_DCHECK(message_factory != nullptr);
270
435k
  ABSL_DCHECK(arena != nullptr);
271
435k
  ABSL_DCHECK(result != nullptr);
272
273
435k
  return variant_.Visit([&other, descriptor_pool, message_factory, arena,
274
435k
                         result](const auto& alternative) -> absl::Status {
275
435k
    return alternative.Equal(other, descriptor_pool, message_factory, arena,
276
435k
                             result);
277
435k
  });
value.cc:absl::lts_20260526::Status cel::Value::Equal(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::NullValue>(cel::NullValue const&) const
Line
Count
Source
274
530
                         result](const auto& alternative) -> absl::Status {
275
530
    return alternative.Equal(other, descriptor_pool, message_factory, arena,
276
530
                             result);
277
530
  });
value.cc:absl::lts_20260526::Status cel::Value::Equal(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::BoolValue>(cel::BoolValue const&) const
Line
Count
Source
274
35.9k
                         result](const auto& alternative) -> absl::Status {
275
35.9k
    return alternative.Equal(other, descriptor_pool, message_factory, arena,
276
35.9k
                             result);
277
35.9k
  });
value.cc:absl::lts_20260526::Status cel::Value::Equal(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::IntValue>(cel::IntValue const&) const
Line
Count
Source
274
20.3k
                         result](const auto& alternative) -> absl::Status {
275
20.3k
    return alternative.Equal(other, descriptor_pool, message_factory, arena,
276
20.3k
                             result);
277
20.3k
  });
value.cc:absl::lts_20260526::Status cel::Value::Equal(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::UintValue>(cel::UintValue const&) const
Line
Count
Source
274
234k
                         result](const auto& alternative) -> absl::Status {
275
234k
    return alternative.Equal(other, descriptor_pool, message_factory, arena,
276
234k
                             result);
277
234k
  });
value.cc:absl::lts_20260526::Status cel::Value::Equal(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::DoubleValue>(cel::DoubleValue const&) const
Line
Count
Source
274
3.70k
                         result](const auto& alternative) -> absl::Status {
275
3.70k
    return alternative.Equal(other, descriptor_pool, message_factory, arena,
276
3.70k
                             result);
277
3.70k
  });
value.cc:absl::lts_20260526::Status cel::Value::Equal(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::DurationValue>(cel::DurationValue const&) const
Line
Count
Source
274
13.3k
                         result](const auto& alternative) -> absl::Status {
275
13.3k
    return alternative.Equal(other, descriptor_pool, message_factory, arena,
276
13.3k
                             result);
277
13.3k
  });
value.cc:absl::lts_20260526::Status cel::Value::Equal(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::TimestampValue>(cel::TimestampValue const&) const
Line
Count
Source
274
221
                         result](const auto& alternative) -> absl::Status {
275
221
    return alternative.Equal(other, descriptor_pool, message_factory, arena,
276
221
                             result);
277
221
  });
value.cc:absl::lts_20260526::Status cel::Value::Equal(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::TypeValue>(cel::TypeValue const&) const
Line
Count
Source
274
444
                         result](const auto& alternative) -> absl::Status {
275
444
    return alternative.Equal(other, descriptor_pool, message_factory, arena,
276
444
                             result);
277
444
  });
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::Equal(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::common_internal::LegacyListValue>(cel::common_internal::LegacyListValue const&) const
value.cc:absl::lts_20260526::Status cel::Value::Equal(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::ParsedJsonListValue>(cel::ParsedJsonListValue const&) const
Line
Count
Source
274
1.03k
                         result](const auto& alternative) -> absl::Status {
275
1.03k
    return alternative.Equal(other, descriptor_pool, message_factory, arena,
276
1.03k
                             result);
277
1.03k
  });
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::Equal(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::ParsedRepeatedFieldValue>(cel::ParsedRepeatedFieldValue const&) const
value.cc:absl::lts_20260526::Status cel::Value::Equal(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::CustomListValue>(cel::CustomListValue const&) const
Line
Count
Source
274
41.1k
                         result](const auto& alternative) -> absl::Status {
275
41.1k
    return alternative.Equal(other, descriptor_pool, message_factory, arena,
276
41.1k
                             result);
277
41.1k
  });
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::Equal(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::common_internal::LegacyMapValue>(cel::common_internal::LegacyMapValue const&) const
value.cc:absl::lts_20260526::Status cel::Value::Equal(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::ParsedJsonMapValue>(cel::ParsedJsonMapValue const&) const
Line
Count
Source
274
869
                         result](const auto& alternative) -> absl::Status {
275
869
    return alternative.Equal(other, descriptor_pool, message_factory, arena,
276
869
                             result);
277
869
  });
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::Equal(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::ParsedMapFieldValue>(cel::ParsedMapFieldValue const&) const
value.cc:absl::lts_20260526::Status cel::Value::Equal(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::CustomMapValue>(cel::CustomMapValue const&) const
Line
Count
Source
274
36.1k
                         result](const auto& alternative) -> absl::Status {
275
36.1k
    return alternative.Equal(other, descriptor_pool, message_factory, arena,
276
36.1k
                             result);
277
36.1k
  });
value.cc:absl::lts_20260526::Status cel::Value::Equal(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::common_internal::LegacyStructValue>(cel::common_internal::LegacyStructValue const&) const
Line
Count
Source
274
20.2k
                         result](const auto& alternative) -> absl::Status {
275
20.2k
    return alternative.Equal(other, descriptor_pool, message_factory, arena,
276
20.2k
                             result);
277
20.2k
  });
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::Equal(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::ParsedMessageValue>(cel::ParsedMessageValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::Equal(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::CustomStructValue>(cel::CustomStructValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::Equal(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::OpaqueValue>(cel::OpaqueValue const&) const
value.cc:absl::lts_20260526::Status cel::Value::Equal(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::BytesValue>(cel::BytesValue const&) const
Line
Count
Source
274
4.90k
                         result](const auto& alternative) -> absl::Status {
275
4.90k
    return alternative.Equal(other, descriptor_pool, message_factory, arena,
276
4.90k
                             result);
277
4.90k
  });
value.cc:absl::lts_20260526::Status cel::Value::Equal(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::StringValue>(cel::StringValue const&) const
Line
Count
Source
274
23.0k
                         result](const auto& alternative) -> absl::Status {
275
23.0k
    return alternative.Equal(other, descriptor_pool, message_factory, arena,
276
23.0k
                             result);
277
23.0k
  });
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::Equal(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::ErrorValue>(cel::ErrorValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::Equal(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::UnknownValue>(cel::UnknownValue const&) const
278
435k
}
279
280
0
bool Value::IsZeroValue() const {
281
0
  return variant_.Visit([](const auto& alternative) -> bool {
282
0
    return alternative.IsZeroValue();
283
0
  });
Unexecuted instantiation: value.cc:bool cel::Value::IsZeroValue() const::$_0::operator()<cel::NullValue>(cel::NullValue const&) const
Unexecuted instantiation: value.cc:bool cel::Value::IsZeroValue() const::$_0::operator()<cel::BoolValue>(cel::BoolValue const&) const
Unexecuted instantiation: value.cc:bool cel::Value::IsZeroValue() const::$_0::operator()<cel::IntValue>(cel::IntValue const&) const
Unexecuted instantiation: value.cc:bool cel::Value::IsZeroValue() const::$_0::operator()<cel::UintValue>(cel::UintValue const&) const
Unexecuted instantiation: value.cc:bool cel::Value::IsZeroValue() const::$_0::operator()<cel::DoubleValue>(cel::DoubleValue const&) const
Unexecuted instantiation: value.cc:bool cel::Value::IsZeroValue() const::$_0::operator()<cel::DurationValue>(cel::DurationValue const&) const
Unexecuted instantiation: value.cc:bool cel::Value::IsZeroValue() const::$_0::operator()<cel::TimestampValue>(cel::TimestampValue const&) const
Unexecuted instantiation: value.cc:bool cel::Value::IsZeroValue() const::$_0::operator()<cel::TypeValue>(cel::TypeValue const&) const
Unexecuted instantiation: value.cc:bool cel::Value::IsZeroValue() const::$_0::operator()<cel::common_internal::LegacyListValue>(cel::common_internal::LegacyListValue const&) const
Unexecuted instantiation: value.cc:bool cel::Value::IsZeroValue() const::$_0::operator()<cel::ParsedJsonListValue>(cel::ParsedJsonListValue const&) const
Unexecuted instantiation: value.cc:bool cel::Value::IsZeroValue() const::$_0::operator()<cel::ParsedRepeatedFieldValue>(cel::ParsedRepeatedFieldValue const&) const
Unexecuted instantiation: value.cc:bool cel::Value::IsZeroValue() const::$_0::operator()<cel::CustomListValue>(cel::CustomListValue const&) const
Unexecuted instantiation: value.cc:bool cel::Value::IsZeroValue() const::$_0::operator()<cel::common_internal::LegacyMapValue>(cel::common_internal::LegacyMapValue const&) const
Unexecuted instantiation: value.cc:bool cel::Value::IsZeroValue() const::$_0::operator()<cel::ParsedJsonMapValue>(cel::ParsedJsonMapValue const&) const
Unexecuted instantiation: value.cc:bool cel::Value::IsZeroValue() const::$_0::operator()<cel::ParsedMapFieldValue>(cel::ParsedMapFieldValue const&) const
Unexecuted instantiation: value.cc:bool cel::Value::IsZeroValue() const::$_0::operator()<cel::CustomMapValue>(cel::CustomMapValue const&) const
Unexecuted instantiation: value.cc:bool cel::Value::IsZeroValue() const::$_0::operator()<cel::common_internal::LegacyStructValue>(cel::common_internal::LegacyStructValue const&) const
Unexecuted instantiation: value.cc:bool cel::Value::IsZeroValue() const::$_0::operator()<cel::ParsedMessageValue>(cel::ParsedMessageValue const&) const
Unexecuted instantiation: value.cc:bool cel::Value::IsZeroValue() const::$_0::operator()<cel::CustomStructValue>(cel::CustomStructValue const&) const
Unexecuted instantiation: value.cc:bool cel::Value::IsZeroValue() const::$_0::operator()<cel::OpaqueValue>(cel::OpaqueValue const&) const
Unexecuted instantiation: value.cc:bool cel::Value::IsZeroValue() const::$_0::operator()<cel::BytesValue>(cel::BytesValue const&) const
Unexecuted instantiation: value.cc:bool cel::Value::IsZeroValue() const::$_0::operator()<cel::StringValue>(cel::StringValue const&) const
Unexecuted instantiation: value.cc:bool cel::Value::IsZeroValue() const::$_0::operator()<cel::ErrorValue>(cel::ErrorValue const&) const
Unexecuted instantiation: value.cc:bool cel::Value::IsZeroValue() const::$_0::operator()<cel::UnknownValue>(cel::UnknownValue const&) const
284
0
}
285
286
namespace {
287
288
template <typename, typename = void>
289
struct HasCloneMethod : std::false_type {};
290
291
template <typename T>
292
struct HasCloneMethod<T, std::void_t<decltype(std::declval<const T>().Clone(
293
                             std::declval<google::protobuf::Arena* absl_nonnull>()))>>
294
    : std::true_type {};
295
296
}  // namespace
297
298
0
Value Value::Clone(google::protobuf::Arena* absl_nonnull arena) const {
299
0
  return variant_.Visit([arena](const auto& alternative) -> Value {
300
    if constexpr (IsMonostate<decltype(alternative)>::value) {
301
      return Value();
302
    } else if constexpr (HasCloneMethod<absl::remove_cvref_t<
303
0
                             decltype(alternative)>>::value) {
304
0
      return alternative.Clone(arena);
305
0
    } else {
306
0
      return alternative;
307
0
    }
308
0
  });
Unexecuted instantiation: value.cc:cel::Value cel::Value::Clone(google::protobuf::Arena*) const::$_0::operator()<cel::NullValue>(cel::NullValue const&) const
Unexecuted instantiation: value.cc:cel::Value cel::Value::Clone(google::protobuf::Arena*) const::$_0::operator()<cel::BoolValue>(cel::BoolValue const&) const
Unexecuted instantiation: value.cc:cel::Value cel::Value::Clone(google::protobuf::Arena*) const::$_0::operator()<cel::IntValue>(cel::IntValue const&) const
Unexecuted instantiation: value.cc:cel::Value cel::Value::Clone(google::protobuf::Arena*) const::$_0::operator()<cel::UintValue>(cel::UintValue const&) const
Unexecuted instantiation: value.cc:cel::Value cel::Value::Clone(google::protobuf::Arena*) const::$_0::operator()<cel::DoubleValue>(cel::DoubleValue const&) const
Unexecuted instantiation: value.cc:cel::Value cel::Value::Clone(google::protobuf::Arena*) const::$_0::operator()<cel::DurationValue>(cel::DurationValue const&) const
Unexecuted instantiation: value.cc:cel::Value cel::Value::Clone(google::protobuf::Arena*) const::$_0::operator()<cel::TimestampValue>(cel::TimestampValue const&) const
Unexecuted instantiation: value.cc:cel::Value cel::Value::Clone(google::protobuf::Arena*) const::$_0::operator()<cel::TypeValue>(cel::TypeValue const&) const
Unexecuted instantiation: value.cc:cel::Value cel::Value::Clone(google::protobuf::Arena*) const::$_0::operator()<cel::common_internal::LegacyListValue>(cel::common_internal::LegacyListValue const&) const
Unexecuted instantiation: value.cc:cel::Value cel::Value::Clone(google::protobuf::Arena*) const::$_0::operator()<cel::ParsedJsonListValue>(cel::ParsedJsonListValue const&) const
Unexecuted instantiation: value.cc:cel::Value cel::Value::Clone(google::protobuf::Arena*) const::$_0::operator()<cel::ParsedRepeatedFieldValue>(cel::ParsedRepeatedFieldValue const&) const
Unexecuted instantiation: value.cc:cel::Value cel::Value::Clone(google::protobuf::Arena*) const::$_0::operator()<cel::CustomListValue>(cel::CustomListValue const&) const
Unexecuted instantiation: value.cc:cel::Value cel::Value::Clone(google::protobuf::Arena*) const::$_0::operator()<cel::common_internal::LegacyMapValue>(cel::common_internal::LegacyMapValue const&) const
Unexecuted instantiation: value.cc:cel::Value cel::Value::Clone(google::protobuf::Arena*) const::$_0::operator()<cel::ParsedJsonMapValue>(cel::ParsedJsonMapValue const&) const
Unexecuted instantiation: value.cc:cel::Value cel::Value::Clone(google::protobuf::Arena*) const::$_0::operator()<cel::ParsedMapFieldValue>(cel::ParsedMapFieldValue const&) const
Unexecuted instantiation: value.cc:cel::Value cel::Value::Clone(google::protobuf::Arena*) const::$_0::operator()<cel::CustomMapValue>(cel::CustomMapValue const&) const
Unexecuted instantiation: value.cc:cel::Value cel::Value::Clone(google::protobuf::Arena*) const::$_0::operator()<cel::common_internal::LegacyStructValue>(cel::common_internal::LegacyStructValue const&) const
Unexecuted instantiation: value.cc:cel::Value cel::Value::Clone(google::protobuf::Arena*) const::$_0::operator()<cel::ParsedMessageValue>(cel::ParsedMessageValue const&) const
Unexecuted instantiation: value.cc:cel::Value cel::Value::Clone(google::protobuf::Arena*) const::$_0::operator()<cel::CustomStructValue>(cel::CustomStructValue const&) const
Unexecuted instantiation: value.cc:cel::Value cel::Value::Clone(google::protobuf::Arena*) const::$_0::operator()<cel::OpaqueValue>(cel::OpaqueValue const&) const
Unexecuted instantiation: value.cc:cel::Value cel::Value::Clone(google::protobuf::Arena*) const::$_0::operator()<cel::BytesValue>(cel::BytesValue const&) const
Unexecuted instantiation: value.cc:cel::Value cel::Value::Clone(google::protobuf::Arena*) const::$_0::operator()<cel::StringValue>(cel::StringValue const&) const
Unexecuted instantiation: value.cc:cel::Value cel::Value::Clone(google::protobuf::Arena*) const::$_0::operator()<cel::ErrorValue>(cel::ErrorValue const&) const
Unexecuted instantiation: value.cc:cel::Value cel::Value::Clone(google::protobuf::Arena*) const::$_0::operator()<cel::UnknownValue>(cel::UnknownValue const&) const
309
0
}
310
311
0
std::ostream& operator<<(std::ostream& out, const Value& value) {
312
0
  return value.variant_.Visit([&out](const auto& alternative) -> std::ostream& {
313
0
    return out << alternative;
314
0
  });
Unexecuted instantiation: value.cc:std::__1::basic_ostream<char, std::__1::char_traits<char> >& cel::operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, cel::Value const&)::$_0::operator()<cel::NullValue>(cel::NullValue const&) const
Unexecuted instantiation: value.cc:std::__1::basic_ostream<char, std::__1::char_traits<char> >& cel::operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, cel::Value const&)::$_0::operator()<cel::BoolValue>(cel::BoolValue const&) const
Unexecuted instantiation: value.cc:std::__1::basic_ostream<char, std::__1::char_traits<char> >& cel::operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, cel::Value const&)::$_0::operator()<cel::IntValue>(cel::IntValue const&) const
Unexecuted instantiation: value.cc:std::__1::basic_ostream<char, std::__1::char_traits<char> >& cel::operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, cel::Value const&)::$_0::operator()<cel::UintValue>(cel::UintValue const&) const
Unexecuted instantiation: value.cc:std::__1::basic_ostream<char, std::__1::char_traits<char> >& cel::operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, cel::Value const&)::$_0::operator()<cel::DoubleValue>(cel::DoubleValue const&) const
Unexecuted instantiation: value.cc:std::__1::basic_ostream<char, std::__1::char_traits<char> >& cel::operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, cel::Value const&)::$_0::operator()<cel::DurationValue>(cel::DurationValue const&) const
Unexecuted instantiation: value.cc:std::__1::basic_ostream<char, std::__1::char_traits<char> >& cel::operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, cel::Value const&)::$_0::operator()<cel::TimestampValue>(cel::TimestampValue const&) const
Unexecuted instantiation: value.cc:std::__1::basic_ostream<char, std::__1::char_traits<char> >& cel::operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, cel::Value const&)::$_0::operator()<cel::TypeValue>(cel::TypeValue const&) const
Unexecuted instantiation: value.cc:std::__1::basic_ostream<char, std::__1::char_traits<char> >& cel::operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, cel::Value const&)::$_0::operator()<cel::common_internal::LegacyListValue>(cel::common_internal::LegacyListValue const&) const
Unexecuted instantiation: value.cc:std::__1::basic_ostream<char, std::__1::char_traits<char> >& cel::operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, cel::Value const&)::$_0::operator()<cel::ParsedJsonListValue>(cel::ParsedJsonListValue const&) const
Unexecuted instantiation: value.cc:std::__1::basic_ostream<char, std::__1::char_traits<char> >& cel::operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, cel::Value const&)::$_0::operator()<cel::ParsedRepeatedFieldValue>(cel::ParsedRepeatedFieldValue const&) const
Unexecuted instantiation: value.cc:std::__1::basic_ostream<char, std::__1::char_traits<char> >& cel::operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, cel::Value const&)::$_0::operator()<cel::CustomListValue>(cel::CustomListValue const&) const
Unexecuted instantiation: value.cc:std::__1::basic_ostream<char, std::__1::char_traits<char> >& cel::operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, cel::Value const&)::$_0::operator()<cel::common_internal::LegacyMapValue>(cel::common_internal::LegacyMapValue const&) const
Unexecuted instantiation: value.cc:std::__1::basic_ostream<char, std::__1::char_traits<char> >& cel::operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, cel::Value const&)::$_0::operator()<cel::ParsedJsonMapValue>(cel::ParsedJsonMapValue const&) const
Unexecuted instantiation: value.cc:std::__1::basic_ostream<char, std::__1::char_traits<char> >& cel::operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, cel::Value const&)::$_0::operator()<cel::ParsedMapFieldValue>(cel::ParsedMapFieldValue const&) const
Unexecuted instantiation: value.cc:std::__1::basic_ostream<char, std::__1::char_traits<char> >& cel::operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, cel::Value const&)::$_0::operator()<cel::CustomMapValue>(cel::CustomMapValue const&) const
Unexecuted instantiation: value.cc:std::__1::basic_ostream<char, std::__1::char_traits<char> >& cel::operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, cel::Value const&)::$_0::operator()<cel::common_internal::LegacyStructValue>(cel::common_internal::LegacyStructValue const&) const
Unexecuted instantiation: value.cc:std::__1::basic_ostream<char, std::__1::char_traits<char> >& cel::operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, cel::Value const&)::$_0::operator()<cel::ParsedMessageValue>(cel::ParsedMessageValue const&) const
Unexecuted instantiation: value.cc:std::__1::basic_ostream<char, std::__1::char_traits<char> >& cel::operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, cel::Value const&)::$_0::operator()<cel::CustomStructValue>(cel::CustomStructValue const&) const
Unexecuted instantiation: value.cc:std::__1::basic_ostream<char, std::__1::char_traits<char> >& cel::operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, cel::Value const&)::$_0::operator()<cel::OpaqueValue>(cel::OpaqueValue const&) const
Unexecuted instantiation: value.cc:std::__1::basic_ostream<char, std::__1::char_traits<char> >& cel::operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, cel::Value const&)::$_0::operator()<cel::BytesValue>(cel::BytesValue const&) const
Unexecuted instantiation: value.cc:std::__1::basic_ostream<char, std::__1::char_traits<char> >& cel::operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, cel::Value const&)::$_0::operator()<cel::StringValue>(cel::StringValue const&) const
Unexecuted instantiation: value.cc:std::__1::basic_ostream<char, std::__1::char_traits<char> >& cel::operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, cel::Value const&)::$_0::operator()<cel::ErrorValue>(cel::ErrorValue const&) const
Unexecuted instantiation: value.cc:std::__1::basic_ostream<char, std::__1::char_traits<char> >& cel::operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, cel::Value const&)::$_0::operator()<cel::UnknownValue>(cel::UnknownValue const&) const
315
0
}
316
317
namespace {
318
319
0
Value NonNullEnumValue(const google::protobuf::EnumValueDescriptor* absl_nonnull value) {
320
0
  ABSL_DCHECK(value != nullptr);
321
0
  return IntValue(value->number());
322
0
}
323
324
Value NonNullEnumValue(const google::protobuf::EnumDescriptor* absl_nonnull type,
325
0
                       int32_t number) {
326
0
  ABSL_DCHECK(type != nullptr);
327
0
  if (type->is_closed()) {
328
0
    if (ABSL_PREDICT_FALSE(type->FindValueByNumber(number) == nullptr)) {
329
0
      return ErrorValue(absl::InvalidArgumentError(absl::StrCat(
330
0
          "closed enum has no such value: ", type->full_name(), ".", number)));
331
0
    }
332
0
  }
333
0
  return IntValue(number);
334
0
}
335
336
}  // namespace
337
338
0
Value Value::Enum(const google::protobuf::EnumValueDescriptor* absl_nonnull value) {
339
0
  ABSL_DCHECK(value != nullptr);
340
0
  if (value->type()->full_name() == "google.protobuf.NullValue") {
341
0
    ABSL_DCHECK_EQ(value->number(), 0);
342
0
    return NullValue();
343
0
  }
344
0
  return NonNullEnumValue(value);
345
0
}
346
347
Value Value::Enum(const google::protobuf::EnumDescriptor* absl_nonnull type,
348
                  int32_t number) {
349
  ABSL_DCHECK(type != nullptr);
350
  if (type->full_name() == "google.protobuf.NullValue") {
351
    ABSL_DCHECK_EQ(number, 0);
352
    return NullValue();
353
  }
354
  return NonNullEnumValue(type, number);
355
}
356
357
namespace common_internal {
358
359
namespace {
360
361
void BoolMapFieldKeyAccessor(const google::protobuf::MapKey& key,
362
                             const google::protobuf::Message* absl_nonnull message,
363
                             google::protobuf::Arena* absl_nonnull arena,
364
0
                             Value* absl_nonnull result) {
365
0
  ABSL_DCHECK(message != nullptr);
366
0
  ABSL_DCHECK(arena != nullptr);
367
0
  ABSL_DCHECK(result != nullptr);
368
369
0
  *result = BoolValue(key.GetBoolValue());
370
0
}
371
372
void Int32MapFieldKeyAccessor(const google::protobuf::MapKey& key,
373
                              const google::protobuf::Message* absl_nonnull message,
374
                              google::protobuf::Arena* absl_nonnull arena,
375
0
                              Value* absl_nonnull result) {
376
0
  ABSL_DCHECK(message != nullptr);
377
0
  ABSL_DCHECK(arena != nullptr);
378
0
  ABSL_DCHECK(result != nullptr);
379
380
0
  *result = IntValue(key.GetInt32Value());
381
0
}
382
383
void Int64MapFieldKeyAccessor(const google::protobuf::MapKey& key,
384
                              const google::protobuf::Message* absl_nonnull message,
385
                              google::protobuf::Arena* absl_nonnull arena,
386
0
                              Value* absl_nonnull result) {
387
0
  ABSL_DCHECK(message != nullptr);
388
0
  ABSL_DCHECK(arena != nullptr);
389
0
  ABSL_DCHECK(result != nullptr);
390
391
0
  *result = IntValue(key.GetInt64Value());
392
0
}
393
394
void UInt32MapFieldKeyAccessor(const google::protobuf::MapKey& key,
395
                               const google::protobuf::Message* absl_nonnull message,
396
                               google::protobuf::Arena* absl_nonnull arena,
397
0
                               Value* absl_nonnull result) {
398
0
  ABSL_DCHECK(message != nullptr);
399
0
  ABSL_DCHECK(arena != nullptr);
400
0
  ABSL_DCHECK(result != nullptr);
401
402
0
  *result = UintValue(key.GetUInt32Value());
403
0
}
404
405
void UInt64MapFieldKeyAccessor(const google::protobuf::MapKey& key,
406
                               const google::protobuf::Message* absl_nonnull message,
407
                               google::protobuf::Arena* absl_nonnull arena,
408
0
                               Value* absl_nonnull result) {
409
0
  ABSL_DCHECK(message != nullptr);
410
0
  ABSL_DCHECK(arena != nullptr);
411
0
  ABSL_DCHECK(result != nullptr);
412
413
0
  *result = UintValue(key.GetUInt64Value());
414
0
}
415
416
void StringMapFieldKeyAccessor(const google::protobuf::MapKey& key,
417
                               const google::protobuf::Message* absl_nonnull message,
418
                               google::protobuf::Arena* absl_nonnull arena,
419
0
                               Value* absl_nonnull result) {
420
0
  ABSL_DCHECK(message != nullptr);
421
0
  ABSL_DCHECK(arena != nullptr);
422
0
  ABSL_DCHECK(result != nullptr);
423
424
0
#if CEL_INTERNAL_PROTOBUF_OSS_VERSION_PREREQ(5, 30, 0)
425
0
  *result = StringValue(Borrower::Arena(MessageArenaOr(message, arena)),
426
0
                        key.GetStringValue());
427
#else
428
  *result = StringValue(arena, key.GetStringValue());
429
#endif
430
0
}
431
432
}  // namespace
433
434
absl::StatusOr<MapFieldKeyAccessor> MapFieldKeyAccessorFor(
435
0
    const google::protobuf::FieldDescriptor* absl_nonnull field) {
436
0
  switch (field->cpp_type()) {
437
0
    case google::protobuf::FieldDescriptor::CPPTYPE_BOOL:
438
0
      return &BoolMapFieldKeyAccessor;
439
0
    case google::protobuf::FieldDescriptor::CPPTYPE_INT32:
440
0
      return &Int32MapFieldKeyAccessor;
441
0
    case google::protobuf::FieldDescriptor::CPPTYPE_INT64:
442
0
      return &Int64MapFieldKeyAccessor;
443
0
    case google::protobuf::FieldDescriptor::CPPTYPE_UINT32:
444
0
      return &UInt32MapFieldKeyAccessor;
445
0
    case google::protobuf::FieldDescriptor::CPPTYPE_UINT64:
446
0
      return &UInt64MapFieldKeyAccessor;
447
0
    case google::protobuf::FieldDescriptor::CPPTYPE_STRING:
448
0
      return &StringMapFieldKeyAccessor;
449
0
    default:
450
0
      return absl::InvalidArgumentError(
451
0
          absl::StrCat("unexpected map key type: ", field->cpp_type_name()));
452
0
  }
453
0
}
454
455
namespace {
456
457
void DoubleMapFieldValueAccessor(
458
    const google::protobuf::MapValueConstRef& value,
459
    const google::protobuf::Message* absl_nonnull message,
460
    const google::protobuf::FieldDescriptor* absl_nonnull field,
461
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
462
    google::protobuf::MessageFactory* absl_nonnull message_factory,
463
0
    google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull result) {
464
0
  ABSL_DCHECK(message != nullptr);
465
0
  ABSL_DCHECK(field != nullptr);
466
0
  ABSL_DCHECK(descriptor_pool != nullptr);
467
0
  ABSL_DCHECK(message_factory != nullptr);
468
0
  ABSL_DCHECK(arena != nullptr);
469
0
  ABSL_DCHECK(result != nullptr);
470
0
  ABSL_DCHECK(!field->is_repeated());
471
0
  ABSL_DCHECK_EQ(field->cpp_type(), google::protobuf::FieldDescriptor::CPPTYPE_DOUBLE);
472
473
0
  *result = DoubleValue(value.GetDoubleValue());
474
0
}
475
476
void FloatMapFieldValueAccessor(
477
    const google::protobuf::MapValueConstRef& value,
478
    const google::protobuf::Message* absl_nonnull message,
479
    const google::protobuf::FieldDescriptor* absl_nonnull field,
480
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
481
    google::protobuf::MessageFactory* absl_nonnull message_factory,
482
0
    google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull result) {
483
0
  ABSL_DCHECK(message != nullptr);
484
0
  ABSL_DCHECK(field != nullptr);
485
0
  ABSL_DCHECK(descriptor_pool != nullptr);
486
0
  ABSL_DCHECK(message_factory != nullptr);
487
0
  ABSL_DCHECK(arena != nullptr);
488
0
  ABSL_DCHECK(result != nullptr);
489
0
  ABSL_DCHECK(!field->is_repeated());
490
0
  ABSL_DCHECK_EQ(field->cpp_type(), google::protobuf::FieldDescriptor::CPPTYPE_FLOAT);
491
492
0
  *result = DoubleValue(value.GetFloatValue());
493
0
}
494
495
void Int64MapFieldValueAccessor(
496
    const google::protobuf::MapValueConstRef& value,
497
    const google::protobuf::Message* absl_nonnull message,
498
    const google::protobuf::FieldDescriptor* absl_nonnull field,
499
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
500
    google::protobuf::MessageFactory* absl_nonnull message_factory,
501
0
    google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull result) {
502
0
  ABSL_DCHECK(message != nullptr);
503
0
  ABSL_DCHECK(field != nullptr);
504
0
  ABSL_DCHECK(descriptor_pool != nullptr);
505
0
  ABSL_DCHECK(message_factory != nullptr);
506
0
  ABSL_DCHECK(arena != nullptr);
507
0
  ABSL_DCHECK(result != nullptr);
508
0
  ABSL_DCHECK(!field->is_repeated());
509
0
  ABSL_DCHECK_EQ(field->cpp_type(), google::protobuf::FieldDescriptor::CPPTYPE_INT64);
510
511
0
  *result = IntValue(value.GetInt64Value());
512
0
}
513
514
void UInt64MapFieldValueAccessor(
515
    const google::protobuf::MapValueConstRef& value,
516
    const google::protobuf::Message* absl_nonnull message,
517
    const google::protobuf::FieldDescriptor* absl_nonnull field,
518
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
519
    google::protobuf::MessageFactory* absl_nonnull message_factory,
520
0
    google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull result) {
521
0
  ABSL_DCHECK(message != nullptr);
522
0
  ABSL_DCHECK(field != nullptr);
523
0
  ABSL_DCHECK(descriptor_pool != nullptr);
524
0
  ABSL_DCHECK(message_factory != nullptr);
525
0
  ABSL_DCHECK(arena != nullptr);
526
0
  ABSL_DCHECK(result != nullptr);
527
0
  ABSL_DCHECK(!field->is_repeated());
528
0
  ABSL_DCHECK_EQ(field->cpp_type(), google::protobuf::FieldDescriptor::CPPTYPE_UINT64);
529
530
0
  *result = UintValue(value.GetUInt64Value());
531
0
}
532
533
void Int32MapFieldValueAccessor(
534
    const google::protobuf::MapValueConstRef& value,
535
    const google::protobuf::Message* absl_nonnull message,
536
    const google::protobuf::FieldDescriptor* absl_nonnull field,
537
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
538
    google::protobuf::MessageFactory* absl_nonnull message_factory,
539
0
    google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull result) {
540
0
  ABSL_DCHECK(message != nullptr);
541
0
  ABSL_DCHECK(field != nullptr);
542
0
  ABSL_DCHECK(descriptor_pool != nullptr);
543
0
  ABSL_DCHECK(message_factory != nullptr);
544
0
  ABSL_DCHECK(arena != nullptr);
545
0
  ABSL_DCHECK(result != nullptr);
546
0
  ABSL_DCHECK(!field->is_repeated());
547
0
  ABSL_DCHECK_EQ(field->cpp_type(), google::protobuf::FieldDescriptor::CPPTYPE_INT32);
548
549
0
  *result = IntValue(value.GetInt32Value());
550
0
}
551
552
void UInt32MapFieldValueAccessor(
553
    const google::protobuf::MapValueConstRef& value,
554
    const google::protobuf::Message* absl_nonnull message,
555
    const google::protobuf::FieldDescriptor* absl_nonnull field,
556
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
557
    google::protobuf::MessageFactory* absl_nonnull message_factory,
558
0
    google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull result) {
559
0
  ABSL_DCHECK(message != nullptr);
560
0
  ABSL_DCHECK(field != nullptr);
561
0
  ABSL_DCHECK(descriptor_pool != nullptr);
562
0
  ABSL_DCHECK(message_factory != nullptr);
563
0
  ABSL_DCHECK(arena != nullptr);
564
0
  ABSL_DCHECK(result != nullptr);
565
0
  ABSL_DCHECK(!field->is_repeated());
566
0
  ABSL_DCHECK_EQ(field->cpp_type(), google::protobuf::FieldDescriptor::CPPTYPE_UINT32);
567
568
0
  *result = UintValue(value.GetUInt32Value());
569
0
}
570
571
void BoolMapFieldValueAccessor(
572
    const google::protobuf::MapValueConstRef& value,
573
    const google::protobuf::Message* absl_nonnull message,
574
    const google::protobuf::FieldDescriptor* absl_nonnull field,
575
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
576
    google::protobuf::MessageFactory* absl_nonnull message_factory,
577
0
    google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull result) {
578
0
  ABSL_DCHECK(message != nullptr);
579
0
  ABSL_DCHECK(field != nullptr);
580
0
  ABSL_DCHECK(descriptor_pool != nullptr);
581
0
  ABSL_DCHECK(message_factory != nullptr);
582
0
  ABSL_DCHECK(arena != nullptr);
583
0
  ABSL_DCHECK(result != nullptr);
584
0
  ABSL_DCHECK(!field->is_repeated());
585
0
  ABSL_DCHECK_EQ(field->cpp_type(), google::protobuf::FieldDescriptor::CPPTYPE_BOOL);
586
587
0
  *result = BoolValue(value.GetBoolValue());
588
0
}
589
590
void StringMapFieldValueAccessor(
591
    const google::protobuf::MapValueConstRef& value,
592
    const google::protobuf::Message* absl_nonnull message,
593
    const google::protobuf::FieldDescriptor* absl_nonnull field,
594
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
595
    google::protobuf::MessageFactory* absl_nonnull message_factory,
596
0
    google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull result) {
597
0
  ABSL_DCHECK(message != nullptr);
598
0
  ABSL_DCHECK(field != nullptr);
599
0
  ABSL_DCHECK(descriptor_pool != nullptr);
600
0
  ABSL_DCHECK(message_factory != nullptr);
601
0
  ABSL_DCHECK(arena != nullptr);
602
0
  ABSL_DCHECK(result != nullptr);
603
0
  ABSL_DCHECK(!field->is_repeated());
604
0
  ABSL_DCHECK_EQ(field->type(), google::protobuf::FieldDescriptor::TYPE_STRING);
605
606
0
  if (message->GetArena() == nullptr) {
607
0
    *result = StringValue(arena, value.GetStringValue());
608
0
  } else {
609
0
    *result = StringValue(Borrower::Arena(arena), value.GetStringValue());
610
0
  }
611
0
}
612
613
void MessageMapFieldValueAccessor(
614
    const google::protobuf::MapValueConstRef& value,
615
    const google::protobuf::Message* absl_nonnull message,
616
    const google::protobuf::FieldDescriptor* absl_nonnull field,
617
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
618
    google::protobuf::MessageFactory* absl_nonnull message_factory,
619
0
    google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull result) {
620
0
  ABSL_DCHECK(message != nullptr);
621
0
  ABSL_DCHECK(field != nullptr);
622
0
  ABSL_DCHECK(descriptor_pool != nullptr);
623
0
  ABSL_DCHECK(message_factory != nullptr);
624
0
  ABSL_DCHECK(arena != nullptr);
625
0
  ABSL_DCHECK(result != nullptr);
626
0
  ABSL_DCHECK(!field->is_repeated());
627
0
  ABSL_DCHECK_EQ(field->cpp_type(), google::protobuf::FieldDescriptor::CPPTYPE_MESSAGE);
628
629
0
  *result = Value::WrapMessage(&value.GetMessageValue(), descriptor_pool,
630
0
                               message_factory, arena);
631
0
}
632
633
void BytesMapFieldValueAccessor(
634
    const google::protobuf::MapValueConstRef& value,
635
    const google::protobuf::Message* absl_nonnull message,
636
    const google::protobuf::FieldDescriptor* absl_nonnull field,
637
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
638
    google::protobuf::MessageFactory* absl_nonnull message_factory,
639
0
    google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull result) {
640
0
  ABSL_DCHECK(message != nullptr);
641
0
  ABSL_DCHECK(field != nullptr);
642
0
  ABSL_DCHECK(descriptor_pool != nullptr);
643
0
  ABSL_DCHECK(message_factory != nullptr);
644
0
  ABSL_DCHECK(arena != nullptr);
645
0
  ABSL_DCHECK(result != nullptr);
646
0
  ABSL_DCHECK(!field->is_repeated());
647
0
  ABSL_DCHECK_EQ(field->type(), google::protobuf::FieldDescriptor::TYPE_BYTES);
648
649
0
  if (message->GetArena() == nullptr) {
650
0
    *result = BytesValue(arena, value.GetStringValue());
651
0
  } else {
652
0
    *result = BytesValue(Borrower::Arena(arena), value.GetStringValue());
653
0
  }
654
0
}
655
656
void EnumMapFieldValueAccessor(
657
    const google::protobuf::MapValueConstRef& value,
658
    const google::protobuf::Message* absl_nonnull message,
659
    const google::protobuf::FieldDescriptor* absl_nonnull field,
660
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
661
    google::protobuf::MessageFactory* absl_nonnull message_factory,
662
0
    google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull result) {
663
0
  ABSL_DCHECK(message != nullptr);
664
0
  ABSL_DCHECK(field != nullptr);
665
0
  ABSL_DCHECK(descriptor_pool != nullptr);
666
0
  ABSL_DCHECK(message_factory != nullptr);
667
0
  ABSL_DCHECK(arena != nullptr);
668
0
  ABSL_DCHECK(result != nullptr);
669
0
  ABSL_DCHECK(!field->is_repeated());
670
0
  ABSL_DCHECK_EQ(field->cpp_type(), google::protobuf::FieldDescriptor::CPPTYPE_ENUM);
671
672
0
  *result = NonNullEnumValue(field->enum_type(), value.GetEnumValue());
673
0
}
674
675
void NullMapFieldValueAccessor(
676
    const google::protobuf::MapValueConstRef& value,
677
    const google::protobuf::Message* absl_nonnull message,
678
    const google::protobuf::FieldDescriptor* absl_nonnull field,
679
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
680
    google::protobuf::MessageFactory* absl_nonnull message_factory,
681
0
    google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull result) {
682
0
  ABSL_DCHECK(message != nullptr);
683
0
  ABSL_DCHECK(field != nullptr);
684
0
  ABSL_DCHECK(descriptor_pool != nullptr);
685
0
  ABSL_DCHECK(message_factory != nullptr);
686
0
  ABSL_DCHECK(arena != nullptr);
687
0
  ABSL_DCHECK(result != nullptr);
688
0
  ABSL_DCHECK(!field->is_repeated());
689
0
  ABSL_DCHECK(field->cpp_type() == google::protobuf::FieldDescriptor::CPPTYPE_ENUM &&
690
0
              field->enum_type()->full_name() == "google.protobuf.NullValue");
691
692
0
  *result = NullValue();
693
0
}
694
695
}  // namespace
696
697
absl::StatusOr<MapFieldValueAccessor> MapFieldValueAccessorFor(
698
0
    const google::protobuf::FieldDescriptor* absl_nonnull field) {
699
0
  switch (field->type()) {
700
0
    case google::protobuf::FieldDescriptor::TYPE_DOUBLE:
701
0
      return &DoubleMapFieldValueAccessor;
702
0
    case google::protobuf::FieldDescriptor::TYPE_FLOAT:
703
0
      return &FloatMapFieldValueAccessor;
704
0
    case google::protobuf::FieldDescriptor::TYPE_SFIXED64:
705
0
      ABSL_FALLTHROUGH_INTENDED;
706
0
    case google::protobuf::FieldDescriptor::TYPE_SINT64:
707
0
      ABSL_FALLTHROUGH_INTENDED;
708
0
    case google::protobuf::FieldDescriptor::TYPE_INT64:
709
0
      return &Int64MapFieldValueAccessor;
710
0
    case google::protobuf::FieldDescriptor::TYPE_FIXED64:
711
0
      ABSL_FALLTHROUGH_INTENDED;
712
0
    case google::protobuf::FieldDescriptor::TYPE_UINT64:
713
0
      return &UInt64MapFieldValueAccessor;
714
0
    case google::protobuf::FieldDescriptor::TYPE_SFIXED32:
715
0
      ABSL_FALLTHROUGH_INTENDED;
716
0
    case google::protobuf::FieldDescriptor::TYPE_SINT32:
717
0
      ABSL_FALLTHROUGH_INTENDED;
718
0
    case google::protobuf::FieldDescriptor::TYPE_INT32:
719
0
      return &Int32MapFieldValueAccessor;
720
0
    case google::protobuf::FieldDescriptor::TYPE_BOOL:
721
0
      return &BoolMapFieldValueAccessor;
722
0
    case google::protobuf::FieldDescriptor::TYPE_STRING:
723
0
      return &StringMapFieldValueAccessor;
724
0
    case google::protobuf::FieldDescriptor::TYPE_GROUP:
725
0
      ABSL_FALLTHROUGH_INTENDED;
726
0
    case google::protobuf::FieldDescriptor::TYPE_MESSAGE:
727
0
      return &MessageMapFieldValueAccessor;
728
0
    case google::protobuf::FieldDescriptor::TYPE_BYTES:
729
0
      return &BytesMapFieldValueAccessor;
730
0
    case google::protobuf::FieldDescriptor::TYPE_FIXED32:
731
0
      ABSL_FALLTHROUGH_INTENDED;
732
0
    case google::protobuf::FieldDescriptor::TYPE_UINT32:
733
0
      return &UInt32MapFieldValueAccessor;
734
0
    case google::protobuf::FieldDescriptor::TYPE_ENUM:
735
0
      if (field->enum_type()->full_name() == "google.protobuf.NullValue") {
736
0
        return &NullMapFieldValueAccessor;
737
0
      }
738
0
      return &EnumMapFieldValueAccessor;
739
0
    default:
740
0
      return absl::InvalidArgumentError(
741
0
          absl::StrCat("unexpected protocol buffer message field type: ",
742
0
                       field->type_name()));
743
0
  }
744
0
}
745
746
namespace {
747
748
void DoubleRepeatedFieldAccessor(
749
    int index, const google::protobuf::Message* absl_nonnull message,
750
    const google::protobuf::FieldDescriptor* absl_nonnull field,
751
    const google::protobuf::Reflection* absl_nonnull reflection,
752
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
753
    google::protobuf::MessageFactory* absl_nonnull message_factory,
754
0
    google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull result) {
755
0
  ABSL_DCHECK(message != nullptr);
756
0
  ABSL_DCHECK(field != nullptr);
757
0
  ABSL_DCHECK(message_factory != nullptr);
758
0
  ABSL_DCHECK(descriptor_pool != nullptr);
759
0
  ABSL_DCHECK(reflection != nullptr);
760
0
  ABSL_DCHECK(arena != nullptr);
761
0
  ABSL_DCHECK(result != nullptr);
762
0
  ABSL_DCHECK_EQ(reflection, message->GetReflection());
763
0
  ABSL_DCHECK_EQ(field->containing_type(), message->GetDescriptor());
764
0
  ABSL_DCHECK(field->is_repeated());
765
0
  ABSL_DCHECK_EQ(field->cpp_type(), google::protobuf::FieldDescriptor::CPPTYPE_DOUBLE);
766
0
  ABSL_DCHECK_GE(index, 0);
767
0
  ABSL_DCHECK_LT(index, reflection->FieldSize(*message, field));
768
769
0
  *result = DoubleValue(reflection->GetRepeatedDouble(*message, field, index));
770
0
}
771
772
void FloatRepeatedFieldAccessor(
773
    int index, const google::protobuf::Message* absl_nonnull message,
774
    const google::protobuf::FieldDescriptor* absl_nonnull field,
775
    const google::protobuf::Reflection* absl_nonnull reflection,
776
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
777
    google::protobuf::MessageFactory* absl_nonnull message_factory,
778
0
    google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull result) {
779
0
  ABSL_DCHECK(message != nullptr);
780
0
  ABSL_DCHECK(field != nullptr);
781
0
  ABSL_DCHECK(message_factory != nullptr);
782
0
  ABSL_DCHECK(descriptor_pool != nullptr);
783
0
  ABSL_DCHECK(reflection != nullptr);
784
0
  ABSL_DCHECK(arena != nullptr);
785
0
  ABSL_DCHECK(result != nullptr);
786
0
  ABSL_DCHECK_EQ(reflection, message->GetReflection());
787
0
  ABSL_DCHECK_EQ(field->containing_type(), message->GetDescriptor());
788
0
  ABSL_DCHECK(field->is_repeated());
789
0
  ABSL_DCHECK_EQ(field->cpp_type(), google::protobuf::FieldDescriptor::CPPTYPE_FLOAT);
790
0
  ABSL_DCHECK_GE(index, 0);
791
0
  ABSL_DCHECK_LT(index, reflection->FieldSize(*message, field));
792
793
0
  *result = DoubleValue(reflection->GetRepeatedFloat(*message, field, index));
794
0
}
795
796
void Int64RepeatedFieldAccessor(
797
    int index, const google::protobuf::Message* absl_nonnull message,
798
    const google::protobuf::FieldDescriptor* absl_nonnull field,
799
    const google::protobuf::Reflection* absl_nonnull reflection,
800
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
801
    google::protobuf::MessageFactory* absl_nonnull message_factory,
802
0
    google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull result) {
803
0
  ABSL_DCHECK(message != nullptr);
804
0
  ABSL_DCHECK(field != nullptr);
805
0
  ABSL_DCHECK(message_factory != nullptr);
806
0
  ABSL_DCHECK(descriptor_pool != nullptr);
807
0
  ABSL_DCHECK(reflection != nullptr);
808
0
  ABSL_DCHECK(arena != nullptr);
809
0
  ABSL_DCHECK(result != nullptr);
810
0
  ABSL_DCHECK_EQ(reflection, message->GetReflection());
811
0
  ABSL_DCHECK_EQ(field->containing_type(), message->GetDescriptor());
812
0
  ABSL_DCHECK(field->is_repeated());
813
0
  ABSL_DCHECK_EQ(field->cpp_type(), google::protobuf::FieldDescriptor::CPPTYPE_INT64);
814
0
  ABSL_DCHECK_GE(index, 0);
815
0
  ABSL_DCHECK_LT(index, reflection->FieldSize(*message, field));
816
817
0
  *result = IntValue(reflection->GetRepeatedInt64(*message, field, index));
818
0
}
819
820
void UInt64RepeatedFieldAccessor(
821
    int index, const google::protobuf::Message* absl_nonnull message,
822
    const google::protobuf::FieldDescriptor* absl_nonnull field,
823
    const google::protobuf::Reflection* absl_nonnull reflection,
824
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
825
    google::protobuf::MessageFactory* absl_nonnull message_factory,
826
0
    google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull result) {
827
0
  ABSL_DCHECK(message != nullptr);
828
0
  ABSL_DCHECK(field != nullptr);
829
0
  ABSL_DCHECK(message_factory != nullptr);
830
0
  ABSL_DCHECK(descriptor_pool != nullptr);
831
0
  ABSL_DCHECK(reflection != nullptr);
832
0
  ABSL_DCHECK(arena != nullptr);
833
0
  ABSL_DCHECK(result != nullptr);
834
0
  ABSL_DCHECK_EQ(reflection, message->GetReflection());
835
0
  ABSL_DCHECK_EQ(field->containing_type(), message->GetDescriptor());
836
0
  ABSL_DCHECK(field->is_repeated());
837
0
  ABSL_DCHECK_EQ(field->cpp_type(), google::protobuf::FieldDescriptor::CPPTYPE_UINT64);
838
0
  ABSL_DCHECK_GE(index, 0);
839
0
  ABSL_DCHECK_LT(index, reflection->FieldSize(*message, field));
840
841
0
  *result = UintValue(reflection->GetRepeatedUInt64(*message, field, index));
842
0
}
843
844
void Int32RepeatedFieldAccessor(
845
    int index, const google::protobuf::Message* absl_nonnull message,
846
    const google::protobuf::FieldDescriptor* absl_nonnull field,
847
    const google::protobuf::Reflection* absl_nonnull reflection,
848
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
849
    google::protobuf::MessageFactory* absl_nonnull message_factory,
850
0
    google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull result) {
851
0
  ABSL_DCHECK(message != nullptr);
852
0
  ABSL_DCHECK(field != nullptr);
853
0
  ABSL_DCHECK(message_factory != nullptr);
854
0
  ABSL_DCHECK(descriptor_pool != nullptr);
855
0
  ABSL_DCHECK(reflection != nullptr);
856
0
  ABSL_DCHECK(arena != nullptr);
857
0
  ABSL_DCHECK(result != nullptr);
858
0
  ABSL_DCHECK_EQ(reflection, message->GetReflection());
859
0
  ABSL_DCHECK_EQ(field->containing_type(), message->GetDescriptor());
860
0
  ABSL_DCHECK(field->is_repeated());
861
0
  ABSL_DCHECK_EQ(field->cpp_type(), google::protobuf::FieldDescriptor::CPPTYPE_INT32);
862
0
  ABSL_DCHECK_GE(index, 0);
863
0
  ABSL_DCHECK_LT(index, reflection->FieldSize(*message, field));
864
865
0
  *result = IntValue(reflection->GetRepeatedInt32(*message, field, index));
866
0
}
867
868
void UInt32RepeatedFieldAccessor(
869
    int index, const google::protobuf::Message* absl_nonnull message,
870
    const google::protobuf::FieldDescriptor* absl_nonnull field,
871
    const google::protobuf::Reflection* absl_nonnull reflection,
872
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
873
    google::protobuf::MessageFactory* absl_nonnull message_factory,
874
0
    google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull result) {
875
0
  ABSL_DCHECK(message != nullptr);
876
0
  ABSL_DCHECK(field != nullptr);
877
0
  ABSL_DCHECK(message_factory != nullptr);
878
0
  ABSL_DCHECK(descriptor_pool != nullptr);
879
0
  ABSL_DCHECK(reflection != nullptr);
880
0
  ABSL_DCHECK(arena != nullptr);
881
0
  ABSL_DCHECK(result != nullptr);
882
0
  ABSL_DCHECK_EQ(reflection, message->GetReflection());
883
0
  ABSL_DCHECK_EQ(field->containing_type(), message->GetDescriptor());
884
0
  ABSL_DCHECK(field->is_repeated());
885
0
  ABSL_DCHECK_EQ(field->cpp_type(), google::protobuf::FieldDescriptor::CPPTYPE_UINT32);
886
0
  ABSL_DCHECK_GE(index, 0);
887
0
  ABSL_DCHECK_LT(index, reflection->FieldSize(*message, field));
888
889
0
  *result = UintValue(reflection->GetRepeatedUInt32(*message, field, index));
890
0
}
891
892
void BoolRepeatedFieldAccessor(
893
    int index, const google::protobuf::Message* absl_nonnull message,
894
    const google::protobuf::FieldDescriptor* absl_nonnull field,
895
    const google::protobuf::Reflection* absl_nonnull reflection,
896
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
897
    google::protobuf::MessageFactory* absl_nonnull message_factory,
898
0
    google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull result) {
899
0
  ABSL_DCHECK(message != nullptr);
900
0
  ABSL_DCHECK(field != nullptr);
901
0
  ABSL_DCHECK(message_factory != nullptr);
902
0
  ABSL_DCHECK(descriptor_pool != nullptr);
903
0
  ABSL_DCHECK(reflection != nullptr);
904
0
  ABSL_DCHECK(arena != nullptr);
905
0
  ABSL_DCHECK(result != nullptr);
906
0
  ABSL_DCHECK_EQ(reflection, message->GetReflection());
907
0
  ABSL_DCHECK_EQ(field->containing_type(), message->GetDescriptor());
908
0
  ABSL_DCHECK(field->is_repeated());
909
0
  ABSL_DCHECK_EQ(field->cpp_type(), google::protobuf::FieldDescriptor::CPPTYPE_BOOL);
910
0
  ABSL_DCHECK_GE(index, 0);
911
0
  ABSL_DCHECK_LT(index, reflection->FieldSize(*message, field));
912
913
0
  *result = BoolValue(reflection->GetRepeatedBool(*message, field, index));
914
0
}
915
916
void StringRepeatedFieldAccessor(
917
    int index, const google::protobuf::Message* absl_nonnull message,
918
    const google::protobuf::FieldDescriptor* absl_nonnull field,
919
    const google::protobuf::Reflection* absl_nonnull reflection,
920
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
921
    google::protobuf::MessageFactory* absl_nonnull message_factory,
922
0
    google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull result) {
923
0
  ABSL_DCHECK(message != nullptr);
924
0
  ABSL_DCHECK(field != nullptr);
925
0
  ABSL_DCHECK(message_factory != nullptr);
926
0
  ABSL_DCHECK(descriptor_pool != nullptr);
927
0
  ABSL_DCHECK(reflection != nullptr);
928
0
  ABSL_DCHECK(arena != nullptr);
929
0
  ABSL_DCHECK(result != nullptr);
930
0
  ABSL_DCHECK_EQ(reflection, message->GetReflection());
931
0
  ABSL_DCHECK_EQ(field->containing_type(), message->GetDescriptor());
932
0
  ABSL_DCHECK(field->is_repeated());
933
0
  ABSL_DCHECK_EQ(field->type(), google::protobuf::FieldDescriptor::TYPE_STRING);
934
0
  ABSL_DCHECK_GE(index, 0);
935
0
  ABSL_DCHECK_LT(index, reflection->FieldSize(*message, field));
936
937
0
  std::string scratch;
938
0
  absl::visit(
939
0
      absl::Overload(
940
0
          [&](absl::string_view string) {
941
0
            if (string.data() == scratch.data() &&
942
0
                string.size() == scratch.size()) {
943
0
              *result = StringValue(arena, std::move(scratch));
944
0
            } else {
945
0
              if (message->GetArena() == nullptr) {
946
0
                *result = StringValue(arena, string);
947
0
              } else {
948
0
                *result = StringValue(Borrower::Arena(arena), string);
949
0
              }
950
0
            }
951
0
          },
952
0
          [&](absl::Cord&& cord) { *result = StringValue(std::move(cord)); }),
953
0
      well_known_types::AsVariant(well_known_types::GetRepeatedStringField(
954
0
          *message, field, index, scratch)));
955
0
}
956
957
void MessageRepeatedFieldAccessor(
958
    int index, const google::protobuf::Message* absl_nonnull message,
959
    const google::protobuf::FieldDescriptor* absl_nonnull field,
960
    const google::protobuf::Reflection* absl_nonnull reflection,
961
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
962
    google::protobuf::MessageFactory* absl_nonnull message_factory,
963
0
    google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull result) {
964
0
  ABSL_DCHECK(message != nullptr);
965
0
  ABSL_DCHECK(field != nullptr);
966
0
  ABSL_DCHECK(message_factory != nullptr);
967
0
  ABSL_DCHECK(descriptor_pool != nullptr);
968
0
  ABSL_DCHECK(reflection != nullptr);
969
0
  ABSL_DCHECK(arena != nullptr);
970
0
  ABSL_DCHECK(result != nullptr);
971
0
  ABSL_DCHECK_EQ(reflection, message->GetReflection());
972
0
  ABSL_DCHECK_EQ(field->containing_type(), message->GetDescriptor());
973
0
  ABSL_DCHECK(field->is_repeated());
974
0
  ABSL_DCHECK_EQ(field->cpp_type(), google::protobuf::FieldDescriptor::CPPTYPE_MESSAGE);
975
0
  ABSL_DCHECK_GE(index, 0);
976
0
  ABSL_DCHECK_LT(index, reflection->FieldSize(*message, field));
977
978
0
  *result = Value::WrapMessage(
979
0
      &reflection->GetRepeatedMessage(*message, field, index), descriptor_pool,
980
0
      message_factory, arena);
981
0
}
982
983
void BytesRepeatedFieldAccessor(
984
    int index, const google::protobuf::Message* absl_nonnull message,
985
    const google::protobuf::FieldDescriptor* absl_nonnull field,
986
    const google::protobuf::Reflection* absl_nonnull reflection,
987
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
988
    google::protobuf::MessageFactory* absl_nonnull message_factory,
989
0
    google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull result) {
990
0
  ABSL_DCHECK(message != nullptr);
991
0
  ABSL_DCHECK(field != nullptr);
992
0
  ABSL_DCHECK(message_factory != nullptr);
993
0
  ABSL_DCHECK(descriptor_pool != nullptr);
994
0
  ABSL_DCHECK(reflection != nullptr);
995
0
  ABSL_DCHECK(arena != nullptr);
996
0
  ABSL_DCHECK(result != nullptr);
997
0
  ABSL_DCHECK_EQ(reflection, message->GetReflection());
998
0
  ABSL_DCHECK_EQ(field->containing_type(), message->GetDescriptor());
999
0
  ABSL_DCHECK(field->is_repeated());
1000
0
  ABSL_DCHECK_EQ(field->type(), google::protobuf::FieldDescriptor::TYPE_BYTES);
1001
0
  ABSL_DCHECK_GE(index, 0);
1002
0
  ABSL_DCHECK_LT(index, reflection->FieldSize(*message, field));
1003
1004
0
  std::string scratch;
1005
0
  absl::visit(
1006
0
      absl::Overload(
1007
0
          [&](absl::string_view string) {
1008
0
            if (string.data() == scratch.data() &&
1009
0
                string.size() == scratch.size()) {
1010
0
              *result = BytesValue(arena, std::move(scratch));
1011
0
            } else {
1012
0
              if (message->GetArena() == nullptr) {
1013
0
                *result = BytesValue(arena, string);
1014
0
              } else {
1015
0
                *result = BytesValue(Borrower::Arena(arena), string);
1016
0
              }
1017
0
            }
1018
0
          },
1019
0
          [&](absl::Cord&& cord) { *result = BytesValue(std::move(cord)); }),
1020
0
      well_known_types::AsVariant(well_known_types::GetRepeatedBytesField(
1021
0
          *message, field, index, scratch)));
1022
0
}
1023
1024
void EnumRepeatedFieldAccessor(
1025
    int index, const google::protobuf::Message* absl_nonnull message,
1026
    const google::protobuf::FieldDescriptor* absl_nonnull field,
1027
    const google::protobuf::Reflection* absl_nonnull reflection,
1028
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
1029
    google::protobuf::MessageFactory* absl_nonnull message_factory,
1030
0
    google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull result) {
1031
0
  ABSL_DCHECK(message != nullptr);
1032
0
  ABSL_DCHECK(field != nullptr);
1033
0
  ABSL_DCHECK(message_factory != nullptr);
1034
0
  ABSL_DCHECK(descriptor_pool != nullptr);
1035
0
  ABSL_DCHECK(reflection != nullptr);
1036
0
  ABSL_DCHECK(arena != nullptr);
1037
0
  ABSL_DCHECK(result != nullptr);
1038
0
  ABSL_DCHECK_EQ(reflection, message->GetReflection());
1039
0
  ABSL_DCHECK_EQ(field->containing_type(), message->GetDescriptor());
1040
0
  ABSL_DCHECK(field->is_repeated());
1041
0
  ABSL_DCHECK_EQ(field->cpp_type(), google::protobuf::FieldDescriptor::CPPTYPE_ENUM);
1042
0
  ABSL_DCHECK_GE(index, 0);
1043
0
  ABSL_DCHECK_LT(index, reflection->FieldSize(*message, field));
1044
1045
0
  *result = NonNullEnumValue(
1046
0
      field->enum_type(),
1047
0
      reflection->GetRepeatedEnumValue(*message, field, index));
1048
0
}
1049
1050
void NullRepeatedFieldAccessor(
1051
    int index, const google::protobuf::Message* absl_nonnull message,
1052
    const google::protobuf::FieldDescriptor* absl_nonnull field,
1053
    const google::protobuf::Reflection* absl_nonnull reflection,
1054
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
1055
    google::protobuf::MessageFactory* absl_nonnull message_factory,
1056
0
    google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull result) {
1057
0
  ABSL_DCHECK(message != nullptr);
1058
0
  ABSL_DCHECK(field != nullptr);
1059
0
  ABSL_DCHECK(message_factory != nullptr);
1060
0
  ABSL_DCHECK(descriptor_pool != nullptr);
1061
0
  ABSL_DCHECK(reflection != nullptr);
1062
0
  ABSL_DCHECK(arena != nullptr);
1063
0
  ABSL_DCHECK(result != nullptr);
1064
0
  ABSL_DCHECK_EQ(reflection, message->GetReflection());
1065
0
  ABSL_DCHECK_EQ(field->containing_type(), message->GetDescriptor());
1066
0
  ABSL_DCHECK(field->is_repeated());
1067
0
  ABSL_DCHECK(field->cpp_type() == google::protobuf::FieldDescriptor::CPPTYPE_ENUM &&
1068
0
              field->enum_type()->full_name() == "google.protobuf.NullValue");
1069
0
  ABSL_DCHECK_GE(index, 0);
1070
0
  ABSL_DCHECK_LT(index, reflection->FieldSize(*message, field));
1071
1072
0
  *result = NullValue();
1073
0
}
1074
1075
}  // namespace
1076
1077
absl::StatusOr<RepeatedFieldAccessor> RepeatedFieldAccessorFor(
1078
0
    const google::protobuf::FieldDescriptor* absl_nonnull field) {
1079
0
  switch (field->type()) {
1080
0
    case google::protobuf::FieldDescriptor::TYPE_DOUBLE:
1081
0
      return &DoubleRepeatedFieldAccessor;
1082
0
    case google::protobuf::FieldDescriptor::TYPE_FLOAT:
1083
0
      return &FloatRepeatedFieldAccessor;
1084
0
    case google::protobuf::FieldDescriptor::TYPE_SFIXED64:
1085
0
      ABSL_FALLTHROUGH_INTENDED;
1086
0
    case google::protobuf::FieldDescriptor::TYPE_SINT64:
1087
0
      ABSL_FALLTHROUGH_INTENDED;
1088
0
    case google::protobuf::FieldDescriptor::TYPE_INT64:
1089
0
      return &Int64RepeatedFieldAccessor;
1090
0
    case google::protobuf::FieldDescriptor::TYPE_FIXED64:
1091
0
      ABSL_FALLTHROUGH_INTENDED;
1092
0
    case google::protobuf::FieldDescriptor::TYPE_UINT64:
1093
0
      return &UInt64RepeatedFieldAccessor;
1094
0
    case google::protobuf::FieldDescriptor::TYPE_SFIXED32:
1095
0
      ABSL_FALLTHROUGH_INTENDED;
1096
0
    case google::protobuf::FieldDescriptor::TYPE_SINT32:
1097
0
      ABSL_FALLTHROUGH_INTENDED;
1098
0
    case google::protobuf::FieldDescriptor::TYPE_INT32:
1099
0
      return &Int32RepeatedFieldAccessor;
1100
0
    case google::protobuf::FieldDescriptor::TYPE_BOOL:
1101
0
      return &BoolRepeatedFieldAccessor;
1102
0
    case google::protobuf::FieldDescriptor::TYPE_STRING:
1103
0
      return &StringRepeatedFieldAccessor;
1104
0
    case google::protobuf::FieldDescriptor::TYPE_GROUP:
1105
0
      ABSL_FALLTHROUGH_INTENDED;
1106
0
    case google::protobuf::FieldDescriptor::TYPE_MESSAGE:
1107
0
      return &MessageRepeatedFieldAccessor;
1108
0
    case google::protobuf::FieldDescriptor::TYPE_BYTES:
1109
0
      return &BytesRepeatedFieldAccessor;
1110
0
    case google::protobuf::FieldDescriptor::TYPE_FIXED32:
1111
0
      ABSL_FALLTHROUGH_INTENDED;
1112
0
    case google::protobuf::FieldDescriptor::TYPE_UINT32:
1113
0
      return &UInt32RepeatedFieldAccessor;
1114
0
    case google::protobuf::FieldDescriptor::TYPE_ENUM:
1115
0
      if (field->enum_type()->full_name() == "google.protobuf.NullValue") {
1116
0
        return &NullRepeatedFieldAccessor;
1117
0
      }
1118
0
      return &EnumRepeatedFieldAccessor;
1119
0
    default:
1120
0
      return absl::InvalidArgumentError(
1121
0
          absl::StrCat("unexpected protocol buffer message field type: ",
1122
0
                       field->type_name()));
1123
0
  }
1124
0
}
1125
1126
}  // namespace common_internal
1127
1128
namespace {
1129
1130
// Overloads for `well_known_types::Value` which handles the primitive values
1131
// which require no special handling based on allocators.
1132
476
Value VistWellKnownTypeValue(std::nullptr_t) { return NullValue(); }
1133
1134
640
Value VistWellKnownTypeValue(bool value) { return BoolValue(value); }
1135
1136
622
Value VistWellKnownTypeValue(int32_t value) { return IntValue(value); }
1137
1138
772
Value VistWellKnownTypeValue(int64_t value) { return IntValue(value); }
1139
1140
221
Value VistWellKnownTypeValue(uint32_t value) { return UintValue(value); }
1141
1142
357
Value VistWellKnownTypeValue(uint64_t value) { return UintValue(value); }
1143
1144
477
Value VistWellKnownTypeValue(float value) { return DoubleValue(value); }
1145
1146
79
Value VistWellKnownTypeValue(double value) { return DoubleValue(value); }
1147
1148
740
Value VistWellKnownTypeValue(absl::Duration value) {
1149
  // Tolerate out-of-range values.
1150
740
  return UnsafeDurationValue(value);
1151
740
}
1152
1153
3.29k
Value VistWellKnownTypeValue(absl::Time value) {
1154
3.29k
  return UnsafeTimestampValue(value);
1155
3.29k
}
1156
1157
struct OwningWellKnownTypesValueVisitor {
1158
  google::protobuf::Arena* absl_nullable arena;
1159
  std::string* absl_nonnull scratch;
1160
1161
0
  Value operator()(well_known_types::BytesValue&& value) const {
1162
0
    return absl::visit(absl::Overload(
1163
0
                           [&](absl::string_view string) -> BytesValue {
1164
0
                             if (string.empty()) {
1165
0
                               return BytesValue();
1166
0
                             }
1167
0
                             if (scratch->data() == string.data() &&
1168
0
                                 scratch->size() == string.size()) {
1169
0
                               return BytesValue(arena, std::move(*scratch));
1170
0
                             }
1171
0
                             return BytesValue(arena, string);
1172
0
                           },
1173
0
                           [&](absl::Cord&& cord) -> BytesValue {
1174
0
                             if (cord.empty()) {
1175
0
                               return BytesValue();
1176
0
                             }
1177
0
                             return BytesValue(arena, cord);
1178
0
                           }),
1179
0
                       well_known_types::AsVariant(std::move(value)));
1180
0
  }
1181
1182
0
  Value operator()(well_known_types::StringValue&& value) const {
1183
0
    return absl::visit(absl::Overload(
1184
0
                           [&](absl::string_view string) -> StringValue {
1185
0
                             if (string.empty()) {
1186
0
                               return StringValue();
1187
0
                             }
1188
0
                             if (scratch->data() == string.data() &&
1189
0
                                 scratch->size() == string.size()) {
1190
0
                               return StringValue(arena, std::move(*scratch));
1191
0
                             }
1192
0
                             return StringValue(arena, string);
1193
0
                           },
1194
0
                           [&](absl::Cord&& cord) -> StringValue {
1195
0
                             if (cord.empty()) {
1196
0
                               return StringValue();
1197
0
                             }
1198
0
                             return StringValue(arena, cord);
1199
0
                           }),
1200
0
                       well_known_types::AsVariant(std::move(value)));
1201
0
  }
1202
1203
0
  Value operator()(well_known_types::ListValue&& value) const {
1204
0
    return absl::visit(
1205
0
        absl::Overload(
1206
0
            [&](well_known_types::ListValueConstRef value) -> ListValue {
1207
0
              auto* cloned = value.get().New(arena);
1208
0
              cloned->CopyFrom(value.get());
1209
0
              return ParsedJsonListValue(cloned, arena);
1210
0
            },
1211
0
            [&](well_known_types::ListValuePtr value) -> ListValue {
1212
0
              if (value->GetArena() != arena) {
1213
0
                auto* cloned = value->New(arena);
1214
0
                cloned->CopyFrom(*value);
1215
0
                return ParsedJsonListValue(cloned, arena);
1216
0
              }
1217
0
              return ParsedJsonListValue(value.release(), arena);
1218
0
            }),
1219
0
        well_known_types::AsVariant(std::move(value)));
1220
0
  }
1221
1222
0
  Value operator()(well_known_types::Struct&& value) const {
1223
0
    return absl::visit(
1224
0
        absl::Overload(
1225
0
            [&](well_known_types::StructConstRef value) -> MapValue {
1226
0
              auto* cloned = value.get().New(arena);
1227
0
              cloned->CopyFrom(value.get());
1228
0
              return ParsedJsonMapValue(cloned, arena);
1229
0
            },
1230
0
            [&](well_known_types::StructPtr value) -> MapValue {
1231
0
              if (value.arena() != arena) {
1232
0
                auto* cloned = value->New(arena);
1233
0
                cloned->CopyFrom(*value);
1234
0
                return ParsedJsonMapValue(cloned, arena);
1235
0
              }
1236
0
              return ParsedJsonMapValue(value.release(), arena);
1237
0
            }),
1238
0
        well_known_types::AsVariant(std::move(value)));
1239
0
  }
1240
1241
0
  Value operator()(Unique<google::protobuf::Message> value) const {
1242
0
    if (value->GetArena() != arena) {
1243
0
      auto* cloned = value->New(arena);
1244
0
      cloned->CopyFrom(*value);
1245
0
      return ParsedMessageValue(cloned, arena);
1246
0
    }
1247
0
    return ParsedMessageValue(value.release(), arena);
1248
0
  }
1249
1250
  template <typename T>
1251
0
  Value operator()(T t) const {
1252
0
    return VistWellKnownTypeValue(t);
1253
0
  }
Unexecuted instantiation: value.cc:cel::Value cel::(anonymous namespace)::OwningWellKnownTypesValueVisitor::operator()<decltype(nullptr)>(decltype(nullptr)) const
Unexecuted instantiation: value.cc:cel::Value cel::(anonymous namespace)::OwningWellKnownTypesValueVisitor::operator()<bool>(bool) const
Unexecuted instantiation: value.cc:cel::Value cel::(anonymous namespace)::OwningWellKnownTypesValueVisitor::operator()<int>(int) const
Unexecuted instantiation: value.cc:cel::Value cel::(anonymous namespace)::OwningWellKnownTypesValueVisitor::operator()<long>(long) const
Unexecuted instantiation: value.cc:cel::Value cel::(anonymous namespace)::OwningWellKnownTypesValueVisitor::operator()<unsigned int>(unsigned int) const
Unexecuted instantiation: value.cc:cel::Value cel::(anonymous namespace)::OwningWellKnownTypesValueVisitor::operator()<unsigned long>(unsigned long) const
Unexecuted instantiation: value.cc:cel::Value cel::(anonymous namespace)::OwningWellKnownTypesValueVisitor::operator()<float>(float) const
Unexecuted instantiation: value.cc:cel::Value cel::(anonymous namespace)::OwningWellKnownTypesValueVisitor::operator()<double>(double) const
Unexecuted instantiation: value.cc:cel::Value cel::(anonymous namespace)::OwningWellKnownTypesValueVisitor::operator()<absl::lts_20260526::Duration>(absl::lts_20260526::Duration) const
Unexecuted instantiation: value.cc:cel::Value cel::(anonymous namespace)::OwningWellKnownTypesValueVisitor::operator()<absl::lts_20260526::Time>(absl::lts_20260526::Time) const
1254
};
1255
1256
struct BorrowingWellKnownTypesValueVisitor {
1257
  const google::protobuf::Message* absl_nonnull message;
1258
  google::protobuf::Arena* absl_nonnull arena;
1259
  std::string* absl_nonnull scratch;
1260
1261
64.0k
  Value operator()(well_known_types::BytesValue&& value) const {
1262
64.0k
    return absl::visit(
1263
64.0k
        absl::Overload(
1264
64.0k
            [&](absl::string_view string) -> BytesValue {
1265
64.0k
              if (string.data() == scratch->data() &&
1266
0
                  string.size() == scratch->size()) {
1267
0
                return BytesValue(arena, std::move(*scratch));
1268
64.0k
              } else {
1269
64.0k
                return BytesValue(
1270
64.0k
                    Borrower::Arena(MessageArenaOr(message, arena)), string);
1271
64.0k
              }
1272
64.0k
            },
1273
64.0k
            [&](absl::Cord&& cord) -> BytesValue {
1274
0
              return BytesValue(std::move(cord));
1275
0
            }),
1276
64.0k
        well_known_types::AsVariant(std::move(value)));
1277
64.0k
  }
1278
1279
258
  Value operator()(well_known_types::StringValue&& value) const {
1280
258
    return absl::visit(
1281
258
        absl::Overload(
1282
258
            [&](absl::string_view string) -> StringValue {
1283
258
              if (string.data() == scratch->data() &&
1284
0
                  string.size() == scratch->size()) {
1285
0
                return StringValue(arena, std::move(*scratch));
1286
258
              } else {
1287
258
                return StringValue(
1288
258
                    Borrower::Arena(MessageArenaOr(message, arena)), string);
1289
258
              }
1290
258
            },
1291
258
            [&](absl::Cord&& cord) -> StringValue {
1292
0
              return StringValue(std::move(cord));
1293
0
            }),
1294
258
        well_known_types::AsVariant(std::move(value)));
1295
258
  }
1296
1297
368k
  Value operator()(well_known_types::ListValue&& value) const {
1298
368k
    return absl::visit(
1299
368k
        absl::Overload(
1300
368k
            [&](well_known_types::ListValueConstRef value)
1301
368k
                -> ParsedJsonListValue {
1302
368k
              return ParsedJsonListValue(&value.get(),
1303
368k
                                         MessageArenaOr(&value.get(), arena));
1304
368k
            },
1305
368k
            [&](well_known_types::ListValuePtr value) -> ParsedJsonListValue {
1306
0
              if (value->GetArena() != arena) {
1307
0
                auto* cloned = value->New(arena);
1308
0
                cloned->CopyFrom(*value);
1309
0
                return ParsedJsonListValue(cloned, arena);
1310
0
              }
1311
0
              return ParsedJsonListValue(value.release(), arena);
1312
0
            }),
1313
368k
        well_known_types::AsVariant(std::move(value)));
1314
368k
  }
1315
1316
3.86k
  Value operator()(well_known_types::Struct&& value) const {
1317
3.86k
    return absl::visit(
1318
3.86k
        absl::Overload(
1319
3.86k
            [&](well_known_types::StructConstRef value) -> ParsedJsonMapValue {
1320
3.86k
              return ParsedJsonMapValue(&value.get(),
1321
3.86k
                                        MessageArenaOr(&value.get(), arena));
1322
3.86k
            },
1323
3.86k
            [&](well_known_types::StructPtr value) -> ParsedJsonMapValue {
1324
0
              if (value->GetArena() != arena) {
1325
0
                auto* cloned = value->New(arena);
1326
0
                cloned->CopyFrom(*value);
1327
0
                return ParsedJsonMapValue(cloned, arena);
1328
0
              }
1329
0
              return ParsedJsonMapValue(value.release(), arena);
1330
0
            }),
1331
3.86k
        well_known_types::AsVariant(std::move(value)));
1332
3.86k
  }
1333
1334
0
  Value operator()(Unique<google::protobuf::Message>&& value) const {
1335
0
    if (value->GetArena() != arena) {
1336
0
      auto* cloned = value->New(arena);
1337
0
      cloned->CopyFrom(*value);
1338
0
      return ParsedMessageValue(cloned, arena);
1339
0
    }
1340
0
    return ParsedMessageValue(value.release(), arena);
1341
0
  }
1342
1343
  template <typename T>
1344
7.68k
  Value operator()(T t) const {
1345
7.68k
    return VistWellKnownTypeValue(t);
1346
7.68k
  }
value.cc:cel::Value cel::(anonymous namespace)::BorrowingWellKnownTypesValueVisitor::operator()<decltype(nullptr)>(decltype(nullptr)) const
Line
Count
Source
1344
476
  Value operator()(T t) const {
1345
476
    return VistWellKnownTypeValue(t);
1346
476
  }
value.cc:cel::Value cel::(anonymous namespace)::BorrowingWellKnownTypesValueVisitor::operator()<bool>(bool) const
Line
Count
Source
1344
640
  Value operator()(T t) const {
1345
640
    return VistWellKnownTypeValue(t);
1346
640
  }
value.cc:cel::Value cel::(anonymous namespace)::BorrowingWellKnownTypesValueVisitor::operator()<int>(int) const
Line
Count
Source
1344
622
  Value operator()(T t) const {
1345
622
    return VistWellKnownTypeValue(t);
1346
622
  }
value.cc:cel::Value cel::(anonymous namespace)::BorrowingWellKnownTypesValueVisitor::operator()<long>(long) const
Line
Count
Source
1344
772
  Value operator()(T t) const {
1345
772
    return VistWellKnownTypeValue(t);
1346
772
  }
value.cc:cel::Value cel::(anonymous namespace)::BorrowingWellKnownTypesValueVisitor::operator()<unsigned int>(unsigned int) const
Line
Count
Source
1344
221
  Value operator()(T t) const {
1345
221
    return VistWellKnownTypeValue(t);
1346
221
  }
value.cc:cel::Value cel::(anonymous namespace)::BorrowingWellKnownTypesValueVisitor::operator()<unsigned long>(unsigned long) const
Line
Count
Source
1344
357
  Value operator()(T t) const {
1345
357
    return VistWellKnownTypeValue(t);
1346
357
  }
value.cc:cel::Value cel::(anonymous namespace)::BorrowingWellKnownTypesValueVisitor::operator()<float>(float) const
Line
Count
Source
1344
477
  Value operator()(T t) const {
1345
477
    return VistWellKnownTypeValue(t);
1346
477
  }
value.cc:cel::Value cel::(anonymous namespace)::BorrowingWellKnownTypesValueVisitor::operator()<double>(double) const
Line
Count
Source
1344
79
  Value operator()(T t) const {
1345
79
    return VistWellKnownTypeValue(t);
1346
79
  }
value.cc:cel::Value cel::(anonymous namespace)::BorrowingWellKnownTypesValueVisitor::operator()<absl::lts_20260526::Duration>(absl::lts_20260526::Duration) const
Line
Count
Source
1344
740
  Value operator()(T t) const {
1345
740
    return VistWellKnownTypeValue(t);
1346
740
  }
value.cc:cel::Value cel::(anonymous namespace)::BorrowingWellKnownTypesValueVisitor::operator()<absl::lts_20260526::Time>(absl::lts_20260526::Time) const
Line
Count
Source
1344
3.29k
  Value operator()(T t) const {
1345
3.29k
    return VistWellKnownTypeValue(t);
1346
3.29k
  }
1347
};
1348
1349
}  // namespace
1350
1351
Value Value::FromMessage(
1352
    const google::protobuf::Message& message,
1353
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool
1354
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1355
    google::protobuf::MessageFactory* absl_nonnull message_factory
1356
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1357
0
    google::protobuf::Arena* absl_nonnull arena ABSL_ATTRIBUTE_LIFETIME_BOUND) {
1358
0
  ABSL_DCHECK(descriptor_pool != nullptr);
1359
0
  ABSL_DCHECK(message_factory != nullptr);
1360
0
  ABSL_DCHECK(arena != nullptr);
1361
1362
0
  std::string scratch;
1363
0
  auto status_or_adapted = well_known_types::AdaptFromMessage(
1364
0
      arena, message, descriptor_pool, message_factory, scratch);
1365
0
  if (ABSL_PREDICT_FALSE(!status_or_adapted.ok())) {
1366
0
    return ErrorValue(std::move(status_or_adapted).status());
1367
0
  }
1368
0
  return absl::visit(
1369
0
      absl::Overload(OwningWellKnownTypesValueVisitor{
1370
0
                         /* .arena = */ arena, /* .scratch = */ &scratch},
1371
0
                     [&](std::monostate) -> Value {
1372
0
                       auto* cloned = message.New(arena);
1373
0
                       cloned->CopyFrom(message);
1374
0
                       return ParsedMessageValue(cloned, arena);
1375
0
                     }),
1376
0
      std::move(status_or_adapted).value());
1377
0
}
1378
1379
Value Value::FromMessage(
1380
    google::protobuf::Message&& message,
1381
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool
1382
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1383
    google::protobuf::MessageFactory* absl_nonnull message_factory
1384
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1385
0
    google::protobuf::Arena* absl_nonnull arena ABSL_ATTRIBUTE_LIFETIME_BOUND) {
1386
0
  ABSL_DCHECK(descriptor_pool != nullptr);
1387
0
  ABSL_DCHECK(message_factory != nullptr);
1388
0
  ABSL_DCHECK(arena != nullptr);
1389
1390
0
  std::string scratch;
1391
0
  auto status_or_adapted = well_known_types::AdaptFromMessage(
1392
0
      arena, message, descriptor_pool, message_factory, scratch);
1393
0
  if (ABSL_PREDICT_FALSE(!status_or_adapted.ok())) {
1394
0
    return ErrorValue(std::move(status_or_adapted).status());
1395
0
  }
1396
0
  return absl::visit(
1397
0
      absl::Overload(OwningWellKnownTypesValueVisitor{
1398
0
                         /* .arena = */ arena, /* .scratch = */ &scratch},
1399
0
                     [&](std::monostate) -> Value {
1400
0
                       auto* cloned = message.New(arena);
1401
0
                       cloned->GetReflection()->Swap(cloned, &message);
1402
0
                       return ParsedMessageValue(cloned, arena);
1403
0
                     }),
1404
0
      std::move(status_or_adapted).value());
1405
0
}
1406
1407
Value Value::WrapMessage(
1408
    const google::protobuf::Message* absl_nonnull message ABSL_ATTRIBUTE_LIFETIME_BOUND,
1409
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool
1410
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1411
    google::protobuf::MessageFactory* absl_nonnull message_factory
1412
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1413
695k
    google::protobuf::Arena* absl_nonnull arena ABSL_ATTRIBUTE_LIFETIME_BOUND) {
1414
695k
  ABSL_DCHECK(message != nullptr);
1415
695k
  ABSL_DCHECK(descriptor_pool != nullptr);
1416
695k
  ABSL_DCHECK(message_factory != nullptr);
1417
695k
  ABSL_DCHECK(arena != nullptr);
1418
1419
695k
  std::string scratch;
1420
695k
  absl::StatusOr<well_known_types::Value> adapted_value =
1421
695k
      well_known_types::AdaptFromMessage(arena, *message, descriptor_pool,
1422
695k
                                         message_factory, scratch);
1423
695k
  if (ABSL_PREDICT_FALSE(!adapted_value.ok())) {
1424
5.24k
    return ErrorValue(std::move(adapted_value).status());
1425
5.24k
  }
1426
690k
  return absl::visit(
1427
690k
      absl::Overload(BorrowingWellKnownTypesValueVisitor{
1428
690k
                         /* .message = */ message, /* .arena = */ arena,
1429
690k
                         /* .scratch = */ &scratch},
1430
690k
                     [&](std::monostate) -> Value {
1431
245k
                       if (message->GetArena() != arena) {
1432
0
                         auto* cloned = message->New(arena);
1433
0
                         cloned->CopyFrom(*message);
1434
0
                         return ParsedMessageValue(cloned, arena);
1435
0
                       }
1436
245k
                       return ParsedMessageValue(message, arena);
1437
245k
                     }),
1438
690k
      std::move(adapted_value).value());
1439
695k
}
1440
1441
Value Value::WrapMessageUnsafe(
1442
    const google::protobuf::Message* absl_nonnull message ABSL_ATTRIBUTE_LIFETIME_BOUND,
1443
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool
1444
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1445
    google::protobuf::MessageFactory* absl_nonnull message_factory
1446
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1447
0
    google::protobuf::Arena* absl_nonnull arena ABSL_ATTRIBUTE_LIFETIME_BOUND) {
1448
0
  ABSL_DCHECK(message != nullptr);
1449
0
  ABSL_DCHECK(descriptor_pool != nullptr);
1450
0
  ABSL_DCHECK(message_factory != nullptr);
1451
0
  ABSL_DCHECK(arena != nullptr);
1452
1453
0
  std::string scratch;
1454
0
  absl::StatusOr<well_known_types::Value> adapted_value =
1455
0
      well_known_types::AdaptFromMessage(arena, *message, descriptor_pool,
1456
0
                                         message_factory, scratch);
1457
0
  if (ABSL_PREDICT_FALSE(!adapted_value.ok())) {
1458
0
    return ErrorValue(std::move(adapted_value).status());
1459
0
  }
1460
0
  return absl::visit(
1461
0
      absl::Overload(BorrowingWellKnownTypesValueVisitor{
1462
0
                         /* .message = */ message, /* .arena = */ arena,
1463
0
                         /* .scratch = */ &scratch},
1464
0
                     [&](std::monostate) -> Value {
1465
0
                       if (message->GetArena() != arena) {
1466
0
                         return UnsafeParsedMessageValue(message);
1467
0
                       }
1468
0
                       return ParsedMessageValue(message, arena);
1469
0
                     }),
1470
0
      std::move(adapted_value).value());
1471
0
}
1472
1473
namespace {
1474
1475
bool IsWellKnownMessageWrapperType(
1476
0
    const google::protobuf::Descriptor* absl_nonnull descriptor) {
1477
0
  switch (descriptor->well_known_type()) {
1478
0
    case google::protobuf::Descriptor::WELLKNOWNTYPE_BOOLVALUE:
1479
0
      ABSL_FALLTHROUGH_INTENDED;
1480
0
    case google::protobuf::Descriptor::WELLKNOWNTYPE_INT32VALUE:
1481
0
      ABSL_FALLTHROUGH_INTENDED;
1482
0
    case google::protobuf::Descriptor::WELLKNOWNTYPE_INT64VALUE:
1483
0
      ABSL_FALLTHROUGH_INTENDED;
1484
0
    case google::protobuf::Descriptor::WELLKNOWNTYPE_UINT32VALUE:
1485
0
      ABSL_FALLTHROUGH_INTENDED;
1486
0
    case google::protobuf::Descriptor::WELLKNOWNTYPE_UINT64VALUE:
1487
0
      ABSL_FALLTHROUGH_INTENDED;
1488
0
    case google::protobuf::Descriptor::WELLKNOWNTYPE_FLOATVALUE:
1489
0
      ABSL_FALLTHROUGH_INTENDED;
1490
0
    case google::protobuf::Descriptor::WELLKNOWNTYPE_DOUBLEVALUE:
1491
0
      ABSL_FALLTHROUGH_INTENDED;
1492
0
    case google::protobuf::Descriptor::WELLKNOWNTYPE_BYTESVALUE:
1493
0
      ABSL_FALLTHROUGH_INTENDED;
1494
0
    case google::protobuf::Descriptor::WELLKNOWNTYPE_STRINGVALUE:
1495
0
      return true;
1496
0
    default:
1497
0
      return false;
1498
0
  }
1499
0
}
1500
1501
template <typename Unsafe>
1502
Value WrapFieldImpl(
1503
    ProtoWrapperTypeOptions wrapper_type_options,
1504
    const google::protobuf::Message* absl_nonnull message ABSL_ATTRIBUTE_LIFETIME_BOUND,
1505
    const google::protobuf::FieldDescriptor* absl_nonnull field
1506
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1507
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool
1508
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1509
    google::protobuf::MessageFactory* absl_nonnull message_factory
1510
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1511
0
    google::protobuf::Arena* absl_nonnull arena ABSL_ATTRIBUTE_LIFETIME_BOUND) {
1512
0
  ABSL_DCHECK(field != nullptr);
1513
0
  ABSL_DCHECK_EQ(message->GetDescriptor(), field->containing_type());
1514
0
  ABSL_DCHECK(descriptor_pool != nullptr);
1515
0
  ABSL_DCHECK(message_factory != nullptr);
1516
0
  ABSL_DCHECK(!IsWellKnownMessageType(message->GetDescriptor()));
1517
1518
0
  const auto* reflection = message->GetReflection();
1519
0
  if (ABSL_PREDICT_FALSE(reflection == nullptr)) {
1520
    // This only happens for special implementations of Message that
1521
    // should not normally be used with CEL.
1522
0
    return ErrorValue(absl::InvalidArgumentError(
1523
0
        absl::StrCat("failed to get reflection for message type: ",
1524
0
                     message->GetDescriptor()->full_name())));
1525
0
  }
1526
0
  if (field->is_map()) {
1527
0
    if constexpr (Unsafe::value) {
1528
0
      return UnsafeParsedMapFieldValue(message, field);
1529
0
    } else {
1530
0
      return ParsedMapFieldValue(message, field,
1531
0
                                 MessageArenaOr(message, arena));
1532
0
    }
1533
0
  }
1534
0
  if (field->is_repeated()) {
1535
0
    if constexpr (Unsafe::value) {
1536
0
      return UnsafeParsedRepeatedFieldValue(message, field);
1537
0
    } else {
1538
0
      return ParsedRepeatedFieldValue(message, field,
1539
0
                                      MessageArenaOr(message, arena));
1540
0
    }
1541
0
  }
1542
0
  switch (field->type()) {
1543
0
    case google::protobuf::FieldDescriptor::TYPE_DOUBLE:
1544
0
      return DoubleValue(reflection->GetDouble(*message, field));
1545
0
    case google::protobuf::FieldDescriptor::TYPE_FLOAT:
1546
0
      return DoubleValue(reflection->GetFloat(*message, field));
1547
0
    case google::protobuf::FieldDescriptor::TYPE_INT64:
1548
0
      return IntValue(reflection->GetInt64(*message, field));
1549
0
    case google::protobuf::FieldDescriptor::TYPE_UINT64:
1550
0
      return UintValue(reflection->GetUInt64(*message, field));
1551
0
    case google::protobuf::FieldDescriptor::TYPE_INT32:
1552
0
      return IntValue(reflection->GetInt32(*message, field));
1553
0
    case google::protobuf::FieldDescriptor::TYPE_FIXED64:
1554
0
      return UintValue(reflection->GetUInt64(*message, field));
1555
0
    case google::protobuf::FieldDescriptor::TYPE_FIXED32:
1556
0
      return UintValue(reflection->GetUInt32(*message, field));
1557
0
    case google::protobuf::FieldDescriptor::TYPE_BOOL:
1558
0
      return BoolValue(reflection->GetBool(*message, field));
1559
0
    case google::protobuf::FieldDescriptor::TYPE_STRING: {
1560
0
      std::string scratch;
1561
0
      return absl::visit(
1562
0
          absl::Overload(
1563
0
              [&](absl::string_view string) -> StringValue {
1564
0
                if (string.data() == scratch.data() &&
1565
0
                    string.size() == scratch.size()) {
1566
0
                  return StringValue(arena, std::move(scratch));
1567
0
                }
1568
0
                if constexpr (Unsafe::value) {
1569
0
                  return StringValue::WrapUnsafe(string);
1570
0
                } else {
1571
0
                  return StringValue(
1572
0
                      Borrower::Arena(MessageArenaOr(message, arena)), string);
1573
0
                }
1574
0
              },
Unexecuted instantiation: value.cc:cel::(anonymous namespace)::WrapFieldImpl<std::__1::integral_constant<bool, false> >(cel::ProtoWrapperTypeOptions, google::protobuf::Message const*, google::protobuf::FieldDescriptor const*, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*)::{lambda(std::__1::basic_string_view<char, std::__1::char_traits<char> >)#1}::operator()(std::__1::basic_string_view<char, std::__1::char_traits<char> >) const
Unexecuted instantiation: value.cc:cel::(anonymous namespace)::WrapFieldImpl<std::__1::integral_constant<bool, true> >(cel::ProtoWrapperTypeOptions, google::protobuf::Message const*, google::protobuf::FieldDescriptor const*, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*)::{lambda(std::__1::basic_string_view<char, std::__1::char_traits<char> >)#1}::operator()(std::__1::basic_string_view<char, std::__1::char_traits<char> >) const
1575
0
              [&](absl::Cord&& cord) -> StringValue {
1576
0
                return StringValue(std::move(cord));
1577
0
              }),
Unexecuted instantiation: value.cc:cel::(anonymous namespace)::WrapFieldImpl<std::__1::integral_constant<bool, false> >(cel::ProtoWrapperTypeOptions, google::protobuf::Message const*, google::protobuf::FieldDescriptor const*, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*)::{lambda(absl::lts_20260526::Cord&&)#1}::operator()(absl::lts_20260526::Cord&&) const
Unexecuted instantiation: value.cc:cel::(anonymous namespace)::WrapFieldImpl<std::__1::integral_constant<bool, true> >(cel::ProtoWrapperTypeOptions, google::protobuf::Message const*, google::protobuf::FieldDescriptor const*, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*)::{lambda(absl::lts_20260526::Cord&&)#1}::operator()(absl::lts_20260526::Cord&&) const
1578
0
          well_known_types::AsVariant(
1579
0
              well_known_types::GetStringField(*message, field, scratch)));
1580
0
    }
1581
0
    case google::protobuf::FieldDescriptor::TYPE_GROUP:
1582
0
      ABSL_FALLTHROUGH_INTENDED;
1583
0
    case google::protobuf::FieldDescriptor::TYPE_MESSAGE:
1584
0
      if (wrapper_type_options == ProtoWrapperTypeOptions::kUnsetNull &&
1585
0
          IsWellKnownMessageWrapperType(field->message_type()) &&
1586
0
          !reflection->HasField(*message, field)) {
1587
0
        return NullValue();
1588
0
      }
1589
0
      if constexpr (Unsafe::value) {
1590
0
        return Value::WrapMessageUnsafe(
1591
0
            &reflection->GetMessage(*message, field, message_factory),
1592
0
            descriptor_pool, message_factory, arena);
1593
0
      } else {
1594
0
        return Value::WrapMessage(
1595
0
            &reflection->GetMessage(*message, field, message_factory),
1596
0
            descriptor_pool, message_factory, arena);
1597
0
      }
1598
0
    case google::protobuf::FieldDescriptor::TYPE_BYTES: {
1599
0
      std::string scratch;
1600
0
      return absl::visit(
1601
0
          absl::Overload(
1602
0
              [&](absl::string_view string) -> BytesValue {
1603
0
                if (string.data() == scratch.data() &&
1604
0
                    string.size() == scratch.size()) {
1605
0
                  return BytesValue(arena, std::move(scratch));
1606
0
                }
1607
0
                if constexpr (Unsafe::value) {
1608
0
                  return BytesValue::WrapUnsafe(string);
1609
0
                } else {
1610
0
                  return BytesValue(
1611
0
                      Borrower::Arena(MessageArenaOr(message, arena)), string);
1612
0
                }
1613
0
              },
Unexecuted instantiation: value.cc:cel::(anonymous namespace)::WrapFieldImpl<std::__1::integral_constant<bool, false> >(cel::ProtoWrapperTypeOptions, google::protobuf::Message const*, google::protobuf::FieldDescriptor const*, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*)::{lambda(std::__1::basic_string_view<char, std::__1::char_traits<char> >)#2}::operator()(std::__1::basic_string_view<char, std::__1::char_traits<char> >) const
Unexecuted instantiation: value.cc:cel::(anonymous namespace)::WrapFieldImpl<std::__1::integral_constant<bool, true> >(cel::ProtoWrapperTypeOptions, google::protobuf::Message const*, google::protobuf::FieldDescriptor const*, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*)::{lambda(std::__1::basic_string_view<char, std::__1::char_traits<char> >)#2}::operator()(std::__1::basic_string_view<char, std::__1::char_traits<char> >) const
1614
0
              [&](absl::Cord&& cord) -> BytesValue {
1615
0
                return BytesValue(std::move(cord));
1616
0
              }),
Unexecuted instantiation: value.cc:cel::(anonymous namespace)::WrapFieldImpl<std::__1::integral_constant<bool, false> >(cel::ProtoWrapperTypeOptions, google::protobuf::Message const*, google::protobuf::FieldDescriptor const*, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*)::{lambda(absl::lts_20260526::Cord&&)#2}::operator()(absl::lts_20260526::Cord&&) const
Unexecuted instantiation: value.cc:cel::(anonymous namespace)::WrapFieldImpl<std::__1::integral_constant<bool, true> >(cel::ProtoWrapperTypeOptions, google::protobuf::Message const*, google::protobuf::FieldDescriptor const*, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*)::{lambda(absl::lts_20260526::Cord&&)#2}::operator()(absl::lts_20260526::Cord&&) const
1617
0
          well_known_types::AsVariant(
1618
0
              well_known_types::GetBytesField(*message, field, scratch)));
1619
0
    }
1620
0
    case google::protobuf::FieldDescriptor::TYPE_UINT32:
1621
0
      return UintValue(reflection->GetUInt32(*message, field));
1622
0
    case google::protobuf::FieldDescriptor::TYPE_ENUM:
1623
0
      return Value::Enum(field->enum_type(),
1624
0
                         reflection->GetEnumValue(*message, field));
1625
0
    case google::protobuf::FieldDescriptor::TYPE_SFIXED32:
1626
0
      return IntValue(reflection->GetInt32(*message, field));
1627
0
    case google::protobuf::FieldDescriptor::TYPE_SFIXED64:
1628
0
      return IntValue(reflection->GetInt64(*message, field));
1629
0
    case google::protobuf::FieldDescriptor::TYPE_SINT32:
1630
0
      return IntValue(reflection->GetInt32(*message, field));
1631
0
    case google::protobuf::FieldDescriptor::TYPE_SINT64:
1632
0
      return IntValue(reflection->GetInt64(*message, field));
1633
0
    default:
1634
0
      return ErrorValue(absl::InvalidArgumentError(
1635
0
          absl::StrCat("unexpected protocol buffer message field type: ",
1636
0
                       field->type_name())));
1637
0
  }
1638
0
}
Unexecuted instantiation: value.cc:cel::Value cel::(anonymous namespace)::WrapFieldImpl<std::__1::integral_constant<bool, false> >(cel::ProtoWrapperTypeOptions, google::protobuf::Message const*, google::protobuf::FieldDescriptor const*, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*)
Unexecuted instantiation: value.cc:cel::Value cel::(anonymous namespace)::WrapFieldImpl<std::__1::integral_constant<bool, true> >(cel::ProtoWrapperTypeOptions, google::protobuf::Message const*, google::protobuf::FieldDescriptor const*, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*)
1639
1640
template <typename Unsafe>
1641
Value WrapRepeatedFieldImpl(
1642
    int index,
1643
    const google::protobuf::Message* absl_nonnull message ABSL_ATTRIBUTE_LIFETIME_BOUND,
1644
    const google::protobuf::FieldDescriptor* absl_nonnull field
1645
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1646
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool
1647
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1648
    google::protobuf::MessageFactory* absl_nonnull message_factory
1649
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1650
0
    google::protobuf::Arena* absl_nonnull arena ABSL_ATTRIBUTE_LIFETIME_BOUND) {
1651
0
  ABSL_DCHECK(field != nullptr);
1652
0
  ABSL_DCHECK_EQ(field->containing_type(), message->GetDescriptor());
1653
0
  ABSL_DCHECK(!field->is_map() && field->is_repeated());
1654
0
  ABSL_DCHECK_GE(index, 0);
1655
0
  ABSL_DCHECK(message != nullptr);
1656
0
  ABSL_DCHECK(descriptor_pool != nullptr);
1657
0
  ABSL_DCHECK(message_factory != nullptr);
1658
0
  ABSL_DCHECK(arena != nullptr);
1659
1660
0
  const auto* reflection = message->GetReflection();
1661
0
  if (ABSL_PREDICT_FALSE(reflection == nullptr)) {
1662
    // This only happens for special implementations of Message that
1663
    // should not normally be used with CEL.
1664
0
    return ErrorValue(absl::InvalidArgumentError(
1665
0
        absl::StrCat("failed to get reflection for message type: ",
1666
0
                     message->GetDescriptor()->full_name())));
1667
0
  }
1668
0
  const int size = reflection->FieldSize(*message, field);
1669
0
  if (ABSL_PREDICT_FALSE(index < 0 || index >= size)) {
1670
0
    return ErrorValue(absl::InvalidArgumentError(
1671
0
        absl::StrCat("index out of bounds: ", index)));
1672
0
  }
1673
0
  switch (field->type()) {
1674
0
    case google::protobuf::FieldDescriptor::TYPE_DOUBLE:
1675
0
      return DoubleValue(reflection->GetRepeatedDouble(*message, field, index));
1676
0
    case google::protobuf::FieldDescriptor::TYPE_FLOAT:
1677
0
      return DoubleValue(reflection->GetRepeatedFloat(*message, field, index));
1678
0
    case google::protobuf::FieldDescriptor::TYPE_SFIXED64:
1679
0
      ABSL_FALLTHROUGH_INTENDED;
1680
0
    case google::protobuf::FieldDescriptor::TYPE_SINT64:
1681
0
      ABSL_FALLTHROUGH_INTENDED;
1682
0
    case google::protobuf::FieldDescriptor::TYPE_INT64:
1683
0
      return IntValue(reflection->GetRepeatedInt64(*message, field, index));
1684
0
    case google::protobuf::FieldDescriptor::TYPE_FIXED64:
1685
0
      ABSL_FALLTHROUGH_INTENDED;
1686
0
    case google::protobuf::FieldDescriptor::TYPE_UINT64:
1687
0
      return UintValue(reflection->GetRepeatedUInt64(*message, field, index));
1688
0
    case google::protobuf::FieldDescriptor::TYPE_SFIXED32:
1689
0
      ABSL_FALLTHROUGH_INTENDED;
1690
0
    case google::protobuf::FieldDescriptor::TYPE_SINT32:
1691
0
      ABSL_FALLTHROUGH_INTENDED;
1692
0
    case google::protobuf::FieldDescriptor::TYPE_INT32:
1693
0
      return IntValue(reflection->GetRepeatedInt32(*message, field, index));
1694
0
    case google::protobuf::FieldDescriptor::TYPE_BOOL:
1695
0
      return BoolValue(reflection->GetRepeatedBool(*message, field, index));
1696
0
    case google::protobuf::FieldDescriptor::TYPE_STRING: {
1697
0
      std::string scratch;
1698
0
      return absl::visit(
1699
0
          absl::Overload(
1700
0
              [&](absl::string_view string) -> StringValue {
1701
0
                if (string.data() == scratch.data() &&
1702
0
                    string.size() == scratch.size()) {
1703
0
                  return StringValue(arena, std::move(scratch));
1704
0
                }
1705
0
                if constexpr (Unsafe::value) {
1706
0
                  return StringValue::WrapUnsafe(string);
1707
0
                } else {
1708
0
                  return StringValue(
1709
0
                      Borrower::Arena(MessageArenaOr(message, arena)), string);
1710
0
                }
1711
0
              },
Unexecuted instantiation: value.cc:cel::(anonymous namespace)::WrapRepeatedFieldImpl<std::__1::integral_constant<bool, false> >(int, google::protobuf::Message const*, google::protobuf::FieldDescriptor const*, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*)::{lambda(std::__1::basic_string_view<char, std::__1::char_traits<char> >)#1}::operator()(std::__1::basic_string_view<char, std::__1::char_traits<char> >) const
Unexecuted instantiation: value.cc:cel::(anonymous namespace)::WrapRepeatedFieldImpl<std::__1::integral_constant<bool, true> >(int, google::protobuf::Message const*, google::protobuf::FieldDescriptor const*, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*)::{lambda(std::__1::basic_string_view<char, std::__1::char_traits<char> >)#1}::operator()(std::__1::basic_string_view<char, std::__1::char_traits<char> >) const
1712
0
              [&](absl::Cord&& cord) -> StringValue {
1713
0
                return StringValue(std::move(cord));
1714
0
              }),
Unexecuted instantiation: value.cc:cel::(anonymous namespace)::WrapRepeatedFieldImpl<std::__1::integral_constant<bool, false> >(int, google::protobuf::Message const*, google::protobuf::FieldDescriptor const*, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*)::{lambda(absl::lts_20260526::Cord&&)#1}::operator()(absl::lts_20260526::Cord&&) const
Unexecuted instantiation: value.cc:cel::(anonymous namespace)::WrapRepeatedFieldImpl<std::__1::integral_constant<bool, true> >(int, google::protobuf::Message const*, google::protobuf::FieldDescriptor const*, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*)::{lambda(absl::lts_20260526::Cord&&)#1}::operator()(absl::lts_20260526::Cord&&) const
1715
0
          well_known_types::AsVariant(well_known_types::GetRepeatedStringField(
1716
0
              reflection, *message, field, index, scratch)));
1717
0
    }
1718
0
    case google::protobuf::FieldDescriptor::TYPE_GROUP:
1719
0
      ABSL_FALLTHROUGH_INTENDED;
1720
0
    case google::protobuf::FieldDescriptor::TYPE_MESSAGE:
1721
0
      if constexpr (Unsafe::value) {
1722
0
        return Value::WrapMessageUnsafe(
1723
0
            &reflection->GetRepeatedMessage(*message, field, index),
1724
0
            descriptor_pool, message_factory, arena);
1725
0
      } else {
1726
0
        return Value::WrapMessage(
1727
0
            &reflection->GetRepeatedMessage(*message, field, index),
1728
0
            descriptor_pool, message_factory, arena);
1729
0
      }
1730
0
    case google::protobuf::FieldDescriptor::TYPE_BYTES: {
1731
0
      std::string scratch;
1732
0
      return absl::visit(
1733
0
          absl::Overload(
1734
0
              [&](absl::string_view string) -> BytesValue {
1735
0
                if (string.data() == scratch.data() &&
1736
0
                    string.size() == scratch.size()) {
1737
0
                  return BytesValue(arena, std::move(scratch));
1738
0
                }
1739
0
                if constexpr (Unsafe::value) {
1740
0
                  return BytesValue::WrapUnsafe(string);
1741
0
                } else {
1742
0
                  return BytesValue(
1743
0
                      Borrower::Arena(MessageArenaOr(message, arena)), string);
1744
0
                }
1745
0
              },
Unexecuted instantiation: value.cc:cel::(anonymous namespace)::WrapRepeatedFieldImpl<std::__1::integral_constant<bool, false> >(int, google::protobuf::Message const*, google::protobuf::FieldDescriptor const*, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*)::{lambda(std::__1::basic_string_view<char, std::__1::char_traits<char> >)#2}::operator()(std::__1::basic_string_view<char, std::__1::char_traits<char> >) const
Unexecuted instantiation: value.cc:cel::(anonymous namespace)::WrapRepeatedFieldImpl<std::__1::integral_constant<bool, true> >(int, google::protobuf::Message const*, google::protobuf::FieldDescriptor const*, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*)::{lambda(std::__1::basic_string_view<char, std::__1::char_traits<char> >)#2}::operator()(std::__1::basic_string_view<char, std::__1::char_traits<char> >) const
1746
0
              [&](absl::Cord&& cord) -> BytesValue {
1747
0
                return BytesValue(std::move(cord));
1748
0
              }),
Unexecuted instantiation: value.cc:cel::(anonymous namespace)::WrapRepeatedFieldImpl<std::__1::integral_constant<bool, false> >(int, google::protobuf::Message const*, google::protobuf::FieldDescriptor const*, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*)::{lambda(absl::lts_20260526::Cord&&)#2}::operator()(absl::lts_20260526::Cord&&) const
Unexecuted instantiation: value.cc:cel::(anonymous namespace)::WrapRepeatedFieldImpl<std::__1::integral_constant<bool, true> >(int, google::protobuf::Message const*, google::protobuf::FieldDescriptor const*, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*)::{lambda(absl::lts_20260526::Cord&&)#2}::operator()(absl::lts_20260526::Cord&&) const
1749
0
          well_known_types::AsVariant(well_known_types::GetRepeatedBytesField(
1750
0
              reflection, *message, field, index, scratch)));
1751
0
    }
1752
0
    case google::protobuf::FieldDescriptor::TYPE_FIXED32:
1753
0
      ABSL_FALLTHROUGH_INTENDED;
1754
0
    case google::protobuf::FieldDescriptor::TYPE_UINT32:
1755
0
      return UintValue(reflection->GetRepeatedUInt32(*message, field, index));
1756
0
    case google::protobuf::FieldDescriptor::TYPE_ENUM:
1757
0
      return Value::Enum(field->enum_type(), reflection->GetRepeatedEnumValue(
1758
0
                                                 *message, field, index));
1759
0
    default:
1760
0
      return ErrorValue(absl::InvalidArgumentError(
1761
0
          absl::StrCat("unexpected message field type: ", field->type_name())));
1762
0
  }
1763
0
}
Unexecuted instantiation: value.cc:cel::Value cel::(anonymous namespace)::WrapRepeatedFieldImpl<std::__1::integral_constant<bool, false> >(int, google::protobuf::Message const*, google::protobuf::FieldDescriptor const*, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*)
Unexecuted instantiation: value.cc:cel::Value cel::(anonymous namespace)::WrapRepeatedFieldImpl<std::__1::integral_constant<bool, true> >(int, google::protobuf::Message const*, google::protobuf::FieldDescriptor const*, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*)
1764
1765
template <typename Unsafe>
1766
Value WrapMapFieldValueImpl(
1767
    const google::protobuf::MapValueConstRef& value,
1768
    const google::protobuf::Message* absl_nonnull message ABSL_ATTRIBUTE_LIFETIME_BOUND,
1769
    const google::protobuf::FieldDescriptor* absl_nonnull field
1770
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1771
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool
1772
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1773
    google::protobuf::MessageFactory* absl_nonnull message_factory
1774
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1775
0
    google::protobuf::Arena* absl_nonnull arena ABSL_ATTRIBUTE_LIFETIME_BOUND) {
1776
0
  ABSL_DCHECK(field != nullptr);
1777
0
  ABSL_DCHECK_EQ(field->containing_type()->containing_type(),
1778
0
                 message->GetDescriptor());
1779
0
  ABSL_DCHECK(!field->is_map() && !field->is_repeated());
1780
0
  ABSL_DCHECK_EQ(value.type(), field->cpp_type());
1781
0
  ABSL_DCHECK(message != nullptr);
1782
0
  ABSL_DCHECK(descriptor_pool != nullptr);
1783
0
  ABSL_DCHECK(message_factory != nullptr);
1784
0
  ABSL_DCHECK(arena != nullptr);
1785
1786
0
  switch (field->type()) {
1787
0
    case google::protobuf::FieldDescriptor::TYPE_DOUBLE:
1788
0
      return DoubleValue(value.GetDoubleValue());
1789
0
    case google::protobuf::FieldDescriptor::TYPE_FLOAT:
1790
0
      return DoubleValue(value.GetFloatValue());
1791
0
    case google::protobuf::FieldDescriptor::TYPE_SFIXED64:
1792
0
      ABSL_FALLTHROUGH_INTENDED;
1793
0
    case google::protobuf::FieldDescriptor::TYPE_SINT64:
1794
0
      ABSL_FALLTHROUGH_INTENDED;
1795
0
    case google::protobuf::FieldDescriptor::TYPE_INT64:
1796
0
      return IntValue(value.GetInt64Value());
1797
0
    case google::protobuf::FieldDescriptor::TYPE_FIXED64:
1798
0
      ABSL_FALLTHROUGH_INTENDED;
1799
0
    case google::protobuf::FieldDescriptor::TYPE_UINT64:
1800
0
      return UintValue(value.GetUInt64Value());
1801
0
    case google::protobuf::FieldDescriptor::TYPE_SFIXED32:
1802
0
      ABSL_FALLTHROUGH_INTENDED;
1803
0
    case google::protobuf::FieldDescriptor::TYPE_SINT32:
1804
0
      ABSL_FALLTHROUGH_INTENDED;
1805
0
    case google::protobuf::FieldDescriptor::TYPE_INT32:
1806
0
      return IntValue(value.GetInt32Value());
1807
0
    case google::protobuf::FieldDescriptor::TYPE_BOOL:
1808
0
      return BoolValue(value.GetBoolValue());
1809
0
    case google::protobuf::FieldDescriptor::TYPE_STRING:
1810
0
      if constexpr (Unsafe::value) {
1811
0
        return StringValue::WrapUnsafe(value.GetStringValue());
1812
0
      } else {
1813
0
        return StringValue(Borrower::Arena(MessageArenaOr(message, arena)),
1814
0
                           value.GetStringValue());
1815
0
      }
1816
0
    case google::protobuf::FieldDescriptor::TYPE_GROUP:
1817
0
      ABSL_FALLTHROUGH_INTENDED;
1818
0
    case google::protobuf::FieldDescriptor::TYPE_MESSAGE:
1819
0
      if constexpr (Unsafe::value) {
1820
0
        return Value::WrapMessageUnsafe(
1821
0
            &value.GetMessageValue(), descriptor_pool, message_factory, arena);
1822
0
      } else {
1823
0
        return Value::WrapMessage(&value.GetMessageValue(), descriptor_pool,
1824
0
                                  message_factory, arena);
1825
0
      }
1826
0
    case google::protobuf::FieldDescriptor::TYPE_BYTES:
1827
0
      if constexpr (Unsafe::value) {
1828
0
        return BytesValue::WrapUnsafe(value.GetStringValue());
1829
0
      } else {
1830
0
        return BytesValue(Borrower::Arena(MessageArenaOr(message, arena)),
1831
0
                          value.GetStringValue());
1832
0
      }
1833
0
    case google::protobuf::FieldDescriptor::TYPE_FIXED32:
1834
0
      ABSL_FALLTHROUGH_INTENDED;
1835
0
    case google::protobuf::FieldDescriptor::TYPE_UINT32:
1836
0
      return UintValue(value.GetUInt32Value());
1837
0
    case google::protobuf::FieldDescriptor::TYPE_ENUM:
1838
0
      return Value::Enum(field->enum_type(), value.GetEnumValue());
1839
0
    default:
1840
0
      return ErrorValue(absl::InvalidArgumentError(
1841
0
          absl::StrCat("unexpected message field type: ", field->type_name())));
1842
0
  }
1843
0
}
Unexecuted instantiation: value.cc:cel::Value cel::(anonymous namespace)::WrapMapFieldValueImpl<std::__1::integral_constant<bool, false> >(google::protobuf::MapValueConstRef const&, google::protobuf::Message const*, google::protobuf::FieldDescriptor const*, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*)
Unexecuted instantiation: value.cc:cel::Value cel::(anonymous namespace)::WrapMapFieldValueImpl<std::__1::integral_constant<bool, true> >(google::protobuf::MapValueConstRef const&, google::protobuf::Message const*, google::protobuf::FieldDescriptor const*, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*)
1844
1845
}  // namespace
1846
1847
Value Value::WrapField(
1848
    ProtoWrapperTypeOptions wrapper_type_options,
1849
    const google::protobuf::Message* absl_nonnull message ABSL_ATTRIBUTE_LIFETIME_BOUND,
1850
    const google::protobuf::FieldDescriptor* absl_nonnull field
1851
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1852
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool
1853
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1854
    google::protobuf::MessageFactory* absl_nonnull message_factory
1855
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1856
0
    google::protobuf::Arena* absl_nonnull arena ABSL_ATTRIBUTE_LIFETIME_BOUND) {
1857
0
  using Unsafe = std::false_type;
1858
0
  return WrapFieldImpl<Unsafe>(wrapper_type_options, message, field,
1859
0
                               descriptor_pool, message_factory, arena);
1860
0
}
1861
1862
Value Value::WrapFieldUnsafe(
1863
    ProtoWrapperTypeOptions wrapper_type_options,
1864
    const google::protobuf::Message* absl_nonnull message ABSL_ATTRIBUTE_LIFETIME_BOUND,
1865
    const google::protobuf::FieldDescriptor* absl_nonnull field
1866
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1867
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool
1868
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1869
    google::protobuf::MessageFactory* absl_nonnull message_factory
1870
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1871
0
    google::protobuf::Arena* absl_nonnull arena ABSL_ATTRIBUTE_LIFETIME_BOUND) {
1872
0
  using Unsafe = std::true_type;
1873
0
  return WrapFieldImpl<Unsafe>(wrapper_type_options, message, field,
1874
0
                               descriptor_pool, message_factory, arena);
1875
0
}
1876
1877
Value Value::WrapRepeatedField(
1878
    int index,
1879
    const google::protobuf::Message* absl_nonnull message ABSL_ATTRIBUTE_LIFETIME_BOUND,
1880
    const google::protobuf::FieldDescriptor* absl_nonnull field
1881
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1882
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool
1883
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1884
    google::protobuf::MessageFactory* absl_nonnull message_factory
1885
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1886
0
    google::protobuf::Arena* absl_nonnull arena ABSL_ATTRIBUTE_LIFETIME_BOUND) {
1887
0
  using Unsafe = std::false_type;
1888
0
  return WrapRepeatedFieldImpl<Unsafe>(index, message, field, descriptor_pool,
1889
0
                                       message_factory, arena);
1890
0
}
1891
1892
Value Value::WrapRepeatedFieldUnsafe(
1893
    int index,
1894
    const google::protobuf::Message* absl_nonnull message ABSL_ATTRIBUTE_LIFETIME_BOUND,
1895
    const google::protobuf::FieldDescriptor* absl_nonnull field
1896
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1897
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool
1898
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1899
    google::protobuf::MessageFactory* absl_nonnull message_factory
1900
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1901
0
    google::protobuf::Arena* absl_nonnull arena ABSL_ATTRIBUTE_LIFETIME_BOUND) {
1902
0
  using Unsafe = std::true_type;
1903
0
  return WrapRepeatedFieldImpl<Unsafe>(index, message, field, descriptor_pool,
1904
0
                                       message_factory, arena);
1905
0
}
1906
1907
StringValue Value::WrapMapFieldKeyString(
1908
    const google::protobuf::MapKey& key,
1909
    const google::protobuf::Message* absl_nonnull message ABSL_ATTRIBUTE_LIFETIME_BOUND,
1910
0
    google::protobuf::Arena* absl_nonnull arena ABSL_ATTRIBUTE_LIFETIME_BOUND) {
1911
0
  ABSL_DCHECK(message != nullptr);
1912
0
  ABSL_DCHECK(arena != nullptr);
1913
0
  ABSL_DCHECK_EQ(key.type(), google::protobuf::FieldDescriptor::CPPTYPE_STRING);
1914
1915
0
#if CEL_INTERNAL_PROTOBUF_OSS_VERSION_PREREQ(5, 30, 0)
1916
0
  return StringValue(Borrower::Arena(MessageArenaOr(message, arena)),
1917
0
                     key.GetStringValue());
1918
#else
1919
  return StringValue(arena, key.GetStringValue());
1920
#endif
1921
0
}
1922
1923
Value Value::WrapMapFieldValue(
1924
    const google::protobuf::MapValueConstRef& value,
1925
    const google::protobuf::Message* absl_nonnull message ABSL_ATTRIBUTE_LIFETIME_BOUND,
1926
    const google::protobuf::FieldDescriptor* absl_nonnull field
1927
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1928
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool
1929
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1930
    google::protobuf::MessageFactory* absl_nonnull message_factory
1931
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1932
0
    google::protobuf::Arena* absl_nonnull arena ABSL_ATTRIBUTE_LIFETIME_BOUND) {
1933
0
  using Unsafe = std::false_type;
1934
0
  return WrapMapFieldValueImpl<Unsafe>(value, message, field, descriptor_pool,
1935
0
                                       message_factory, arena);
1936
0
}
1937
1938
Value Value::WrapMapFieldValueUnsafe(
1939
    const google::protobuf::MapValueConstRef& value,
1940
    const google::protobuf::Message* absl_nonnull message ABSL_ATTRIBUTE_LIFETIME_BOUND,
1941
    const google::protobuf::FieldDescriptor* absl_nonnull field
1942
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1943
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool
1944
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1945
    google::protobuf::MessageFactory* absl_nonnull message_factory
1946
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1947
0
    google::protobuf::Arena* absl_nonnull arena ABSL_ATTRIBUTE_LIFETIME_BOUND) {
1948
0
  using Unsafe = std::true_type;
1949
0
  return WrapMapFieldValueImpl<Unsafe>(value, message, field, descriptor_pool,
1950
0
                                       message_factory, arena);
1951
0
}
1952
1953
4.90k
optional_ref<const BytesValue> Value::AsBytes() const& {
1954
4.90k
  if (const auto* alternative = variant_.As<BytesValue>();
1955
4.90k
      alternative != nullptr) {
1956
3.62k
    return *alternative;
1957
3.62k
  }
1958
1.28k
  return std::nullopt;
1959
4.90k
}
1960
1961
0
absl::optional<BytesValue> Value::AsBytes() && {
1962
0
  if (auto* alternative = variant_.As<BytesValue>(); alternative != nullptr) {
1963
0
    return std::move(*alternative);
1964
0
  }
1965
0
  return std::nullopt;
1966
0
}
1967
1968
254k
absl::optional<DoubleValue> Value::AsDouble() const {
1969
254k
  if (const auto* alternative = variant_.As<DoubleValue>();
1970
254k
      alternative != nullptr) {
1971
234k
    return *alternative;
1972
234k
  }
1973
20.3k
  return std::nullopt;
1974
254k
}
1975
1976
13.3k
absl::optional<DurationValue> Value::AsDuration() const {
1977
13.3k
  if (const auto* alternative = variant_.As<DurationValue>();
1978
13.3k
      alternative != nullptr) {
1979
13.1k
    return *alternative;
1980
13.1k
  }
1981
206
  return std::nullopt;
1982
13.3k
}
1983
1984
16.8M
optional_ref<const ErrorValue> Value::AsError() const& {
1985
16.8M
  if (const auto* alternative = variant_.As<ErrorValue>();
1986
16.8M
      alternative != nullptr) {
1987
0
    return *alternative;
1988
0
  }
1989
16.8M
  return std::nullopt;
1990
16.8M
}
1991
1992
0
absl::optional<ErrorValue> Value::AsError() && {
1993
0
  if (auto* alternative = variant_.As<ErrorValue>(); alternative != nullptr) {
1994
0
    return std::move(*alternative);
1995
0
  }
1996
0
  return std::nullopt;
1997
0
}
1998
1999
25.6k
absl::optional<IntValue> Value::AsInt() const {
2000
25.6k
  if (const auto* alternative = variant_.As<IntValue>();
2001
25.6k
      alternative != nullptr) {
2002
6.32k
    return *alternative;
2003
6.32k
  }
2004
19.2k
  return std::nullopt;
2005
25.6k
}
2006
2007
42.1k
absl::optional<ListValue> Value::AsList() const& {
2008
42.1k
  if (const auto* alternative = variant_.As<common_internal::LegacyListValue>();
2009
42.1k
      alternative != nullptr) {
2010
0
    return *alternative;
2011
0
  }
2012
42.1k
  if (const auto* alternative = variant_.As<CustomListValue>();
2013
42.1k
      alternative != nullptr) {
2014
41.3k
    return *alternative;
2015
41.3k
  }
2016
824
  if (const auto* alternative = variant_.As<ParsedRepeatedFieldValue>();
2017
824
      alternative != nullptr) {
2018
0
    return *alternative;
2019
0
  }
2020
824
  if (const auto* alternative = variant_.As<ParsedJsonListValue>();
2021
824
      alternative != nullptr) {
2022
0
    return *alternative;
2023
0
  }
2024
824
  return std::nullopt;
2025
824
}
2026
2027
0
absl::optional<ListValue> Value::AsList() && {
2028
0
  if (auto* alternative = variant_.As<common_internal::LegacyListValue>();
2029
0
      alternative != nullptr) {
2030
0
    return std::move(*alternative);
2031
0
  }
2032
0
  if (auto* alternative = variant_.As<CustomListValue>();
2033
0
      alternative != nullptr) {
2034
0
    return std::move(*alternative);
2035
0
  }
2036
0
  if (auto* alternative = variant_.As<ParsedRepeatedFieldValue>();
2037
0
      alternative != nullptr) {
2038
0
    return std::move(*alternative);
2039
0
  }
2040
0
  if (auto* alternative = variant_.As<ParsedJsonListValue>();
2041
0
      alternative != nullptr) {
2042
0
    return std::move(*alternative);
2043
0
  }
2044
0
  return std::nullopt;
2045
0
}
2046
2047
36.7k
absl::optional<MapValue> Value::AsMap() const& {
2048
36.7k
  if (const auto* alternative = variant_.As<common_internal::LegacyMapValue>();
2049
36.7k
      alternative != nullptr) {
2050
0
    return *alternative;
2051
0
  }
2052
36.7k
  if (const auto* alternative = variant_.As<CustomMapValue>();
2053
36.7k
      alternative != nullptr) {
2054
18.3k
    return *alternative;
2055
18.3k
  }
2056
18.4k
  if (const auto* alternative = variant_.As<ParsedMapFieldValue>();
2057
18.4k
      alternative != nullptr) {
2058
0
    return *alternative;
2059
0
  }
2060
18.4k
  if (const auto* alternative = variant_.As<ParsedJsonMapValue>();
2061
18.4k
      alternative != nullptr) {
2062
0
    return *alternative;
2063
0
  }
2064
18.4k
  return std::nullopt;
2065
18.4k
}
2066
2067
0
absl::optional<MapValue> Value::AsMap() && {
2068
0
  if (auto* alternative = variant_.As<common_internal::LegacyMapValue>();
2069
0
      alternative != nullptr) {
2070
0
    return std::move(*alternative);
2071
0
  }
2072
0
  if (auto* alternative = variant_.As<CustomMapValue>();
2073
0
      alternative != nullptr) {
2074
0
    return std::move(*alternative);
2075
0
  }
2076
0
  if (auto* alternative = variant_.As<ParsedMapFieldValue>();
2077
0
      alternative != nullptr) {
2078
0
    return std::move(*alternative);
2079
0
  }
2080
0
  if (auto* alternative = variant_.As<ParsedJsonMapValue>();
2081
0
      alternative != nullptr) {
2082
0
    return std::move(*alternative);
2083
0
  }
2084
0
  return std::nullopt;
2085
0
}
2086
2087
0
absl::optional<MessageValue> Value::AsMessage() const& {
2088
0
  if (const auto* alternative = variant_.As<ParsedMessageValue>();
2089
0
      alternative != nullptr) {
2090
0
    return *alternative;
2091
0
  }
2092
0
  return std::nullopt;
2093
0
}
2094
2095
0
absl::optional<MessageValue> Value::AsMessage() && {
2096
0
  if (auto* alternative = variant_.As<ParsedMessageValue>();
2097
0
      alternative != nullptr) {
2098
0
    return std::move(*alternative);
2099
0
  }
2100
0
  return std::nullopt;
2101
0
}
2102
2103
0
absl::optional<NullValue> Value::AsNull() const {
2104
0
  if (const auto* alternative = variant_.As<NullValue>();
2105
0
      alternative != nullptr) {
2106
0
    return *alternative;
2107
0
  }
2108
0
  return std::nullopt;
2109
0
}
2110
2111
0
optional_ref<const OpaqueValue> Value::AsOpaque() const& {
2112
0
  if (const auto* alternative = variant_.As<OpaqueValue>();
2113
0
      alternative != nullptr) {
2114
0
    return *alternative;
2115
0
  }
2116
0
  return std::nullopt;
2117
0
}
2118
2119
0
absl::optional<OpaqueValue> Value::AsOpaque() && {
2120
0
  if (auto* alternative = variant_.As<OpaqueValue>(); alternative != nullptr) {
2121
0
    return std::move(*alternative);
2122
0
  }
2123
0
  return std::nullopt;
2124
0
}
2125
2126
0
optional_ref<const OptionalValue> Value::AsOptional() const& {
2127
0
  if (const auto* alternative = variant_.As<OpaqueValue>();
2128
0
      alternative != nullptr && alternative->IsOptional()) {
2129
0
    return static_cast<const OptionalValue&>(*alternative);
2130
0
  }
2131
0
  return std::nullopt;
2132
0
}
2133
2134
0
absl::optional<OptionalValue> Value::AsOptional() && {
2135
0
  if (auto* alternative = variant_.As<OpaqueValue>();
2136
0
      alternative != nullptr && alternative->IsOptional()) {
2137
0
    return static_cast<OptionalValue&&>(*alternative);
2138
0
  }
2139
0
  return std::nullopt;
2140
0
}
2141
2142
1.03k
optional_ref<const ParsedJsonListValue> Value::AsParsedJsonList() const& {
2143
1.03k
  if (const auto* alternative = variant_.As<ParsedJsonListValue>();
2144
1.03k
      alternative != nullptr) {
2145
13
    return *alternative;
2146
13
  }
2147
1.02k
  return std::nullopt;
2148
1.03k
}
2149
2150
0
absl::optional<ParsedJsonListValue> Value::AsParsedJsonList() && {
2151
0
  if (auto* alternative = variant_.As<ParsedJsonListValue>();
2152
0
      alternative != nullptr) {
2153
0
    return std::move(*alternative);
2154
0
  }
2155
0
  return std::nullopt;
2156
0
}
2157
2158
870
optional_ref<const ParsedJsonMapValue> Value::AsParsedJsonMap() const& {
2159
870
  if (const auto* alternative = variant_.As<ParsedJsonMapValue>();
2160
870
      alternative != nullptr) {
2161
262
    return *alternative;
2162
262
  }
2163
608
  return std::nullopt;
2164
870
}
2165
2166
0
absl::optional<ParsedJsonMapValue> Value::AsParsedJsonMap() && {
2167
0
  if (auto* alternative = variant_.As<ParsedJsonMapValue>();
2168
0
      alternative != nullptr) {
2169
0
    return std::move(*alternative);
2170
0
  }
2171
0
  return std::nullopt;
2172
0
}
2173
2174
639
optional_ref<const CustomListValue> Value::AsCustomList() const& {
2175
639
  if (const auto* alternative = variant_.As<CustomListValue>();
2176
639
      alternative != nullptr) {
2177
636
    return *alternative;
2178
636
  }
2179
3
  return std::nullopt;
2180
639
}
2181
2182
0
absl::optional<CustomListValue> Value::AsCustomList() && {
2183
0
  if (auto* alternative = variant_.As<CustomListValue>();
2184
0
      alternative != nullptr) {
2185
0
    return std::move(*alternative);
2186
0
  }
2187
0
  return std::nullopt;
2188
0
}
2189
2190
29
optional_ref<const CustomMapValue> Value::AsCustomMap() const& {
2191
29
  if (const auto* alternative = variant_.As<CustomMapValue>();
2192
29
      alternative != nullptr) {
2193
28
    return *alternative;
2194
28
  }
2195
1
  return std::nullopt;
2196
29
}
2197
2198
0
absl::optional<CustomMapValue> Value::AsCustomMap() && {
2199
0
  if (auto* alternative = variant_.As<CustomMapValue>();
2200
0
      alternative != nullptr) {
2201
0
    return std::move(*alternative);
2202
0
  }
2203
0
  return std::nullopt;
2204
0
}
2205
2206
609
optional_ref<const ParsedMapFieldValue> Value::AsParsedMapField() const& {
2207
609
  if (const auto* alternative = variant_.As<ParsedMapFieldValue>();
2208
609
      alternative != nullptr) {
2209
0
    return *alternative;
2210
0
  }
2211
609
  return std::nullopt;
2212
609
}
2213
2214
0
absl::optional<ParsedMapFieldValue> Value::AsParsedMapField() && {
2215
0
  if (auto* alternative = variant_.As<ParsedMapFieldValue>();
2216
0
      alternative != nullptr) {
2217
0
    return std::move(*alternative);
2218
0
  }
2219
0
  return std::nullopt;
2220
0
}
2221
2222
266k
optional_ref<const ParsedMessageValue> Value::AsParsedMessage() const& {
2223
266k
  if (const auto* alternative = variant_.As<ParsedMessageValue>();
2224
266k
      alternative != nullptr) {
2225
266k
    return *alternative;
2226
266k
  }
2227
93
  return std::nullopt;
2228
266k
}
2229
2230
0
absl::optional<ParsedMessageValue> Value::AsParsedMessage() && {
2231
0
  if (auto* alternative = variant_.As<ParsedMessageValue>();
2232
0
      alternative != nullptr) {
2233
0
    return std::move(*alternative);
2234
0
  }
2235
0
  return std::nullopt;
2236
0
}
2237
2238
optional_ref<const ParsedRepeatedFieldValue> Value::AsParsedRepeatedField()
2239
1.02k
    const& {
2240
1.02k
  if (const auto* alternative = variant_.As<ParsedRepeatedFieldValue>();
2241
1.02k
      alternative != nullptr) {
2242
0
    return *alternative;
2243
0
  }
2244
1.02k
  return std::nullopt;
2245
1.02k
}
2246
2247
0
absl::optional<ParsedRepeatedFieldValue> Value::AsParsedRepeatedField() && {
2248
0
  if (auto* alternative = variant_.As<ParsedRepeatedFieldValue>();
2249
0
      alternative != nullptr) {
2250
0
    return std::move(*alternative);
2251
0
  }
2252
0
  return std::nullopt;
2253
0
}
2254
2255
0
optional_ref<const CustomStructValue> Value::AsCustomStruct() const& {
2256
0
  if (const auto* alternative = variant_.As<CustomStructValue>();
2257
0
      alternative != nullptr) {
2258
0
    return *alternative;
2259
0
  }
2260
0
  return std::nullopt;
2261
0
}
2262
2263
0
absl::optional<CustomStructValue> Value::AsCustomStruct() && {
2264
0
  if (auto* alternative = variant_.As<CustomStructValue>();
2265
0
      alternative != nullptr) {
2266
0
    return std::move(*alternative);
2267
0
  }
2268
0
  return std::nullopt;
2269
0
}
2270
2271
25.3k
optional_ref<const StringValue> Value::AsString() const& {
2272
25.3k
  if (const auto* alternative = variant_.As<StringValue>();
2273
25.3k
      alternative != nullptr) {
2274
4.15k
    return *alternative;
2275
4.15k
  }
2276
21.1k
  return std::nullopt;
2277
25.3k
}
2278
2279
0
absl::optional<StringValue> Value::AsString() && {
2280
0
  if (auto* alternative = variant_.As<StringValue>(); alternative != nullptr) {
2281
0
    return std::move(*alternative);
2282
0
  }
2283
0
  return std::nullopt;
2284
0
}
2285
2286
93
absl::optional<StructValue> Value::AsStruct() const& {
2287
93
  if (const auto* alternative =
2288
93
          variant_.As<common_internal::LegacyStructValue>();
2289
93
      alternative != nullptr) {
2290
0
    return *alternative;
2291
0
  }
2292
93
  if (const auto* alternative = variant_.As<CustomStructValue>();
2293
93
      alternative != nullptr) {
2294
0
    return *alternative;
2295
0
  }
2296
93
  if (const auto* alternative = variant_.As<ParsedMessageValue>();
2297
93
      alternative != nullptr) {
2298
0
    return *alternative;
2299
0
  }
2300
93
  return std::nullopt;
2301
93
}
2302
2303
0
absl::optional<StructValue> Value::AsStruct() && {
2304
0
  if (auto* alternative = variant_.As<common_internal::LegacyStructValue>();
2305
0
      alternative != nullptr) {
2306
0
    return std::move(*alternative);
2307
0
  }
2308
0
  if (auto* alternative = variant_.As<CustomStructValue>();
2309
0
      alternative != nullptr) {
2310
0
    return std::move(*alternative);
2311
0
  }
2312
0
  if (auto* alternative = variant_.As<ParsedMessageValue>();
2313
0
      alternative != nullptr) {
2314
0
    return std::move(*alternative);
2315
0
  }
2316
0
  return std::nullopt;
2317
0
}
2318
2319
221
absl::optional<TimestampValue> Value::AsTimestamp() const {
2320
221
  if (const auto* alternative = variant_.As<TimestampValue>();
2321
221
      alternative != nullptr) {
2322
0
    return *alternative;
2323
0
  }
2324
221
  return std::nullopt;
2325
221
}
2326
2327
444
optional_ref<const TypeValue> Value::AsType() const& {
2328
444
  if (const auto* alternative = variant_.As<TypeValue>();
2329
444
      alternative != nullptr) {
2330
0
    return *alternative;
2331
0
  }
2332
444
  return std::nullopt;
2333
444
}
2334
2335
0
absl::optional<TypeValue> Value::AsType() && {
2336
0
  if (auto* alternative = variant_.As<TypeValue>(); alternative != nullptr) {
2337
0
    return std::move(*alternative);
2338
0
  }
2339
0
  return std::nullopt;
2340
0
}
2341
2342
251k
absl::optional<UintValue> Value::AsUint() const {
2343
251k
  if (const auto* alternative = variant_.As<UintValue>();
2344
251k
      alternative != nullptr) {
2345
3.17k
    return *alternative;
2346
3.17k
  }
2347
247k
  return std::nullopt;
2348
251k
}
2349
2350
16.8M
optional_ref<const UnknownValue> Value::AsUnknown() const& {
2351
16.8M
  if (const auto* alternative = variant_.As<UnknownValue>();
2352
16.8M
      alternative != nullptr) {
2353
0
    return *alternative;
2354
0
  }
2355
16.8M
  return std::nullopt;
2356
16.8M
}
2357
2358
0
absl::optional<UnknownValue> Value::AsUnknown() && {
2359
0
  if (auto* alternative = variant_.As<UnknownValue>(); alternative != nullptr) {
2360
0
    return std::move(*alternative);
2361
0
  }
2362
0
  return std::nullopt;
2363
0
}
2364
2365
25.6k
const BytesValue& Value::GetBytes() const& {
2366
51.3k
  ABSL_DCHECK(IsBytes()) << *this;
2367
25.6k
  return variant_.Get<BytesValue>();
2368
25.6k
}
2369
2370
0
BytesValue Value::GetBytes() && {
2371
0
  ABSL_DCHECK(IsBytes()) << *this;
2372
0
  return std::move(variant_).Get<BytesValue>();
2373
0
}
2374
2375
346k
DoubleValue Value::GetDouble() const {
2376
692k
  ABSL_DCHECK(IsDouble()) << *this;
2377
346k
  return variant_.Get<DoubleValue>();
2378
346k
}
2379
2380
13.4k
DurationValue Value::GetDuration() const {
2381
26.9k
  ABSL_DCHECK(IsDuration()) << *this;
2382
13.4k
  return variant_.Get<DurationValue>();
2383
13.4k
}
2384
2385
10.4k
const ErrorValue& Value::GetError() const& {
2386
20.8k
  ABSL_DCHECK(IsError()) << *this;
2387
10.4k
  return variant_.Get<ErrorValue>();
2388
10.4k
}
2389
2390
0
ErrorValue Value::GetError() && {
2391
0
  ABSL_DCHECK(IsError()) << *this;
2392
0
  return std::move(variant_).Get<ErrorValue>();
2393
0
}
2394
2395
2.46M
IntValue Value::GetInt() const {
2396
4.93M
  ABSL_DCHECK(IsInt()) << *this;
2397
2.46M
  return variant_.Get<IntValue>();
2398
2.46M
}
2399
2400
#ifdef ABSL_HAVE_EXCEPTIONS
2401
0
#define CEL_VALUE_THROW_BAD_VARIANT_ACCESS() throw absl::bad_variant_access()
2402
#else
2403
#define CEL_VALUE_THROW_BAD_VARIANT_ACCESS() \
2404
  ABSL_LOG(FATAL) << absl::bad_variant_access().what() /* Crash OK */
2405
#endif
2406
2407
2.43M
ListValue Value::GetList() const& {
2408
4.87M
  ABSL_DCHECK(IsList()) << *this;
2409
2.43M
  if (const auto* alternative = variant_.As<common_internal::LegacyListValue>();
2410
2.43M
      alternative != nullptr) {
2411
0
    return *alternative;
2412
0
  }
2413
2.43M
  if (const auto* alternative = variant_.As<CustomListValue>();
2414
2.43M
      alternative != nullptr) {
2415
2.36M
    return *alternative;
2416
2.36M
  }
2417
73.5k
  if (const auto* alternative = variant_.As<ParsedRepeatedFieldValue>();
2418
73.5k
      alternative != nullptr) {
2419
0
    return *alternative;
2420
0
  }
2421
73.5k
  if (const auto* alternative = variant_.As<ParsedJsonListValue>();
2422
73.5k
      alternative != nullptr) {
2423
73.5k
    return *alternative;
2424
73.5k
  }
2425
73.5k
  CEL_VALUE_THROW_BAD_VARIANT_ACCESS();
2426
73.5k
}
2427
2428
0
ListValue Value::GetList() && {
2429
0
  ABSL_DCHECK(IsList()) << *this;
2430
0
  if (auto* alternative = variant_.As<common_internal::LegacyListValue>();
2431
0
      alternative != nullptr) {
2432
0
    return std::move(*alternative);
2433
0
  }
2434
0
  if (auto* alternative = variant_.As<CustomListValue>();
2435
0
      alternative != nullptr) {
2436
0
    return std::move(*alternative);
2437
0
  }
2438
0
  if (auto* alternative = variant_.As<ParsedRepeatedFieldValue>();
2439
0
      alternative != nullptr) {
2440
0
    return std::move(*alternative);
2441
0
  }
2442
0
  if (auto* alternative = variant_.As<ParsedJsonListValue>();
2443
0
      alternative != nullptr) {
2444
0
    return std::move(*alternative);
2445
0
  }
2446
0
  CEL_VALUE_THROW_BAD_VARIANT_ACCESS();
2447
0
}
2448
2449
498k
MapValue Value::GetMap() const& {
2450
996k
  ABSL_DCHECK(IsMap()) << *this;
2451
498k
  if (const auto* alternative = variant_.As<common_internal::LegacyMapValue>();
2452
498k
      alternative != nullptr) {
2453
0
    return *alternative;
2454
0
  }
2455
498k
  if (const auto* alternative = variant_.As<CustomMapValue>();
2456
498k
      alternative != nullptr) {
2457
495k
    return *alternative;
2458
495k
  }
2459
2.72k
  if (const auto* alternative = variant_.As<ParsedMapFieldValue>();
2460
2.72k
      alternative != nullptr) {
2461
0
    return *alternative;
2462
0
  }
2463
2.72k
  if (const auto* alternative = variant_.As<ParsedJsonMapValue>();
2464
2.72k
      alternative != nullptr) {
2465
2.72k
    return *alternative;
2466
2.72k
  }
2467
2.72k
  CEL_VALUE_THROW_BAD_VARIANT_ACCESS();
2468
2.72k
}
2469
2470
0
MapValue Value::GetMap() && {
2471
0
  ABSL_DCHECK(IsMap()) << *this;
2472
0
  if (auto* alternative = variant_.As<common_internal::LegacyMapValue>();
2473
0
      alternative != nullptr) {
2474
0
    return std::move(*alternative);
2475
0
  }
2476
0
  if (auto* alternative = variant_.As<CustomMapValue>();
2477
0
      alternative != nullptr) {
2478
0
    return std::move(*alternative);
2479
0
  }
2480
0
  if (auto* alternative = variant_.As<ParsedMapFieldValue>();
2481
0
      alternative != nullptr) {
2482
0
    return std::move(*alternative);
2483
0
  }
2484
0
  if (auto* alternative = variant_.As<ParsedJsonMapValue>();
2485
0
      alternative != nullptr) {
2486
0
    return std::move(*alternative);
2487
0
  }
2488
0
  CEL_VALUE_THROW_BAD_VARIANT_ACCESS();
2489
0
}
2490
2491
0
MessageValue Value::GetMessage() const& {
2492
0
  ABSL_DCHECK(IsMessage()) << *this;
2493
0
  return variant_.Get<ParsedMessageValue>();
2494
0
}
2495
2496
0
MessageValue Value::GetMessage() && {
2497
0
  ABSL_DCHECK(IsMessage()) << *this;
2498
0
  return std::move(variant_).Get<ParsedMessageValue>();
2499
0
}
2500
2501
0
NullValue Value::GetNull() const {
2502
0
  ABSL_DCHECK(IsNull()) << *this;
2503
0
  return variant_.Get<NullValue>();
2504
0
}
2505
2506
0
const OpaqueValue& Value::GetOpaque() const& {
2507
0
  ABSL_DCHECK(IsOpaque()) << *this;
2508
0
  return variant_.Get<OpaqueValue>();
2509
0
}
2510
2511
0
OpaqueValue Value::GetOpaque() && {
2512
0
  ABSL_DCHECK(IsOpaque()) << *this;
2513
0
  return std::move(variant_).Get<OpaqueValue>();
2514
0
}
2515
2516
0
const OptionalValue& Value::GetOptional() const& {
2517
0
  ABSL_DCHECK(IsOptional()) << *this;
2518
0
  return static_cast<const OptionalValue&>(variant_.Get<OpaqueValue>());
2519
0
}
2520
2521
0
OptionalValue Value::GetOptional() && {
2522
0
  ABSL_DCHECK(IsOptional()) << *this;
2523
0
  return static_cast<OptionalValue&&>(std::move(variant_).Get<OpaqueValue>());
2524
0
}
2525
2526
0
const ParsedJsonListValue& Value::GetParsedJsonList() const& {
2527
0
  ABSL_DCHECK(IsParsedJsonList()) << *this;
2528
0
  return variant_.Get<ParsedJsonListValue>();
2529
0
}
2530
2531
0
ParsedJsonListValue Value::GetParsedJsonList() && {
2532
0
  ABSL_DCHECK(IsParsedJsonList()) << *this;
2533
0
  return std::move(variant_).Get<ParsedJsonListValue>();
2534
0
}
2535
2536
0
const ParsedJsonMapValue& Value::GetParsedJsonMap() const& {
2537
0
  ABSL_DCHECK(IsParsedJsonMap()) << *this;
2538
0
  return variant_.Get<ParsedJsonMapValue>();
2539
0
}
2540
2541
0
ParsedJsonMapValue Value::GetParsedJsonMap() && {
2542
0
  ABSL_DCHECK(IsParsedJsonMap()) << *this;
2543
0
  return std::move(variant_).Get<ParsedJsonMapValue>();
2544
0
}
2545
2546
0
const CustomListValue& Value::GetCustomList() const& {
2547
0
  ABSL_DCHECK(IsCustomList()) << *this;
2548
0
  return variant_.Get<CustomListValue>();
2549
0
}
2550
2551
0
CustomListValue Value::GetCustomList() && {
2552
0
  ABSL_DCHECK(IsCustomList()) << *this;
2553
0
  return std::move(variant_).Get<CustomListValue>();
2554
0
}
2555
2556
0
const CustomMapValue& Value::GetCustomMap() const& {
2557
0
  ABSL_DCHECK(IsCustomMap()) << *this;
2558
0
  return variant_.Get<CustomMapValue>();
2559
0
}
2560
2561
0
CustomMapValue Value::GetCustomMap() && {
2562
0
  ABSL_DCHECK(IsCustomMap()) << *this;
2563
0
  return std::move(variant_).Get<CustomMapValue>();
2564
0
}
2565
2566
0
const ParsedMapFieldValue& Value::GetParsedMapField() const& {
2567
0
  ABSL_DCHECK(IsParsedMapField()) << *this;
2568
0
  return variant_.Get<ParsedMapFieldValue>();
2569
0
}
2570
2571
0
ParsedMapFieldValue Value::GetParsedMapField() && {
2572
0
  ABSL_DCHECK(IsParsedMapField()) << *this;
2573
0
  return std::move(variant_).Get<ParsedMapFieldValue>();
2574
0
}
2575
2576
0
const ParsedMessageValue& Value::GetParsedMessage() const& {
2577
0
  ABSL_DCHECK(IsParsedMessage()) << *this;
2578
0
  return variant_.Get<ParsedMessageValue>();
2579
0
}
2580
2581
0
ParsedMessageValue Value::GetParsedMessage() && {
2582
0
  ABSL_DCHECK(IsParsedMessage()) << *this;
2583
0
  return std::move(variant_).Get<ParsedMessageValue>();
2584
0
}
2585
2586
0
const ParsedRepeatedFieldValue& Value::GetParsedRepeatedField() const& {
2587
0
  ABSL_DCHECK(IsParsedRepeatedField()) << *this;
2588
0
  return variant_.Get<ParsedRepeatedFieldValue>();
2589
0
}
2590
2591
0
ParsedRepeatedFieldValue Value::GetParsedRepeatedField() && {
2592
0
  ABSL_DCHECK(IsParsedRepeatedField()) << *this;
2593
0
  return std::move(variant_).Get<ParsedRepeatedFieldValue>();
2594
0
}
2595
2596
0
const CustomStructValue& Value::GetCustomStruct() const& {
2597
0
  ABSL_DCHECK(IsCustomStruct()) << *this;
2598
0
  return variant_.Get<CustomStructValue>();
2599
0
}
2600
2601
0
CustomStructValue Value::GetCustomStruct() && {
2602
0
  ABSL_DCHECK(IsCustomStruct()) << *this;
2603
0
  return std::move(variant_).Get<CustomStructValue>();
2604
0
}
2605
2606
730k
const StringValue& Value::GetString() const& {
2607
1.46M
  ABSL_DCHECK(IsString()) << *this;
2608
730k
  return variant_.Get<StringValue>();
2609
730k
}
2610
2611
0
StringValue Value::GetString() && {
2612
0
  ABSL_DCHECK(IsString()) << *this;
2613
0
  return std::move(variant_).Get<StringValue>();
2614
0
}
2615
2616
195k
StructValue Value::GetStruct() const& {
2617
390k
  ABSL_DCHECK(IsStruct()) << *this;
2618
195k
  if (const auto* alternative =
2619
195k
          variant_.As<common_internal::LegacyStructValue>();
2620
195k
      alternative != nullptr) {
2621
195k
    return *alternative;
2622
195k
  }
2623
0
  if (const auto* alternative = variant_.As<CustomStructValue>();
2624
0
      alternative != nullptr) {
2625
0
    return *alternative;
2626
0
  }
2627
0
  if (const auto* alternative = variant_.As<ParsedMessageValue>();
2628
0
      alternative != nullptr) {
2629
0
    return *alternative;
2630
0
  }
2631
0
  CEL_VALUE_THROW_BAD_VARIANT_ACCESS();
2632
0
}
2633
2634
0
StructValue Value::GetStruct() && {
2635
0
  ABSL_DCHECK(IsStruct()) << *this;
2636
0
  if (auto* alternative = variant_.As<common_internal::LegacyStructValue>();
2637
0
      alternative != nullptr) {
2638
0
    return std::move(*alternative);
2639
0
  }
2640
0
  if (auto* alternative = variant_.As<CustomStructValue>();
2641
0
      alternative != nullptr) {
2642
0
    return std::move(*alternative);
2643
0
  }
2644
0
  if (auto* alternative = variant_.As<ParsedMessageValue>();
2645
0
      alternative != nullptr) {
2646
0
    return std::move(*alternative);
2647
0
  }
2648
0
  CEL_VALUE_THROW_BAD_VARIANT_ACCESS();
2649
0
}
2650
2651
3.60k
TimestampValue Value::GetTimestamp() const {
2652
7.21k
  ABSL_DCHECK(IsTimestamp()) << *this;
2653
3.60k
  return variant_.Get<TimestampValue>();
2654
3.60k
}
2655
2656
17.8k
const TypeValue& Value::GetType() const& {
2657
35.6k
  ABSL_DCHECK(IsType()) << *this;
2658
17.8k
  return variant_.Get<TypeValue>();
2659
17.8k
}
2660
2661
0
TypeValue Value::GetType() && {
2662
0
  ABSL_DCHECK(IsType()) << *this;
2663
0
  return std::move(variant_).Get<TypeValue>();
2664
0
}
2665
2666
146k
UintValue Value::GetUint() const {
2667
293k
  ABSL_DCHECK(IsUint()) << *this;
2668
146k
  return variant_.Get<UintValue>();
2669
146k
}
2670
2671
0
const UnknownValue& Value::GetUnknown() const& {
2672
0
  ABSL_DCHECK(IsUnknown()) << *this;
2673
0
  return variant_.Get<UnknownValue>();
2674
0
}
2675
2676
0
UnknownValue Value::GetUnknown() && {
2677
0
  ABSL_DCHECK(IsUnknown()) << *this;
2678
0
  return std::move(variant_).Get<UnknownValue>();
2679
0
}
2680
2681
namespace {
2682
2683
class EmptyValueIterator final : public ValueIterator {
2684
 public:
2685
2.13k
  bool HasNext() override { return false; }
2686
2687
  absl::Status Next(const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
2688
                    google::protobuf::MessageFactory* absl_nonnull message_factory,
2689
                    google::protobuf::Arena* absl_nonnull arena,
2690
0
                    Value* absl_nonnull result) override {
2691
0
    ABSL_DCHECK(descriptor_pool != nullptr);
2692
0
    ABSL_DCHECK(message_factory != nullptr);
2693
0
    ABSL_DCHECK(arena != nullptr);
2694
0
    ABSL_DCHECK(result != nullptr);
2695
2696
0
    return absl::FailedPreconditionError(
2697
0
        "`ValueIterator::Next` called after `ValueIterator::HasNext` returned "
2698
0
        "false");
2699
0
  }
2700
2701
  absl::StatusOr<bool> Next1(
2702
      const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
2703
      google::protobuf::MessageFactory* absl_nonnull message_factory,
2704
      google::protobuf::Arena* absl_nonnull arena,
2705
369
      Value* absl_nonnull key_or_value) override {
2706
369
    ABSL_DCHECK(descriptor_pool != nullptr);
2707
369
    ABSL_DCHECK(message_factory != nullptr);
2708
369
    ABSL_DCHECK(arena != nullptr);
2709
369
    ABSL_DCHECK(key_or_value != nullptr);
2710
2711
369
    return false;
2712
369
  }
2713
2714
  absl::StatusOr<bool> Next2(
2715
      const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
2716
      google::protobuf::MessageFactory* absl_nonnull message_factory,
2717
      google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull key,
2718
0
      Value* absl_nullable value) override {
2719
0
    ABSL_DCHECK(descriptor_pool != nullptr);
2720
0
    ABSL_DCHECK(message_factory != nullptr);
2721
0
    ABSL_DCHECK(arena != nullptr);
2722
0
    ABSL_DCHECK(key != nullptr);
2723
2724
0
    return false;
2725
0
  }
2726
};
2727
2728
}  // namespace
2729
2730
20.3k
absl_nonnull std::unique_ptr<ValueIterator> NewEmptyValueIterator() {
2731
20.3k
  return std::make_unique<EmptyValueIterator>();
2732
20.3k
}
2733
2734
absl_nonnull ListValueBuilderPtr
2735
190k
NewListValueBuilder(google::protobuf::Arena* absl_nonnull arena) {
2736
190k
  ABSL_DCHECK(arena != nullptr);
2737
190k
  return common_internal::NewListValueBuilder(arena);
2738
190k
}
2739
2740
absl_nonnull MapValueBuilderPtr
2741
0
NewMapValueBuilder(google::protobuf::Arena* absl_nonnull arena) {
2742
0
  ABSL_DCHECK(arena != nullptr);
2743
0
  return common_internal::NewMapValueBuilder(arena);
2744
0
}
2745
2746
absl_nullable StructValueBuilderPtr NewStructValueBuilder(
2747
    google::protobuf::Arena* absl_nonnull arena,
2748
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
2749
    google::protobuf::MessageFactory* absl_nonnull message_factory,
2750
0
    absl::string_view name) {
2751
0
  ABSL_DCHECK(arena != nullptr);
2752
0
  ABSL_DCHECK(descriptor_pool != nullptr);
2753
0
  ABSL_DCHECK(message_factory != nullptr);
2754
0
  return common_internal::NewStructValueBuilder(arena, descriptor_pool,
2755
0
                                                message_factory, name);
2756
0
}
2757
2758
0
bool operator==(IntValue lhs, UintValue rhs) {
2759
0
  return internal::Number::FromInt64(lhs.NativeValue()) ==
2760
0
         internal::Number::FromUint64(rhs.NativeValue());
2761
0
}
2762
2763
0
bool operator==(UintValue lhs, IntValue rhs) {
2764
0
  return internal::Number::FromUint64(lhs.NativeValue()) ==
2765
0
         internal::Number::FromInt64(rhs.NativeValue());
2766
0
}
2767
2768
0
bool operator==(IntValue lhs, DoubleValue rhs) {
2769
0
  return internal::Number::FromInt64(lhs.NativeValue()) ==
2770
0
         internal::Number::FromDouble(rhs.NativeValue());
2771
0
}
2772
2773
0
bool operator==(DoubleValue lhs, IntValue rhs) {
2774
0
  return internal::Number::FromDouble(lhs.NativeValue()) ==
2775
0
         internal::Number::FromInt64(rhs.NativeValue());
2776
0
}
2777
2778
0
bool operator==(UintValue lhs, DoubleValue rhs) {
2779
0
  return internal::Number::FromUint64(lhs.NativeValue()) ==
2780
0
         internal::Number::FromDouble(rhs.NativeValue());
2781
0
}
2782
2783
0
bool operator==(DoubleValue lhs, UintValue rhs) {
2784
0
  return internal::Number::FromDouble(lhs.NativeValue()) ==
2785
0
         internal::Number::FromUint64(rhs.NativeValue());
2786
0
}
2787
2788
absl::StatusOr<bool> ValueIterator::Next1(
2789
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
2790
    google::protobuf::MessageFactory* absl_nonnull message_factory,
2791
0
    google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull value) {
2792
0
  ABSL_DCHECK(descriptor_pool != nullptr);
2793
0
  ABSL_DCHECK(message_factory != nullptr);
2794
0
  ABSL_DCHECK(arena != nullptr);
2795
0
  ABSL_DCHECK(value != nullptr);
2796
2797
0
  if (HasNext()) {
2798
0
    CEL_RETURN_IF_ERROR(Next(descriptor_pool, message_factory, arena, value));
2799
0
    return true;
2800
0
  }
2801
0
  return false;
2802
0
}
2803
2804
}  // namespace cel