Coverage Report

Created: 2026-05-27 07:00

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