Coverage Report

Created: 2026-10-09 06:57

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/proc/self/cwd/common/value.cc
Line
Count
Source
1
// Copyright 2023 Google LLC
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
//     https://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14
15
#include "common/value.h"
16
17
#include <cstddef>
18
#include <cstdint>
19
#include <memory>
20
#include <optional>
21
#include <ostream>
22
#include <string>
23
#include <type_traits>
24
#include <utility>
25
#include <variant>
26
27
#include "google/protobuf/struct.pb.h"
28
#include "absl/base/attributes.h"
29
#include "absl/base/no_destructor.h"
30
#include "absl/base/nullability.h"
31
#include "absl/base/optimization.h"
32
#include "absl/functional/overload.h"
33
#include "absl/log/absl_check.h"
34
#include "absl/log/absl_log.h"
35
#include "absl/meta/type_traits.h"
36
#include "absl/status/status.h"
37
#include "absl/status/statusor.h"
38
#include "absl/strings/cord.h"
39
#include "absl/strings/str_cat.h"
40
#include "absl/strings/string_view.h"
41
#include "absl/time/time.h"
42
#include "absl/types/optional.h"
43
#include "absl/types/source_location.h"
44
#include "absl/types/variant.h"
45
#include "common/allocator.h"
46
#include "common/type.h"
47
#include "common/value_kind.h"
48
#include "common/values/list_value_builder.h"
49
#include "common/values/map_value_builder.h"
50
#include "common/values/struct_value_builder.h"
51
#include "common/values/values.h"
52
#include "internal/number.h"
53
#include "internal/protobuf_runtime_version.h"
54
#include "internal/status_macros.h"
55
#include "internal/utf8.h"
56
#include "internal/well_known_types.h"
57
#include "runtime/runtime_options.h"
58
#include "google/protobuf/arena.h"
59
#include "google/protobuf/descriptor.h"
60
#include "google/protobuf/message.h"
61
62
#undef GetMessage
63
64
namespace cel {
65
namespace {
66
67
google::protobuf::Arena* absl_nonnull MessageArenaOr(
68
    const google::protobuf::Message* absl_nonnull message,
69
413k
    google::protobuf::Arena* absl_nonnull or_arena) {
70
413k
  google::protobuf::Arena* absl_nullable arena = message->GetArena();
71
413k
  if (arena == nullptr) {
72
0
    arena = or_arena;
73
0
  }
74
413k
  return arena;
75
413k
}
76
77
}  // namespace
78
79
4.00k
Type Value::GetRuntimeType() const {
80
4.00k
  switch (kind()) {
81
0
    case ValueKind::kNull:
82
0
      return NullType();
83
229
    case ValueKind::kBool:
84
229
      return BoolType();
85
264
    case ValueKind::kInt:
86
264
      return IntType();
87
212
    case ValueKind::kUint:
88
212
      return UintType();
89
205
    case ValueKind::kDouble:
90
205
      return DoubleType();
91
522
    case ValueKind::kString:
92
522
      return StringType();
93
334
    case ValueKind::kBytes:
94
334
      return BytesType();
95
2
    case ValueKind::kStruct:
96
2
      return this->GetStruct().GetRuntimeType();
97
528
    case ValueKind::kDuration:
98
528
      return DurationType();
99
0
    case ValueKind::kTimestamp:
100
0
      return TimestampType();
101
1.29k
    case ValueKind::kList:
102
1.29k
      return ListType();
103
204
    case ValueKind::kMap:
104
204
      return MapType();
105
0
    case ValueKind::kUnknown:
106
0
      return UnknownType();
107
212
    case ValueKind::kType:
108
212
      return TypeType();
109
0
    case ValueKind::kError:
110
0
      return ErrorType();
111
0
    case ValueKind::kOpaque:
112
0
      return this->GetOpaque().GetRuntimeType();
113
0
    default:
114
0
      return cel::Type();
115
4.00k
  }
116
4.00k
}
117
118
namespace {
119
120
template <typename T>
121
struct IsMonostate : std::is_same<absl::remove_cvref_t<T>, std::monostate> {};
122
123
}  // namespace
124
125
29.5k
absl::string_view Value::GetTypeName() const {
126
29.5k
  return variant_.Visit([](const auto& alternative) -> absl::string_view {
127
29.5k
    return alternative.GetTypeName();
128
29.5k
  });
Unexecuted instantiation: value.cc:std::__1::basic_string_view<char, std::__1::char_traits<char> > cel::Value::GetTypeName() const::$_0::operator()<cel::NullValue>(cel::NullValue const&) const
value.cc:std::__1::basic_string_view<char, std::__1::char_traits<char> > cel::Value::GetTypeName() const::$_0::operator()<cel::BoolValue>(cel::BoolValue const&) const
Line
Count
Source
126
872
  return variant_.Visit([](const auto& alternative) -> absl::string_view {
127
872
    return alternative.GetTypeName();
128
872
  });
value.cc:std::__1::basic_string_view<char, std::__1::char_traits<char> > cel::Value::GetTypeName() const::$_0::operator()<cel::IntValue>(cel::IntValue const&) const
Line
Count
Source
126
327
  return variant_.Visit([](const auto& alternative) -> absl::string_view {
127
327
    return alternative.GetTypeName();
128
327
  });
value.cc:std::__1::basic_string_view<char, std::__1::char_traits<char> > cel::Value::GetTypeName() const::$_0::operator()<cel::UintValue>(cel::UintValue const&) const
Line
Count
Source
126
3.62k
  return variant_.Visit([](const auto& alternative) -> absl::string_view {
127
3.62k
    return alternative.GetTypeName();
128
3.62k
  });
value.cc:std::__1::basic_string_view<char, std::__1::char_traits<char> > cel::Value::GetTypeName() const::$_0::operator()<cel::DoubleValue>(cel::DoubleValue const&) const
Line
Count
Source
126
197
  return variant_.Visit([](const auto& alternative) -> absl::string_view {
127
197
    return alternative.GetTypeName();
128
197
  });
Unexecuted instantiation: value.cc:std::__1::basic_string_view<char, std::__1::char_traits<char> > cel::Value::GetTypeName() const::$_0::operator()<cel::DurationValue>(cel::DurationValue const&) const
Unexecuted instantiation: value.cc:std::__1::basic_string_view<char, std::__1::char_traits<char> > cel::Value::GetTypeName() const::$_0::operator()<cel::TimestampValue>(cel::TimestampValue const&) const
value.cc:std::__1::basic_string_view<char, std::__1::char_traits<char> > cel::Value::GetTypeName() const::$_0::operator()<cel::TypeValue>(cel::TypeValue const&) const
Line
Count
Source
126
581
  return variant_.Visit([](const auto& alternative) -> absl::string_view {
127
581
    return alternative.GetTypeName();
128
581
  });
Unexecuted instantiation: value.cc:std::__1::basic_string_view<char, std::__1::char_traits<char> > cel::Value::GetTypeName() const::$_0::operator()<cel::common_internal::LegacyListValue>(cel::common_internal::LegacyListValue const&) const
Unexecuted instantiation: value.cc:std::__1::basic_string_view<char, std::__1::char_traits<char> > cel::Value::GetTypeName() const::$_0::operator()<cel::ParsedJsonListValue>(cel::ParsedJsonListValue const&) const
Unexecuted instantiation: value.cc:std::__1::basic_string_view<char, std::__1::char_traits<char> > cel::Value::GetTypeName() const::$_0::operator()<cel::ParsedRepeatedFieldValue>(cel::ParsedRepeatedFieldValue const&) const
value.cc:std::__1::basic_string_view<char, std::__1::char_traits<char> > cel::Value::GetTypeName() const::$_0::operator()<cel::CustomListValue>(cel::CustomListValue const&) const
Line
Count
Source
126
23.7k
  return variant_.Visit([](const auto& alternative) -> absl::string_view {
127
23.7k
    return alternative.GetTypeName();
128
23.7k
  });
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
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
Line
Count
Source
126
196
  return variant_.Visit([](const auto& alternative) -> absl::string_view {
127
196
    return alternative.GetTypeName();
128
196
  });
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
129
29.5k
}
130
131
332k
std::string Value::DebugString() const {
132
332k
  return variant_.Visit([](const auto& alternative) -> std::string {
133
332k
    return alternative.DebugString();
134
332k
  });
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
132
491
  return variant_.Visit([](const auto& alternative) -> std::string {
133
491
    return alternative.DebugString();
134
491
  });
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
132
254k
  return variant_.Visit([](const auto& alternative) -> std::string {
133
254k
    return alternative.DebugString();
134
254k
  });
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
132
465
  return variant_.Visit([](const auto& alternative) -> std::string {
133
465
    return alternative.DebugString();
134
465
  });
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
132
29.9k
  return variant_.Visit([](const auto& alternative) -> std::string {
133
29.9k
    return alternative.DebugString();
134
29.9k
  });
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
132
47.0k
  return variant_.Visit([](const auto& alternative) -> std::string {
133
47.0k
    return alternative.DebugString();
134
47.0k
  });
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
135
332k
}
136
137
absl::Status Value::SerializeTo(
138
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
139
    google::protobuf::MessageFactory* absl_nonnull message_factory,
140
0
    google::protobuf::io::ZeroCopyOutputStream* absl_nonnull output) const {
141
0
  ABSL_DCHECK(descriptor_pool != nullptr);
142
0
  ABSL_DCHECK(message_factory != nullptr);
143
0
  ABSL_DCHECK(output != nullptr);
144
145
0
  return variant_.Visit([&](const auto& alternative) -> absl::Status {
146
0
    return alternative.SerializeTo(descriptor_pool, message_factory, output);
147
0
  });
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::SerializeTo(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::io::ZeroCopyOutputStream*) const::$_0::operator()<cel::NullValue>(cel::NullValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::SerializeTo(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::io::ZeroCopyOutputStream*) const::$_0::operator()<cel::BoolValue>(cel::BoolValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::SerializeTo(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::io::ZeroCopyOutputStream*) const::$_0::operator()<cel::IntValue>(cel::IntValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::SerializeTo(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::io::ZeroCopyOutputStream*) const::$_0::operator()<cel::UintValue>(cel::UintValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::SerializeTo(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::io::ZeroCopyOutputStream*) const::$_0::operator()<cel::DoubleValue>(cel::DoubleValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::SerializeTo(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::io::ZeroCopyOutputStream*) const::$_0::operator()<cel::DurationValue>(cel::DurationValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::SerializeTo(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::io::ZeroCopyOutputStream*) const::$_0::operator()<cel::TimestampValue>(cel::TimestampValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::SerializeTo(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::io::ZeroCopyOutputStream*) const::$_0::operator()<cel::TypeValue>(cel::TypeValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::SerializeTo(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::io::ZeroCopyOutputStream*) const::$_0::operator()<cel::common_internal::LegacyListValue>(cel::common_internal::LegacyListValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::SerializeTo(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::io::ZeroCopyOutputStream*) const::$_0::operator()<cel::ParsedJsonListValue>(cel::ParsedJsonListValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::SerializeTo(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::io::ZeroCopyOutputStream*) const::$_0::operator()<cel::ParsedRepeatedFieldValue>(cel::ParsedRepeatedFieldValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::SerializeTo(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::io::ZeroCopyOutputStream*) const::$_0::operator()<cel::CustomListValue>(cel::CustomListValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::SerializeTo(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::io::ZeroCopyOutputStream*) const::$_0::operator()<cel::common_internal::LegacyMapValue>(cel::common_internal::LegacyMapValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::SerializeTo(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::io::ZeroCopyOutputStream*) const::$_0::operator()<cel::ParsedJsonMapValue>(cel::ParsedJsonMapValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::SerializeTo(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::io::ZeroCopyOutputStream*) const::$_0::operator()<cel::ParsedMapFieldValue>(cel::ParsedMapFieldValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::SerializeTo(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::io::ZeroCopyOutputStream*) const::$_0::operator()<cel::CustomMapValue>(cel::CustomMapValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::SerializeTo(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::io::ZeroCopyOutputStream*) const::$_0::operator()<cel::common_internal::LegacyStructValue>(cel::common_internal::LegacyStructValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::SerializeTo(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::io::ZeroCopyOutputStream*) const::$_0::operator()<cel::ParsedMessageValue>(cel::ParsedMessageValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::SerializeTo(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::io::ZeroCopyOutputStream*) const::$_0::operator()<cel::CustomStructValue>(cel::CustomStructValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::SerializeTo(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::io::ZeroCopyOutputStream*) const::$_0::operator()<cel::OpaqueValue>(cel::OpaqueValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::SerializeTo(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::io::ZeroCopyOutputStream*) const::$_0::operator()<cel::BytesValue>(cel::BytesValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::SerializeTo(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::io::ZeroCopyOutputStream*) const::$_0::operator()<cel::StringValue>(cel::StringValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::SerializeTo(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::io::ZeroCopyOutputStream*) const::$_0::operator()<cel::ErrorValue>(cel::ErrorValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::SerializeTo(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::io::ZeroCopyOutputStream*) const::$_0::operator()<cel::UnknownValue>(cel::UnknownValue const&) const
148
0
}
149
150
absl::Status Value::ConvertToJson(
151
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
152
    google::protobuf::MessageFactory* absl_nonnull message_factory,
153
5.69M
    google::protobuf::Message* absl_nonnull json) const {
154
5.69M
  ABSL_DCHECK(descriptor_pool != nullptr);
155
5.69M
  ABSL_DCHECK(message_factory != nullptr);
156
5.69M
  ABSL_DCHECK(json != nullptr);
157
5.69M
  ABSL_DCHECK_EQ(json->GetDescriptor()->well_known_type(),
158
5.69M
                 google::protobuf::Descriptor::WELLKNOWNTYPE_VALUE);
159
160
5.69M
  return variant_.Visit([descriptor_pool, message_factory,
161
5.69M
                         json](const auto& alternative) -> absl::Status {
162
5.69M
    return alternative.ConvertToJson(descriptor_pool, message_factory, json);
163
5.69M
  });
value.cc:absl::lts_20260526::Status cel::Value::ConvertToJson(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0::operator()<cel::NullValue>(cel::NullValue const&) const
Line
Count
Source
161
666
                         json](const auto& alternative) -> absl::Status {
162
666
    return alternative.ConvertToJson(descriptor_pool, message_factory, json);
163
666
  });
value.cc:absl::lts_20260526::Status cel::Value::ConvertToJson(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0::operator()<cel::BoolValue>(cel::BoolValue const&) const
Line
Count
Source
161
247k
                         json](const auto& alternative) -> absl::Status {
162
247k
    return alternative.ConvertToJson(descriptor_pool, message_factory, json);
163
247k
  });
value.cc:absl::lts_20260526::Status cel::Value::ConvertToJson(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0::operator()<cel::IntValue>(cel::IntValue const&) const
Line
Count
Source
161
5.33M
                         json](const auto& alternative) -> absl::Status {
162
5.33M
    return alternative.ConvertToJson(descriptor_pool, message_factory, json);
163
5.33M
  });
value.cc:absl::lts_20260526::Status cel::Value::ConvertToJson(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0::operator()<cel::UintValue>(cel::UintValue const&) const
Line
Count
Source
161
28.7k
                         json](const auto& alternative) -> absl::Status {
162
28.7k
    return alternative.ConvertToJson(descriptor_pool, message_factory, json);
163
28.7k
  });
value.cc:absl::lts_20260526::Status cel::Value::ConvertToJson(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0::operator()<cel::DoubleValue>(cel::DoubleValue const&) const
Line
Count
Source
161
23.6k
                         json](const auto& alternative) -> absl::Status {
162
23.6k
    return alternative.ConvertToJson(descriptor_pool, message_factory, json);
163
23.6k
  });
value.cc:absl::lts_20260526::Status cel::Value::ConvertToJson(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0::operator()<cel::DurationValue>(cel::DurationValue const&) const
Line
Count
Source
161
25.8k
                         json](const auto& alternative) -> absl::Status {
162
25.8k
    return alternative.ConvertToJson(descriptor_pool, message_factory, json);
163
25.8k
  });
value.cc:absl::lts_20260526::Status cel::Value::ConvertToJson(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0::operator()<cel::TimestampValue>(cel::TimestampValue const&) const
Line
Count
Source
161
1.84k
                         json](const auto& alternative) -> absl::Status {
162
1.84k
    return alternative.ConvertToJson(descriptor_pool, message_factory, json);
163
1.84k
  });
value.cc:absl::lts_20260526::Status cel::Value::ConvertToJson(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0::operator()<cel::TypeValue>(cel::TypeValue const&) const
Line
Count
Source
161
16
                         json](const auto& alternative) -> absl::Status {
162
16
    return alternative.ConvertToJson(descriptor_pool, message_factory, json);
163
16
  });
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJson(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0::operator()<cel::common_internal::LegacyListValue>(cel::common_internal::LegacyListValue const&) const
value.cc:absl::lts_20260526::Status cel::Value::ConvertToJson(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0::operator()<cel::ParsedJsonListValue>(cel::ParsedJsonListValue const&) const
Line
Count
Source
161
472
                         json](const auto& alternative) -> absl::Status {
162
472
    return alternative.ConvertToJson(descriptor_pool, message_factory, json);
163
472
  });
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJson(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0::operator()<cel::ParsedRepeatedFieldValue>(cel::ParsedRepeatedFieldValue const&) const
value.cc:absl::lts_20260526::Status cel::Value::ConvertToJson(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0::operator()<cel::CustomListValue>(cel::CustomListValue const&) const
Line
Count
Source
161
1.92k
                         json](const auto& alternative) -> absl::Status {
162
1.92k
    return alternative.ConvertToJson(descriptor_pool, message_factory, json);
163
1.92k
  });
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJson(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0::operator()<cel::common_internal::LegacyMapValue>(cel::common_internal::LegacyMapValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJson(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0::operator()<cel::ParsedJsonMapValue>(cel::ParsedJsonMapValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJson(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0::operator()<cel::ParsedMapFieldValue>(cel::ParsedMapFieldValue const&) const
value.cc:absl::lts_20260526::Status cel::Value::ConvertToJson(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0::operator()<cel::CustomMapValue>(cel::CustomMapValue const&) const
Line
Count
Source
161
27.6k
                         json](const auto& alternative) -> absl::Status {
162
27.6k
    return alternative.ConvertToJson(descriptor_pool, message_factory, json);
163
27.6k
  });
value.cc:absl::lts_20260526::Status cel::Value::ConvertToJson(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0::operator()<cel::common_internal::LegacyStructValue>(cel::common_internal::LegacyStructValue const&) const
Line
Count
Source
161
539
                         json](const auto& alternative) -> absl::Status {
162
539
    return alternative.ConvertToJson(descriptor_pool, message_factory, json);
163
539
  });
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJson(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0::operator()<cel::ParsedMessageValue>(cel::ParsedMessageValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJson(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0::operator()<cel::CustomStructValue>(cel::CustomStructValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJson(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0::operator()<cel::OpaqueValue>(cel::OpaqueValue const&) const
value.cc:absl::lts_20260526::Status cel::Value::ConvertToJson(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0::operator()<cel::BytesValue>(cel::BytesValue const&) const
Line
Count
Source
161
2.50k
                         json](const auto& alternative) -> absl::Status {
162
2.50k
    return alternative.ConvertToJson(descriptor_pool, message_factory, json);
163
2.50k
  });
value.cc:absl::lts_20260526::Status cel::Value::ConvertToJson(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0::operator()<cel::StringValue>(cel::StringValue const&) const
Line
Count
Source
161
2.53k
                         json](const auto& alternative) -> absl::Status {
162
2.53k
    return alternative.ConvertToJson(descriptor_pool, message_factory, json);
163
2.53k
  });
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJson(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0::operator()<cel::ErrorValue>(cel::ErrorValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJson(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_0::operator()<cel::UnknownValue>(cel::UnknownValue const&) const
164
5.69M
}
165
166
absl::Status Value::ConvertToJsonArray(
167
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
168
    google::protobuf::MessageFactory* absl_nonnull message_factory,
169
401k
    google::protobuf::Message* absl_nonnull json) const {
170
401k
  ABSL_DCHECK(descriptor_pool != nullptr);
171
401k
  ABSL_DCHECK(message_factory != nullptr);
172
401k
  ABSL_DCHECK(json != nullptr);
173
401k
  ABSL_DCHECK_EQ(json->GetDescriptor()->well_known_type(),
174
401k
                 google::protobuf::Descriptor::WELLKNOWNTYPE_LISTVALUE);
175
176
401k
  return variant_.Visit(absl::Overload(
177
401k
      [](std::monostate) -> absl::Status {
178
401k
        return absl::InternalError("use of invalid Value");
179
401k
      },
180
401k
      [descriptor_pool, message_factory, json](
181
401k
          const common_internal::LegacyListValue& alternative) -> absl::Status {
182
0
        return alternative.ConvertToJsonArray(descriptor_pool, message_factory,
183
0
                                              json);
184
0
      },
185
401k
      [descriptor_pool, message_factory,
186
401k
       json](const CustomListValue& alternative) -> absl::Status {
187
401k
        return alternative.ConvertToJsonArray(descriptor_pool, message_factory,
188
401k
                                              json);
189
401k
      },
190
401k
      [descriptor_pool, message_factory,
191
401k
       json](const ParsedRepeatedFieldValue& alternative) -> absl::Status {
192
0
        return alternative.ConvertToJsonArray(descriptor_pool, message_factory,
193
0
                                              json);
194
0
      },
195
401k
      [descriptor_pool, message_factory,
196
401k
       json](const ParsedJsonListValue& alternative) -> absl::Status {
197
0
        return alternative.ConvertToJsonArray(descriptor_pool, message_factory,
198
0
                                              json);
199
0
      },
200
401k
      [](const auto& alternative) -> absl::Status {
201
12
        return common_internal::MakeTypeConversionError(
202
12
            alternative.GetTypeName(), "google.protobuf.ListValue");
203
12
      }));
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonArray(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_5::operator()<cel::NullValue>(cel::NullValue const&) const
value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonArray(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_5::operator()<cel::BoolValue>(cel::BoolValue const&) const
Line
Count
Source
200
1
      [](const auto& alternative) -> absl::Status {
201
1
        return common_internal::MakeTypeConversionError(
202
1
            alternative.GetTypeName(), "google.protobuf.ListValue");
203
1
      }));
value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonArray(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_5::operator()<cel::IntValue>(cel::IntValue const&) const
Line
Count
Source
200
5
      [](const auto& alternative) -> absl::Status {
201
5
        return common_internal::MakeTypeConversionError(
202
5
            alternative.GetTypeName(), "google.protobuf.ListValue");
203
5
      }));
value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonArray(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_5::operator()<cel::UintValue>(cel::UintValue const&) const
Line
Count
Source
200
1
      [](const auto& alternative) -> absl::Status {
201
1
        return common_internal::MakeTypeConversionError(
202
1
            alternative.GetTypeName(), "google.protobuf.ListValue");
203
1
      }));
value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonArray(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_5::operator()<cel::DoubleValue>(cel::DoubleValue const&) const
Line
Count
Source
200
1
      [](const auto& alternative) -> absl::Status {
201
1
        return common_internal::MakeTypeConversionError(
202
1
            alternative.GetTypeName(), "google.protobuf.ListValue");
203
1
      }));
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonArray(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_5::operator()<cel::DurationValue>(cel::DurationValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonArray(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_5::operator()<cel::TimestampValue>(cel::TimestampValue const&) const
value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonArray(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_5::operator()<cel::TypeValue>(cel::TypeValue const&) const
Line
Count
Source
200
1
      [](const auto& alternative) -> absl::Status {
201
1
        return common_internal::MakeTypeConversionError(
202
1
            alternative.GetTypeName(), "google.protobuf.ListValue");
203
1
      }));
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonArray(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_5::operator()<cel::common_internal::LegacyMapValue>(cel::common_internal::LegacyMapValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonArray(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_5::operator()<cel::ParsedJsonMapValue>(cel::ParsedJsonMapValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonArray(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_5::operator()<cel::ParsedMapFieldValue>(cel::ParsedMapFieldValue const&) const
value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonArray(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_5::operator()<cel::CustomMapValue>(cel::CustomMapValue const&) const
Line
Count
Source
200
2
      [](const auto& alternative) -> absl::Status {
201
2
        return common_internal::MakeTypeConversionError(
202
2
            alternative.GetTypeName(), "google.protobuf.ListValue");
203
2
      }));
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonArray(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_5::operator()<cel::common_internal::LegacyStructValue>(cel::common_internal::LegacyStructValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonArray(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_5::operator()<cel::ParsedMessageValue>(cel::ParsedMessageValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonArray(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_5::operator()<cel::CustomStructValue>(cel::CustomStructValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonArray(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_5::operator()<cel::OpaqueValue>(cel::OpaqueValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonArray(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_5::operator()<cel::BytesValue>(cel::BytesValue const&) const
value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonArray(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_5::operator()<cel::StringValue>(cel::StringValue const&) const
Line
Count
Source
200
1
      [](const auto& alternative) -> absl::Status {
201
1
        return common_internal::MakeTypeConversionError(
202
1
            alternative.GetTypeName(), "google.protobuf.ListValue");
203
1
      }));
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonArray(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_5::operator()<cel::ErrorValue>(cel::ErrorValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonArray(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_5::operator()<cel::UnknownValue>(cel::UnknownValue const&) const
204
401k
}
205
206
absl::Status Value::ConvertToJsonObject(
207
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
208
    google::protobuf::MessageFactory* absl_nonnull message_factory,
209
0
    google::protobuf::Message* absl_nonnull json) const {
210
0
  ABSL_DCHECK(descriptor_pool != nullptr);
211
0
  ABSL_DCHECK(message_factory != nullptr);
212
0
  ABSL_DCHECK(json != nullptr);
213
0
  ABSL_DCHECK_EQ(json->GetDescriptor()->well_known_type(),
214
0
                 google::protobuf::Descriptor::WELLKNOWNTYPE_STRUCT);
215
216
0
  return variant_.Visit(absl::Overload(
217
0
      [](std::monostate) -> absl::Status {
218
0
        return absl::InternalError("use of invalid Value");
219
0
      },
220
0
      [descriptor_pool, message_factory, json](
221
0
          const common_internal::LegacyMapValue& alternative) -> absl::Status {
222
0
        return alternative.ConvertToJsonObject(descriptor_pool, message_factory,
223
0
                                               json);
224
0
      },
225
0
      [descriptor_pool, message_factory,
226
0
       json](const CustomMapValue& alternative) -> absl::Status {
227
0
        return alternative.ConvertToJsonObject(descriptor_pool, message_factory,
228
0
                                               json);
229
0
      },
230
0
      [descriptor_pool, message_factory,
231
0
       json](const ParsedMapFieldValue& alternative) -> absl::Status {
232
0
        return alternative.ConvertToJsonObject(descriptor_pool, message_factory,
233
0
                                               json);
234
0
      },
235
0
      [descriptor_pool, message_factory,
236
0
       json](const ParsedJsonMapValue& alternative) -> absl::Status {
237
0
        return alternative.ConvertToJsonObject(descriptor_pool, message_factory,
238
0
                                               json);
239
0
      },
240
0
      [descriptor_pool, message_factory,
241
0
       json](const common_internal::LegacyStructValue& alternative)
242
0
          -> absl::Status {
243
0
        return alternative.ConvertToJsonObject(descriptor_pool, message_factory,
244
0
                                               json);
245
0
      },
246
0
      [descriptor_pool, message_factory,
247
0
       json](const CustomStructValue& alternative) -> absl::Status {
248
0
        return alternative.ConvertToJsonObject(descriptor_pool, message_factory,
249
0
                                               json);
250
0
      },
251
0
      [descriptor_pool, message_factory,
252
0
       json](const ParsedMessageValue& alternative) -> absl::Status {
253
0
        return alternative.ConvertToJsonObject(descriptor_pool, message_factory,
254
0
                                               json);
255
0
      },
256
0
      [](const auto& alternative) -> absl::Status {
257
0
        return common_internal::MakeTypeConversionError(
258
0
            alternative.GetTypeName(), "google.protobuf.Struct");
259
0
      }));
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonObject(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_8::operator()<cel::NullValue>(cel::NullValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonObject(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_8::operator()<cel::BoolValue>(cel::BoolValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonObject(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_8::operator()<cel::IntValue>(cel::IntValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonObject(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_8::operator()<cel::UintValue>(cel::UintValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonObject(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_8::operator()<cel::DoubleValue>(cel::DoubleValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonObject(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_8::operator()<cel::DurationValue>(cel::DurationValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonObject(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_8::operator()<cel::TimestampValue>(cel::TimestampValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonObject(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_8::operator()<cel::TypeValue>(cel::TypeValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonObject(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_8::operator()<cel::common_internal::LegacyListValue>(cel::common_internal::LegacyListValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonObject(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_8::operator()<cel::ParsedJsonListValue>(cel::ParsedJsonListValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonObject(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_8::operator()<cel::ParsedRepeatedFieldValue>(cel::ParsedRepeatedFieldValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonObject(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_8::operator()<cel::CustomListValue>(cel::CustomListValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonObject(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_8::operator()<cel::OpaqueValue>(cel::OpaqueValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonObject(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_8::operator()<cel::BytesValue>(cel::BytesValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonObject(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_8::operator()<cel::StringValue>(cel::StringValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonObject(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_8::operator()<cel::ErrorValue>(cel::ErrorValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::ConvertToJsonObject(google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Message*) const::$_8::operator()<cel::UnknownValue>(cel::UnknownValue const&) const
260
0
}
261
262
absl::Status Value::Equal(
263
    const Value& other,
264
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
265
    google::protobuf::MessageFactory* absl_nonnull message_factory,
266
270k
    google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull result) const {
267
270k
  ABSL_DCHECK(descriptor_pool != nullptr);
268
270k
  ABSL_DCHECK(message_factory != nullptr);
269
270k
  ABSL_DCHECK(arena != nullptr);
270
270k
  ABSL_DCHECK(result != nullptr);
271
272
270k
  return variant_.Visit([&other, descriptor_pool, message_factory, arena,
273
270k
                         result](const auto& alternative) -> absl::Status {
274
270k
    return alternative.Equal(other, descriptor_pool, message_factory, arena,
275
270k
                             result);
276
270k
  });
value.cc:absl::lts_20260526::Status cel::Value::Equal(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::NullValue>(cel::NullValue const&) const
Line
Count
Source
273
256
                         result](const auto& alternative) -> absl::Status {
274
256
    return alternative.Equal(other, descriptor_pool, message_factory, arena,
275
256
                             result);
276
256
  });
value.cc:absl::lts_20260526::Status cel::Value::Equal(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::BoolValue>(cel::BoolValue const&) const
Line
Count
Source
273
2.44k
                         result](const auto& alternative) -> absl::Status {
274
2.44k
    return alternative.Equal(other, descriptor_pool, message_factory, arena,
275
2.44k
                             result);
276
2.44k
  });
value.cc:absl::lts_20260526::Status cel::Value::Equal(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::IntValue>(cel::IntValue const&) const
Line
Count
Source
273
36.9k
                         result](const auto& alternative) -> absl::Status {
274
36.9k
    return alternative.Equal(other, descriptor_pool, message_factory, arena,
275
36.9k
                             result);
276
36.9k
  });
value.cc:absl::lts_20260526::Status cel::Value::Equal(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::UintValue>(cel::UintValue const&) const
Line
Count
Source
273
175k
                         result](const auto& alternative) -> absl::Status {
274
175k
    return alternative.Equal(other, descriptor_pool, message_factory, arena,
275
175k
                             result);
276
175k
  });
value.cc:absl::lts_20260526::Status cel::Value::Equal(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::DoubleValue>(cel::DoubleValue const&) const
Line
Count
Source
273
5.26k
                         result](const auto& alternative) -> absl::Status {
274
5.26k
    return alternative.Equal(other, descriptor_pool, message_factory, arena,
275
5.26k
                             result);
276
5.26k
  });
value.cc:absl::lts_20260526::Status cel::Value::Equal(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::DurationValue>(cel::DurationValue const&) const
Line
Count
Source
273
432
                         result](const auto& alternative) -> absl::Status {
274
432
    return alternative.Equal(other, descriptor_pool, message_factory, arena,
275
432
                             result);
276
432
  });
value.cc:absl::lts_20260526::Status cel::Value::Equal(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::TimestampValue>(cel::TimestampValue const&) const
Line
Count
Source
273
18
                         result](const auto& alternative) -> absl::Status {
274
18
    return alternative.Equal(other, descriptor_pool, message_factory, arena,
275
18
                             result);
276
18
  });
value.cc:absl::lts_20260526::Status cel::Value::Equal(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::TypeValue>(cel::TypeValue const&) const
Line
Count
Source
273
346
                         result](const auto& alternative) -> absl::Status {
274
346
    return alternative.Equal(other, descriptor_pool, message_factory, arena,
275
346
                             result);
276
346
  });
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::Equal(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::common_internal::LegacyListValue>(cel::common_internal::LegacyListValue const&) const
value.cc:absl::lts_20260526::Status cel::Value::Equal(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::ParsedJsonListValue>(cel::ParsedJsonListValue const&) const
Line
Count
Source
273
2.17k
                         result](const auto& alternative) -> absl::Status {
274
2.17k
    return alternative.Equal(other, descriptor_pool, message_factory, arena,
275
2.17k
                             result);
276
2.17k
  });
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::Equal(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::ParsedRepeatedFieldValue>(cel::ParsedRepeatedFieldValue const&) const
value.cc:absl::lts_20260526::Status cel::Value::Equal(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::CustomListValue>(cel::CustomListValue const&) const
Line
Count
Source
273
2.49k
                         result](const auto& alternative) -> absl::Status {
274
2.49k
    return alternative.Equal(other, descriptor_pool, message_factory, arena,
275
2.49k
                             result);
276
2.49k
  });
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::Equal(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::common_internal::LegacyMapValue>(cel::common_internal::LegacyMapValue const&) const
value.cc:absl::lts_20260526::Status cel::Value::Equal(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::ParsedJsonMapValue>(cel::ParsedJsonMapValue const&) const
Line
Count
Source
273
511
                         result](const auto& alternative) -> absl::Status {
274
511
    return alternative.Equal(other, descriptor_pool, message_factory, arena,
275
511
                             result);
276
511
  });
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::Equal(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::ParsedMapFieldValue>(cel::ParsedMapFieldValue const&) const
value.cc:absl::lts_20260526::Status cel::Value::Equal(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::CustomMapValue>(cel::CustomMapValue const&) const
Line
Count
Source
273
11.3k
                         result](const auto& alternative) -> absl::Status {
274
11.3k
    return alternative.Equal(other, descriptor_pool, message_factory, arena,
275
11.3k
                             result);
276
11.3k
  });
value.cc:absl::lts_20260526::Status cel::Value::Equal(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::common_internal::LegacyStructValue>(cel::common_internal::LegacyStructValue const&) const
Line
Count
Source
273
28.7k
                         result](const auto& alternative) -> absl::Status {
274
28.7k
    return alternative.Equal(other, descriptor_pool, message_factory, arena,
275
28.7k
                             result);
276
28.7k
  });
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::Equal(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::ParsedMessageValue>(cel::ParsedMessageValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::Equal(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::CustomStructValue>(cel::CustomStructValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::Equal(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::OpaqueValue>(cel::OpaqueValue const&) const
value.cc:absl::lts_20260526::Status cel::Value::Equal(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::BytesValue>(cel::BytesValue const&) const
Line
Count
Source
273
1.13k
                         result](const auto& alternative) -> absl::Status {
274
1.13k
    return alternative.Equal(other, descriptor_pool, message_factory, arena,
275
1.13k
                             result);
276
1.13k
  });
value.cc:absl::lts_20260526::Status cel::Value::Equal(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::StringValue>(cel::StringValue const&) const
Line
Count
Source
273
2.89k
                         result](const auto& alternative) -> absl::Status {
274
2.89k
    return alternative.Equal(other, descriptor_pool, message_factory, arena,
275
2.89k
                             result);
276
2.89k
  });
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::Equal(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::ErrorValue>(cel::ErrorValue const&) const
Unexecuted instantiation: value.cc:absl::lts_20260526::Status cel::Value::Equal(cel::Value const&, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*, cel::Value*) const::$_0::operator()<cel::UnknownValue>(cel::UnknownValue const&) const
277
270k
}
278
279
0
bool Value::IsZeroValue() const {
280
0
  return variant_.Visit([](const auto& alternative) -> bool {
281
0
    return alternative.IsZeroValue();
282
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
283
0
}
284
285
namespace {
286
287
template <typename, typename = void>
288
struct HasCloneMethod : std::false_type {};
289
290
template <typename T>
291
struct HasCloneMethod<T, std::void_t<decltype(std::declval<const T>().Clone(
292
                             std::declval<google::protobuf::Arena* absl_nonnull>()))>>
293
    : std::true_type {};
294
295
}  // namespace
296
297
0
Value Value::Clone(google::protobuf::Arena* absl_nonnull arena) const {
298
0
  return variant_.Visit([arena](const auto& alternative) -> Value {
299
    if constexpr (IsMonostate<decltype(alternative)>::value) {
300
      return Value();
301
    } else if constexpr (HasCloneMethod<absl::remove_cvref_t<
302
0
                             decltype(alternative)>>::value) {
303
0
      return alternative.Clone(arena);
304
0
    } else {
305
0
      return alternative;
306
0
    }
307
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
308
0
}
309
310
0
std::ostream& operator<<(std::ostream& out, const Value& value) {
311
0
  return value.variant_.Visit([&out](const auto& alternative) -> std::ostream& {
312
0
    return out << alternative;
313
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
314
0
}
315
316
namespace {
317
318
0
Value NonNullEnumValue(const google::protobuf::EnumValueDescriptor* absl_nonnull value) {
319
0
  ABSL_DCHECK(value != nullptr);
320
0
  return IntValue(value->number());
321
0
}
322
323
Value NonNullEnumValue(const google::protobuf::EnumDescriptor* absl_nonnull type,
324
0
                       int32_t number, google::protobuf::Arena* absl_nullable arena) {
325
0
  ABSL_DCHECK(type != nullptr);
326
0
  if (type->is_closed()) {
327
0
    if (ABSL_PREDICT_FALSE(type->FindValueByNumber(number) == nullptr)) {
328
0
      if (arena == nullptr) {
329
0
        static const absl::NoDestructor<absl::Status> error(
330
0
            absl::InvalidArgumentError("closed enum has no such value",
331
0
                                       absl::SourceLocation()));
332
0
        return ErrorValue::WrapUnsafe(&*error);
333
0
      }
334
0
      return ErrorValue::From(absl::InvalidArgumentError(absl::StrCat(
335
0
                                  "closed enum has no such value: ",
336
0
                                  type->full_name(), ".", number)),
337
0
                              arena);
338
0
    }
339
0
  }
340
0
  return IntValue(number);
341
0
}
342
343
}  // namespace
344
345
0
Value Value::Enum(const google::protobuf::EnumValueDescriptor* absl_nonnull value) {
346
0
  ABSL_DCHECK(value != nullptr);
347
0
  if (value->type()->full_name() == "google.protobuf.NullValue") {
348
0
    ABSL_DCHECK_EQ(value->number(), 0);
349
0
    return NullValue();
350
0
  }
351
0
  return NonNullEnumValue(value);
352
0
}
353
354
Value Value::Enum(const google::protobuf::EnumDescriptor* absl_nonnull type,
355
                  int32_t number) {
356
  ABSL_DCHECK(type != nullptr);
357
  if (type->full_name() == "google.protobuf.NullValue") {
358
    ABSL_DCHECK_EQ(number, 0);
359
    return NullValue();
360
  }
361
  return NonNullEnumValue(type, number, nullptr);
362
}
363
364
Value Value::Enum(const google::protobuf::EnumDescriptor* absl_nonnull type,
365
                  int32_t number, google::protobuf::Arena* absl_nonnull arena) {
366
  ABSL_DCHECK(type != nullptr);
367
  ABSL_DCHECK(arena != nullptr);
368
  if (type->full_name() == "google.protobuf.NullValue") {
369
    ABSL_DCHECK_EQ(number, 0);
370
    return NullValue();
371
  }
372
  return NonNullEnumValue(type, number, arena);
373
}
374
375
namespace common_internal {
376
377
namespace {
378
379
void BoolMapFieldKeyAccessor(const google::protobuf::MapKey& key,
380
                             const google::protobuf::Message* absl_nonnull message,
381
                             google::protobuf::Arena* absl_nonnull arena,
382
0
                             Value* absl_nonnull result) {
383
0
  ABSL_DCHECK(message != nullptr);
384
0
  ABSL_DCHECK(arena != nullptr);
385
0
  ABSL_DCHECK(result != nullptr);
386
387
0
  *result = BoolValue(key.GetBoolValue());
388
0
}
389
390
void Int32MapFieldKeyAccessor(const google::protobuf::MapKey& key,
391
                              const google::protobuf::Message* absl_nonnull message,
392
                              google::protobuf::Arena* absl_nonnull arena,
393
0
                              Value* absl_nonnull result) {
394
0
  ABSL_DCHECK(message != nullptr);
395
0
  ABSL_DCHECK(arena != nullptr);
396
0
  ABSL_DCHECK(result != nullptr);
397
398
0
  *result = IntValue(key.GetInt32Value());
399
0
}
400
401
void Int64MapFieldKeyAccessor(const google::protobuf::MapKey& key,
402
                              const google::protobuf::Message* absl_nonnull message,
403
                              google::protobuf::Arena* absl_nonnull arena,
404
0
                              Value* absl_nonnull result) {
405
0
  ABSL_DCHECK(message != nullptr);
406
0
  ABSL_DCHECK(arena != nullptr);
407
0
  ABSL_DCHECK(result != nullptr);
408
409
0
  *result = IntValue(key.GetInt64Value());
410
0
}
411
412
void UInt32MapFieldKeyAccessor(const google::protobuf::MapKey& key,
413
                               const google::protobuf::Message* absl_nonnull message,
414
                               google::protobuf::Arena* absl_nonnull arena,
415
0
                               Value* absl_nonnull result) {
416
0
  ABSL_DCHECK(message != nullptr);
417
0
  ABSL_DCHECK(arena != nullptr);
418
0
  ABSL_DCHECK(result != nullptr);
419
420
0
  *result = UintValue(key.GetUInt32Value());
421
0
}
422
423
void UInt64MapFieldKeyAccessor(const google::protobuf::MapKey& key,
424
                               const google::protobuf::Message* absl_nonnull message,
425
                               google::protobuf::Arena* absl_nonnull arena,
426
0
                               Value* absl_nonnull result) {
427
0
  ABSL_DCHECK(message != nullptr);
428
0
  ABSL_DCHECK(arena != nullptr);
429
0
  ABSL_DCHECK(result != nullptr);
430
431
0
  *result = UintValue(key.GetUInt64Value());
432
0
}
433
434
void StringMapFieldKeyAccessor(const google::protobuf::MapKey& key,
435
                               const google::protobuf::Message* absl_nonnull message,
436
                               google::protobuf::Arena* absl_nonnull arena,
437
0
                               Value* absl_nonnull result) {
438
0
  ABSL_DCHECK(message != nullptr);
439
0
  ABSL_DCHECK(arena != nullptr);
440
0
  ABSL_DCHECK(result != nullptr);
441
442
0
#if CEL_INTERNAL_PROTOBUF_OSS_VERSION_PREREQ(5, 30, 0)
443
0
  if (google::protobuf::Arena* message_arena = message->GetArena();
444
0
      message_arena != nullptr) {
445
0
    *result = StringValue::Wrap(key.GetStringValue(), message_arena);
446
0
  } else {
447
0
    *result = StringValue::From(key.GetStringValue(), arena);
448
0
  }
449
#else
450
  *result = StringValue::From(key.GetStringValue(), arena);
451
#endif
452
0
}
453
454
}  // namespace
455
456
absl::StatusOr<MapFieldKeyAccessor> MapFieldKeyAccessorFor(
457
0
    const google::protobuf::FieldDescriptor* absl_nonnull field) {
458
0
  switch (field->cpp_type()) {
459
0
    case google::protobuf::FieldDescriptor::CPPTYPE_BOOL:
460
0
      return &BoolMapFieldKeyAccessor;
461
0
    case google::protobuf::FieldDescriptor::CPPTYPE_INT32:
462
0
      return &Int32MapFieldKeyAccessor;
463
0
    case google::protobuf::FieldDescriptor::CPPTYPE_INT64:
464
0
      return &Int64MapFieldKeyAccessor;
465
0
    case google::protobuf::FieldDescriptor::CPPTYPE_UINT32:
466
0
      return &UInt32MapFieldKeyAccessor;
467
0
    case google::protobuf::FieldDescriptor::CPPTYPE_UINT64:
468
0
      return &UInt64MapFieldKeyAccessor;
469
0
    case google::protobuf::FieldDescriptor::CPPTYPE_STRING:
470
0
      return &StringMapFieldKeyAccessor;
471
0
    default:
472
0
      return absl::InvalidArgumentError(
473
0
          absl::StrCat("unexpected map key type: ", field->cpp_type_name()));
474
0
  }
475
0
}
476
477
namespace {
478
479
void DoubleMapFieldValueAccessor(
480
    const google::protobuf::MapValueConstRef& value,
481
    const google::protobuf::Message* absl_nonnull message,
482
    const google::protobuf::FieldDescriptor* absl_nonnull field,
483
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
484
    google::protobuf::MessageFactory* absl_nonnull message_factory,
485
0
    google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull result) {
486
0
  ABSL_DCHECK(message != nullptr);
487
0
  ABSL_DCHECK(field != nullptr);
488
0
  ABSL_DCHECK(descriptor_pool != nullptr);
489
0
  ABSL_DCHECK(message_factory != nullptr);
490
0
  ABSL_DCHECK(arena != nullptr);
491
0
  ABSL_DCHECK(result != nullptr);
492
0
  ABSL_DCHECK(!field->is_repeated());
493
0
  ABSL_DCHECK_EQ(field->cpp_type(), google::protobuf::FieldDescriptor::CPPTYPE_DOUBLE);
494
495
0
  *result = DoubleValue(value.GetDoubleValue());
496
0
}
497
498
void FloatMapFieldValueAccessor(
499
    const google::protobuf::MapValueConstRef& value,
500
    const google::protobuf::Message* absl_nonnull message,
501
    const google::protobuf::FieldDescriptor* absl_nonnull field,
502
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
503
    google::protobuf::MessageFactory* absl_nonnull message_factory,
504
0
    google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull result) {
505
0
  ABSL_DCHECK(message != nullptr);
506
0
  ABSL_DCHECK(field != nullptr);
507
0
  ABSL_DCHECK(descriptor_pool != nullptr);
508
0
  ABSL_DCHECK(message_factory != nullptr);
509
0
  ABSL_DCHECK(arena != nullptr);
510
0
  ABSL_DCHECK(result != nullptr);
511
0
  ABSL_DCHECK(!field->is_repeated());
512
0
  ABSL_DCHECK_EQ(field->cpp_type(), google::protobuf::FieldDescriptor::CPPTYPE_FLOAT);
513
514
0
  *result = DoubleValue(value.GetFloatValue());
515
0
}
516
517
void Int64MapFieldValueAccessor(
518
    const google::protobuf::MapValueConstRef& value,
519
    const google::protobuf::Message* absl_nonnull message,
520
    const google::protobuf::FieldDescriptor* absl_nonnull field,
521
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
522
    google::protobuf::MessageFactory* absl_nonnull message_factory,
523
0
    google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull result) {
524
0
  ABSL_DCHECK(message != nullptr);
525
0
  ABSL_DCHECK(field != nullptr);
526
0
  ABSL_DCHECK(descriptor_pool != nullptr);
527
0
  ABSL_DCHECK(message_factory != nullptr);
528
0
  ABSL_DCHECK(arena != nullptr);
529
0
  ABSL_DCHECK(result != nullptr);
530
0
  ABSL_DCHECK(!field->is_repeated());
531
0
  ABSL_DCHECK_EQ(field->cpp_type(), google::protobuf::FieldDescriptor::CPPTYPE_INT64);
532
533
0
  *result = IntValue(value.GetInt64Value());
534
0
}
535
536
void UInt64MapFieldValueAccessor(
537
    const google::protobuf::MapValueConstRef& value,
538
    const google::protobuf::Message* absl_nonnull message,
539
    const google::protobuf::FieldDescriptor* absl_nonnull field,
540
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
541
    google::protobuf::MessageFactory* absl_nonnull message_factory,
542
0
    google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull result) {
543
0
  ABSL_DCHECK(message != nullptr);
544
0
  ABSL_DCHECK(field != nullptr);
545
0
  ABSL_DCHECK(descriptor_pool != nullptr);
546
0
  ABSL_DCHECK(message_factory != nullptr);
547
0
  ABSL_DCHECK(arena != nullptr);
548
0
  ABSL_DCHECK(result != nullptr);
549
0
  ABSL_DCHECK(!field->is_repeated());
550
0
  ABSL_DCHECK_EQ(field->cpp_type(), google::protobuf::FieldDescriptor::CPPTYPE_UINT64);
551
552
0
  *result = UintValue(value.GetUInt64Value());
553
0
}
554
555
void Int32MapFieldValueAccessor(
556
    const google::protobuf::MapValueConstRef& value,
557
    const google::protobuf::Message* absl_nonnull message,
558
    const google::protobuf::FieldDescriptor* absl_nonnull field,
559
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
560
    google::protobuf::MessageFactory* absl_nonnull message_factory,
561
0
    google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull result) {
562
0
  ABSL_DCHECK(message != nullptr);
563
0
  ABSL_DCHECK(field != nullptr);
564
0
  ABSL_DCHECK(descriptor_pool != nullptr);
565
0
  ABSL_DCHECK(message_factory != nullptr);
566
0
  ABSL_DCHECK(arena != nullptr);
567
0
  ABSL_DCHECK(result != nullptr);
568
0
  ABSL_DCHECK(!field->is_repeated());
569
0
  ABSL_DCHECK_EQ(field->cpp_type(), google::protobuf::FieldDescriptor::CPPTYPE_INT32);
570
571
0
  *result = IntValue(value.GetInt32Value());
572
0
}
573
574
void UInt32MapFieldValueAccessor(
575
    const google::protobuf::MapValueConstRef& value,
576
    const google::protobuf::Message* absl_nonnull message,
577
    const google::protobuf::FieldDescriptor* absl_nonnull field,
578
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
579
    google::protobuf::MessageFactory* absl_nonnull message_factory,
580
0
    google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull result) {
581
0
  ABSL_DCHECK(message != nullptr);
582
0
  ABSL_DCHECK(field != nullptr);
583
0
  ABSL_DCHECK(descriptor_pool != nullptr);
584
0
  ABSL_DCHECK(message_factory != nullptr);
585
0
  ABSL_DCHECK(arena != nullptr);
586
0
  ABSL_DCHECK(result != nullptr);
587
0
  ABSL_DCHECK(!field->is_repeated());
588
0
  ABSL_DCHECK_EQ(field->cpp_type(), google::protobuf::FieldDescriptor::CPPTYPE_UINT32);
589
590
0
  *result = UintValue(value.GetUInt32Value());
591
0
}
592
593
void BoolMapFieldValueAccessor(
594
    const google::protobuf::MapValueConstRef& value,
595
    const google::protobuf::Message* absl_nonnull message,
596
    const google::protobuf::FieldDescriptor* absl_nonnull field,
597
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
598
    google::protobuf::MessageFactory* absl_nonnull message_factory,
599
0
    google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull result) {
600
0
  ABSL_DCHECK(message != nullptr);
601
0
  ABSL_DCHECK(field != nullptr);
602
0
  ABSL_DCHECK(descriptor_pool != nullptr);
603
0
  ABSL_DCHECK(message_factory != nullptr);
604
0
  ABSL_DCHECK(arena != nullptr);
605
0
  ABSL_DCHECK(result != nullptr);
606
0
  ABSL_DCHECK(!field->is_repeated());
607
0
  ABSL_DCHECK_EQ(field->cpp_type(), google::protobuf::FieldDescriptor::CPPTYPE_BOOL);
608
609
0
  *result = BoolValue(value.GetBoolValue());
610
0
}
611
612
void StringMapFieldValueAccessor(
613
    const google::protobuf::MapValueConstRef& value,
614
    const google::protobuf::Message* absl_nonnull message,
615
    const google::protobuf::FieldDescriptor* absl_nonnull field,
616
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
617
    google::protobuf::MessageFactory* absl_nonnull message_factory,
618
0
    google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull result) {
619
0
  ABSL_DCHECK(message != nullptr);
620
0
  ABSL_DCHECK(field != nullptr);
621
0
  ABSL_DCHECK(descriptor_pool != nullptr);
622
0
  ABSL_DCHECK(message_factory != nullptr);
623
0
  ABSL_DCHECK(arena != nullptr);
624
0
  ABSL_DCHECK(result != nullptr);
625
0
  ABSL_DCHECK(!field->is_repeated());
626
0
  ABSL_DCHECK_EQ(field->type(), google::protobuf::FieldDescriptor::TYPE_STRING);
627
628
0
  if (message->GetArena() == nullptr) {
629
0
    *result = StringValue::From(value.GetStringValue(), arena);
630
0
  } else {
631
0
    *result = StringValue::Wrap(value.GetStringValue(), message->GetArena());
632
0
  }
633
0
}
634
635
void MessageMapFieldValueAccessor(
636
    const google::protobuf::MapValueConstRef& value,
637
    const google::protobuf::Message* absl_nonnull message,
638
    const google::protobuf::FieldDescriptor* absl_nonnull field,
639
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
640
    google::protobuf::MessageFactory* absl_nonnull message_factory,
641
0
    google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull result) {
642
0
  ABSL_DCHECK(message != nullptr);
643
0
  ABSL_DCHECK(field != nullptr);
644
0
  ABSL_DCHECK(descriptor_pool != nullptr);
645
0
  ABSL_DCHECK(message_factory != nullptr);
646
0
  ABSL_DCHECK(arena != nullptr);
647
0
  ABSL_DCHECK(result != nullptr);
648
0
  ABSL_DCHECK(!field->is_repeated());
649
0
  ABSL_DCHECK_EQ(field->cpp_type(), google::protobuf::FieldDescriptor::CPPTYPE_MESSAGE);
650
651
0
  *result = Value::WrapMessage(&value.GetMessageValue(), descriptor_pool,
652
0
                               message_factory, arena);
653
0
}
654
655
void BytesMapFieldValueAccessor(
656
    const google::protobuf::MapValueConstRef& value,
657
    const google::protobuf::Message* absl_nonnull message,
658
    const google::protobuf::FieldDescriptor* absl_nonnull field,
659
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
660
    google::protobuf::MessageFactory* absl_nonnull message_factory,
661
0
    google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull result) {
662
0
  ABSL_DCHECK(message != nullptr);
663
0
  ABSL_DCHECK(field != nullptr);
664
0
  ABSL_DCHECK(descriptor_pool != nullptr);
665
0
  ABSL_DCHECK(message_factory != nullptr);
666
0
  ABSL_DCHECK(arena != nullptr);
667
0
  ABSL_DCHECK(result != nullptr);
668
0
  ABSL_DCHECK(!field->is_repeated());
669
0
  ABSL_DCHECK_EQ(field->type(), google::protobuf::FieldDescriptor::TYPE_BYTES);
670
671
0
  if (message->GetArena() == nullptr) {
672
0
    *result = BytesValue::From(value.GetStringValue(), arena);
673
0
  } else {
674
0
    *result = BytesValue::Wrap(value.GetStringValue(), message->GetArena());
675
0
  }
676
0
}
677
678
void EnumMapFieldValueAccessor(
679
    const google::protobuf::MapValueConstRef& value,
680
    const google::protobuf::Message* absl_nonnull message,
681
    const google::protobuf::FieldDescriptor* absl_nonnull field,
682
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
683
    google::protobuf::MessageFactory* absl_nonnull message_factory,
684
0
    google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull result) {
685
0
  ABSL_DCHECK(message != nullptr);
686
0
  ABSL_DCHECK(field != nullptr);
687
0
  ABSL_DCHECK(descriptor_pool != nullptr);
688
0
  ABSL_DCHECK(message_factory != nullptr);
689
0
  ABSL_DCHECK(arena != nullptr);
690
0
  ABSL_DCHECK(result != nullptr);
691
0
  ABSL_DCHECK(!field->is_repeated());
692
0
  ABSL_DCHECK_EQ(field->cpp_type(), google::protobuf::FieldDescriptor::CPPTYPE_ENUM);
693
694
0
  *result = NonNullEnumValue(field->enum_type(), value.GetEnumValue(), arena);
695
0
}
696
697
void NullMapFieldValueAccessor(
698
    const google::protobuf::MapValueConstRef& value,
699
    const google::protobuf::Message* absl_nonnull message,
700
    const google::protobuf::FieldDescriptor* absl_nonnull field,
701
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
702
    google::protobuf::MessageFactory* absl_nonnull message_factory,
703
0
    google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull result) {
704
0
  ABSL_DCHECK(message != nullptr);
705
0
  ABSL_DCHECK(field != nullptr);
706
0
  ABSL_DCHECK(descriptor_pool != nullptr);
707
0
  ABSL_DCHECK(message_factory != nullptr);
708
0
  ABSL_DCHECK(arena != nullptr);
709
0
  ABSL_DCHECK(result != nullptr);
710
0
  ABSL_DCHECK(!field->is_repeated());
711
0
  ABSL_DCHECK(field->cpp_type() == google::protobuf::FieldDescriptor::CPPTYPE_ENUM &&
712
0
              field->enum_type()->full_name() == "google.protobuf.NullValue");
713
714
0
  *result = NullValue();
715
0
}
716
717
}  // namespace
718
719
absl::StatusOr<MapFieldValueAccessor> MapFieldValueAccessorFor(
720
0
    const google::protobuf::FieldDescriptor* absl_nonnull field) {
721
0
  switch (field->type()) {
722
0
    case google::protobuf::FieldDescriptor::TYPE_DOUBLE:
723
0
      return &DoubleMapFieldValueAccessor;
724
0
    case google::protobuf::FieldDescriptor::TYPE_FLOAT:
725
0
      return &FloatMapFieldValueAccessor;
726
0
    case google::protobuf::FieldDescriptor::TYPE_SFIXED64:
727
0
      ABSL_FALLTHROUGH_INTENDED;
728
0
    case google::protobuf::FieldDescriptor::TYPE_SINT64:
729
0
      ABSL_FALLTHROUGH_INTENDED;
730
0
    case google::protobuf::FieldDescriptor::TYPE_INT64:
731
0
      return &Int64MapFieldValueAccessor;
732
0
    case google::protobuf::FieldDescriptor::TYPE_FIXED64:
733
0
      ABSL_FALLTHROUGH_INTENDED;
734
0
    case google::protobuf::FieldDescriptor::TYPE_UINT64:
735
0
      return &UInt64MapFieldValueAccessor;
736
0
    case google::protobuf::FieldDescriptor::TYPE_SFIXED32:
737
0
      ABSL_FALLTHROUGH_INTENDED;
738
0
    case google::protobuf::FieldDescriptor::TYPE_SINT32:
739
0
      ABSL_FALLTHROUGH_INTENDED;
740
0
    case google::protobuf::FieldDescriptor::TYPE_INT32:
741
0
      return &Int32MapFieldValueAccessor;
742
0
    case google::protobuf::FieldDescriptor::TYPE_BOOL:
743
0
      return &BoolMapFieldValueAccessor;
744
0
    case google::protobuf::FieldDescriptor::TYPE_STRING:
745
0
      return &StringMapFieldValueAccessor;
746
0
    case google::protobuf::FieldDescriptor::TYPE_GROUP:
747
0
      ABSL_FALLTHROUGH_INTENDED;
748
0
    case google::protobuf::FieldDescriptor::TYPE_MESSAGE:
749
0
      return &MessageMapFieldValueAccessor;
750
0
    case google::protobuf::FieldDescriptor::TYPE_BYTES:
751
0
      return &BytesMapFieldValueAccessor;
752
0
    case google::protobuf::FieldDescriptor::TYPE_FIXED32:
753
0
      ABSL_FALLTHROUGH_INTENDED;
754
0
    case google::protobuf::FieldDescriptor::TYPE_UINT32:
755
0
      return &UInt32MapFieldValueAccessor;
756
0
    case google::protobuf::FieldDescriptor::TYPE_ENUM:
757
0
      if (field->enum_type()->full_name() == "google.protobuf.NullValue") {
758
0
        return &NullMapFieldValueAccessor;
759
0
      }
760
0
      return &EnumMapFieldValueAccessor;
761
0
    default:
762
0
      return absl::InvalidArgumentError(
763
0
          absl::StrCat("unexpected protocol buffer message field type: ",
764
0
                       field->type_name()));
765
0
  }
766
0
}
767
768
namespace {
769
770
void DoubleRepeatedFieldAccessor(
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_DOUBLE);
788
0
  ABSL_DCHECK_GE(index, 0);
789
0
  ABSL_DCHECK_LT(index, reflection->FieldSize(*message, field));
790
791
0
  *result = DoubleValue(reflection->GetRepeatedDouble(*message, field, index));
792
0
}
793
794
void FloatRepeatedFieldAccessor(
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_FLOAT);
812
0
  ABSL_DCHECK_GE(index, 0);
813
0
  ABSL_DCHECK_LT(index, reflection->FieldSize(*message, field));
814
815
0
  *result = DoubleValue(reflection->GetRepeatedFloat(*message, field, index));
816
0
}
817
818
void Int64RepeatedFieldAccessor(
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_INT64);
836
0
  ABSL_DCHECK_GE(index, 0);
837
0
  ABSL_DCHECK_LT(index, reflection->FieldSize(*message, field));
838
839
0
  *result = IntValue(reflection->GetRepeatedInt64(*message, field, index));
840
0
}
841
842
void UInt64RepeatedFieldAccessor(
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_UINT64);
860
0
  ABSL_DCHECK_GE(index, 0);
861
0
  ABSL_DCHECK_LT(index, reflection->FieldSize(*message, field));
862
863
0
  *result = UintValue(reflection->GetRepeatedUInt64(*message, field, index));
864
0
}
865
866
void Int32RepeatedFieldAccessor(
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_INT32);
884
0
  ABSL_DCHECK_GE(index, 0);
885
0
  ABSL_DCHECK_LT(index, reflection->FieldSize(*message, field));
886
887
0
  *result = IntValue(reflection->GetRepeatedInt32(*message, field, index));
888
0
}
889
890
void UInt32RepeatedFieldAccessor(
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_UINT32);
908
0
  ABSL_DCHECK_GE(index, 0);
909
0
  ABSL_DCHECK_LT(index, reflection->FieldSize(*message, field));
910
911
0
  *result = UintValue(reflection->GetRepeatedUInt32(*message, field, index));
912
0
}
913
914
void BoolRepeatedFieldAccessor(
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->cpp_type(), google::protobuf::FieldDescriptor::CPPTYPE_BOOL);
932
0
  ABSL_DCHECK_GE(index, 0);
933
0
  ABSL_DCHECK_LT(index, reflection->FieldSize(*message, field));
934
935
0
  *result = BoolValue(reflection->GetRepeatedBool(*message, field, index));
936
0
}
937
938
void StringRepeatedFieldAccessor(
939
    int index, const google::protobuf::Message* absl_nonnull message,
940
    const google::protobuf::FieldDescriptor* absl_nonnull field,
941
    const google::protobuf::Reflection* absl_nonnull reflection,
942
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
943
    google::protobuf::MessageFactory* absl_nonnull message_factory,
944
0
    google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull result) {
945
0
  ABSL_DCHECK(message != nullptr);
946
0
  ABSL_DCHECK(field != nullptr);
947
0
  ABSL_DCHECK(message_factory != nullptr);
948
0
  ABSL_DCHECK(descriptor_pool != nullptr);
949
0
  ABSL_DCHECK(reflection != nullptr);
950
0
  ABSL_DCHECK(arena != nullptr);
951
0
  ABSL_DCHECK(result != nullptr);
952
0
  ABSL_DCHECK_EQ(reflection, message->GetReflection());
953
0
  ABSL_DCHECK_EQ(field->containing_type(), message->GetDescriptor());
954
0
  ABSL_DCHECK(field->is_repeated());
955
0
  ABSL_DCHECK_EQ(field->type(), google::protobuf::FieldDescriptor::TYPE_STRING);
956
0
  ABSL_DCHECK_GE(index, 0);
957
0
  ABSL_DCHECK_LT(index, reflection->FieldSize(*message, field));
958
959
0
  std::string scratch;
960
0
  absl::visit(
961
0
      absl::Overload(
962
0
          [&](absl::string_view string) {
963
0
            if (string.data() == scratch.data() &&
964
0
                string.size() == scratch.size()) {
965
0
              *result = StringValue::From(std::move(scratch), arena);
966
0
            } else {
967
0
              if (message->GetArena() == nullptr) {
968
0
                *result = StringValue::From(string, arena);
969
0
              } else {
970
0
                *result = StringValue::Wrap(string, message->GetArena());
971
0
              }
972
0
            }
973
0
          },
974
0
          [&](absl::Cord&& cord) {
975
0
            *result = StringValue::From(std::move(cord), arena);
976
0
          }),
977
0
      well_known_types::AsVariant(well_known_types::GetRepeatedStringField(
978
0
          *message, field, index, scratch)));
979
0
}
980
981
void MessageRepeatedFieldAccessor(
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->cpp_type(), google::protobuf::FieldDescriptor::CPPTYPE_MESSAGE);
999
0
  ABSL_DCHECK_GE(index, 0);
1000
0
  ABSL_DCHECK_LT(index, reflection->FieldSize(*message, field));
1001
1002
0
  *result = Value::WrapMessage(
1003
0
      &reflection->GetRepeatedMessage(*message, field, index), descriptor_pool,
1004
0
      message_factory, arena);
1005
0
}
1006
1007
void BytesRepeatedFieldAccessor(
1008
    int index, const google::protobuf::Message* absl_nonnull message,
1009
    const google::protobuf::FieldDescriptor* absl_nonnull field,
1010
    const google::protobuf::Reflection* absl_nonnull reflection,
1011
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
1012
    google::protobuf::MessageFactory* absl_nonnull message_factory,
1013
0
    google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull result) {
1014
0
  ABSL_DCHECK(message != nullptr);
1015
0
  ABSL_DCHECK(field != nullptr);
1016
0
  ABSL_DCHECK(message_factory != nullptr);
1017
0
  ABSL_DCHECK(descriptor_pool != nullptr);
1018
0
  ABSL_DCHECK(reflection != nullptr);
1019
0
  ABSL_DCHECK(arena != nullptr);
1020
0
  ABSL_DCHECK(result != nullptr);
1021
0
  ABSL_DCHECK_EQ(reflection, message->GetReflection());
1022
0
  ABSL_DCHECK_EQ(field->containing_type(), message->GetDescriptor());
1023
0
  ABSL_DCHECK(field->is_repeated());
1024
0
  ABSL_DCHECK_EQ(field->type(), google::protobuf::FieldDescriptor::TYPE_BYTES);
1025
0
  ABSL_DCHECK_GE(index, 0);
1026
0
  ABSL_DCHECK_LT(index, reflection->FieldSize(*message, field));
1027
1028
0
  std::string scratch;
1029
0
  absl::visit(
1030
0
      absl::Overload(
1031
0
          [&](absl::string_view string) {
1032
0
            if (string.data() == scratch.data() &&
1033
0
                string.size() == scratch.size()) {
1034
0
              *result = BytesValue::From(std::move(scratch), arena);
1035
0
            } else {
1036
0
              if (message->GetArena() == nullptr) {
1037
0
                *result = BytesValue::From(string, arena);
1038
0
              } else {
1039
0
                *result = BytesValue::Wrap(string, message->GetArena());
1040
0
              }
1041
0
            }
1042
0
          },
1043
0
          [&](absl::Cord&& cord) {
1044
0
            *result = BytesValue::From(std::move(cord), arena);
1045
0
          }),
1046
0
      well_known_types::AsVariant(well_known_types::GetRepeatedBytesField(
1047
0
          *message, field, index, scratch)));
1048
0
}
1049
1050
void EnumRepeatedFieldAccessor(
1051
    int index, const google::protobuf::Message* absl_nonnull message,
1052
    const google::protobuf::FieldDescriptor* absl_nonnull field,
1053
    const google::protobuf::Reflection* absl_nonnull reflection,
1054
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
1055
    google::protobuf::MessageFactory* absl_nonnull message_factory,
1056
0
    google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull result) {
1057
0
  ABSL_DCHECK(message != nullptr);
1058
0
  ABSL_DCHECK(field != nullptr);
1059
0
  ABSL_DCHECK(message_factory != nullptr);
1060
0
  ABSL_DCHECK(descriptor_pool != nullptr);
1061
0
  ABSL_DCHECK(reflection != nullptr);
1062
0
  ABSL_DCHECK(arena != nullptr);
1063
0
  ABSL_DCHECK(result != nullptr);
1064
0
  ABSL_DCHECK_EQ(reflection, message->GetReflection());
1065
0
  ABSL_DCHECK_EQ(field->containing_type(), message->GetDescriptor());
1066
0
  ABSL_DCHECK(field->is_repeated());
1067
0
  ABSL_DCHECK_EQ(field->cpp_type(), google::protobuf::FieldDescriptor::CPPTYPE_ENUM);
1068
0
  ABSL_DCHECK_GE(index, 0);
1069
0
  ABSL_DCHECK_LT(index, reflection->FieldSize(*message, field));
1070
1071
0
  *result = NonNullEnumValue(
1072
0
      field->enum_type(),
1073
0
      reflection->GetRepeatedEnumValue(*message, field, index), arena);
1074
0
}
1075
1076
void NullRepeatedFieldAccessor(
1077
    int index, const google::protobuf::Message* absl_nonnull message,
1078
    const google::protobuf::FieldDescriptor* absl_nonnull field,
1079
    const google::protobuf::Reflection* absl_nonnull reflection,
1080
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
1081
    google::protobuf::MessageFactory* absl_nonnull message_factory,
1082
0
    google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull result) {
1083
0
  ABSL_DCHECK(message != nullptr);
1084
0
  ABSL_DCHECK(field != nullptr);
1085
0
  ABSL_DCHECK(message_factory != nullptr);
1086
0
  ABSL_DCHECK(descriptor_pool != nullptr);
1087
0
  ABSL_DCHECK(reflection != nullptr);
1088
0
  ABSL_DCHECK(arena != nullptr);
1089
0
  ABSL_DCHECK(result != nullptr);
1090
0
  ABSL_DCHECK_EQ(reflection, message->GetReflection());
1091
0
  ABSL_DCHECK_EQ(field->containing_type(), message->GetDescriptor());
1092
0
  ABSL_DCHECK(field->is_repeated());
1093
0
  ABSL_DCHECK(field->cpp_type() == google::protobuf::FieldDescriptor::CPPTYPE_ENUM &&
1094
0
              field->enum_type()->full_name() == "google.protobuf.NullValue");
1095
0
  ABSL_DCHECK_GE(index, 0);
1096
0
  ABSL_DCHECK_LT(index, reflection->FieldSize(*message, field));
1097
1098
0
  *result = NullValue();
1099
0
}
1100
1101
}  // namespace
1102
1103
absl::StatusOr<RepeatedFieldAccessor> RepeatedFieldAccessorFor(
1104
0
    const google::protobuf::FieldDescriptor* absl_nonnull field) {
1105
0
  switch (field->type()) {
1106
0
    case google::protobuf::FieldDescriptor::TYPE_DOUBLE:
1107
0
      return &DoubleRepeatedFieldAccessor;
1108
0
    case google::protobuf::FieldDescriptor::TYPE_FLOAT:
1109
0
      return &FloatRepeatedFieldAccessor;
1110
0
    case google::protobuf::FieldDescriptor::TYPE_SFIXED64:
1111
0
      ABSL_FALLTHROUGH_INTENDED;
1112
0
    case google::protobuf::FieldDescriptor::TYPE_SINT64:
1113
0
      ABSL_FALLTHROUGH_INTENDED;
1114
0
    case google::protobuf::FieldDescriptor::TYPE_INT64:
1115
0
      return &Int64RepeatedFieldAccessor;
1116
0
    case google::protobuf::FieldDescriptor::TYPE_FIXED64:
1117
0
      ABSL_FALLTHROUGH_INTENDED;
1118
0
    case google::protobuf::FieldDescriptor::TYPE_UINT64:
1119
0
      return &UInt64RepeatedFieldAccessor;
1120
0
    case google::protobuf::FieldDescriptor::TYPE_SFIXED32:
1121
0
      ABSL_FALLTHROUGH_INTENDED;
1122
0
    case google::protobuf::FieldDescriptor::TYPE_SINT32:
1123
0
      ABSL_FALLTHROUGH_INTENDED;
1124
0
    case google::protobuf::FieldDescriptor::TYPE_INT32:
1125
0
      return &Int32RepeatedFieldAccessor;
1126
0
    case google::protobuf::FieldDescriptor::TYPE_BOOL:
1127
0
      return &BoolRepeatedFieldAccessor;
1128
0
    case google::protobuf::FieldDescriptor::TYPE_STRING:
1129
0
      return &StringRepeatedFieldAccessor;
1130
0
    case google::protobuf::FieldDescriptor::TYPE_GROUP:
1131
0
      ABSL_FALLTHROUGH_INTENDED;
1132
0
    case google::protobuf::FieldDescriptor::TYPE_MESSAGE:
1133
0
      return &MessageRepeatedFieldAccessor;
1134
0
    case google::protobuf::FieldDescriptor::TYPE_BYTES:
1135
0
      return &BytesRepeatedFieldAccessor;
1136
0
    case google::protobuf::FieldDescriptor::TYPE_FIXED32:
1137
0
      ABSL_FALLTHROUGH_INTENDED;
1138
0
    case google::protobuf::FieldDescriptor::TYPE_UINT32:
1139
0
      return &UInt32RepeatedFieldAccessor;
1140
0
    case google::protobuf::FieldDescriptor::TYPE_ENUM:
1141
0
      if (field->enum_type()->full_name() == "google.protobuf.NullValue") {
1142
0
        return &NullRepeatedFieldAccessor;
1143
0
      }
1144
0
      return &EnumRepeatedFieldAccessor;
1145
0
    default:
1146
0
      return absl::InvalidArgumentError(
1147
0
          absl::StrCat("unexpected protocol buffer message field type: ",
1148
0
                       field->type_name()));
1149
0
  }
1150
0
}
1151
1152
}  // namespace common_internal
1153
1154
namespace {
1155
1156
// Overloads for `well_known_types::Value` which handles the primitive values
1157
// which require no special handling based on allocators.
1158
547
Value VistWellKnownTypeValue(std::nullptr_t) { return NullValue(); }
1159
1160
584
Value VistWellKnownTypeValue(bool value) { return BoolValue(value); }
1161
1162
364
Value VistWellKnownTypeValue(int32_t value) { return IntValue(value); }
1163
1164
1.03k
Value VistWellKnownTypeValue(int64_t value) { return IntValue(value); }
1165
1166
528
Value VistWellKnownTypeValue(uint32_t value) { return UintValue(value); }
1167
1168
533
Value VistWellKnownTypeValue(uint64_t value) { return UintValue(value); }
1169
1170
250
Value VistWellKnownTypeValue(float value) { return DoubleValue(value); }
1171
1172
292
Value VistWellKnownTypeValue(double value) { return DoubleValue(value); }
1173
1174
703
Value VistWellKnownTypeValue(absl::Duration value) {
1175
  // Tolerate out-of-range values.
1176
703
  return UnsafeDurationValue(value);
1177
703
}
1178
1179
6.02k
Value VistWellKnownTypeValue(absl::Time value) {
1180
6.02k
  return UnsafeTimestampValue(value);
1181
6.02k
}
1182
1183
struct OwningWellKnownTypesValueVisitor {
1184
  google::protobuf::Arena* absl_nullable arena;
1185
  std::string* absl_nonnull scratch;
1186
1187
0
  Value operator()(well_known_types::BytesValue&& value) const {
1188
0
    return absl::visit(absl::Overload(
1189
0
                           [&](absl::string_view string) -> BytesValue {
1190
0
                             if (string.empty()) {
1191
0
                               return BytesValue();
1192
0
                             }
1193
0
                             if (scratch->data() == string.data() &&
1194
0
                                 scratch->size() == string.size()) {
1195
0
                               return BytesValue::From(std::move(*scratch),
1196
0
                                                       arena);
1197
0
                             }
1198
0
                             return BytesValue::From(string, arena);
1199
0
                           },
1200
0
                           [&](absl::Cord&& cord) -> BytesValue {
1201
0
                             if (cord.empty()) {
1202
0
                               return BytesValue();
1203
0
                             }
1204
0
                             return BytesValue::From(cord, arena);
1205
0
                           }),
1206
0
                       well_known_types::AsVariant(std::move(value)));
1207
0
  }
1208
1209
0
  Value operator()(well_known_types::StringValue&& value) const {
1210
0
    return absl::visit(absl::Overload(
1211
0
                           [&](absl::string_view string) -> StringValue {
1212
0
                             if (string.empty()) {
1213
0
                               return StringValue();
1214
0
                             }
1215
0
                             if (scratch->data() == string.data() &&
1216
0
                                 scratch->size() == string.size()) {
1217
0
                               return StringValue::From(std::move(*scratch),
1218
0
                                                        arena);
1219
0
                             }
1220
0
                             return StringValue::From(string, arena);
1221
0
                           },
1222
0
                           [&](absl::Cord&& cord) -> StringValue {
1223
0
                             if (cord.empty()) {
1224
0
                               return StringValue();
1225
0
                             }
1226
0
                             return StringValue::From(cord, arena);
1227
0
                           }),
1228
0
                       well_known_types::AsVariant(std::move(value)));
1229
0
  }
1230
1231
0
  Value operator()(well_known_types::ListValue&& value) const {
1232
0
    return absl::visit(
1233
0
        absl::Overload(
1234
0
            [&](well_known_types::ListValueConstRef value) -> ListValue {
1235
0
              auto* cloned = value.get().New(arena);
1236
0
              cloned->CopyFrom(value.get());
1237
0
              return ParsedJsonListValue(cloned, arena);
1238
0
            },
1239
0
            [&](well_known_types::ListValuePtr value) -> ListValue {
1240
0
              if (value->GetArena() != arena) {
1241
0
                auto* cloned = value->New(arena);
1242
0
                cloned->CopyFrom(*value);
1243
0
                return ParsedJsonListValue(cloned, arena);
1244
0
              }
1245
0
              return ParsedJsonListValue(value.try_as_arena_ptr()->get(),
1246
0
                                         arena);
1247
0
            }),
1248
0
        well_known_types::AsVariant(std::move(value)));
1249
0
  }
1250
1251
0
  Value operator()(well_known_types::Struct&& value) const {
1252
0
    return absl::visit(
1253
0
        absl::Overload(
1254
0
            [&](well_known_types::StructConstRef value) -> MapValue {
1255
0
              auto* cloned = value.get().New(arena);
1256
0
              cloned->CopyFrom(value.get());
1257
0
              return ParsedJsonMapValue(cloned, arena);
1258
0
            },
1259
0
            [&](well_known_types::StructPtr value) -> MapValue {
1260
0
              if (value.GetOwningArena() != arena) {
1261
0
                auto* cloned = value->New(arena);
1262
0
                cloned->CopyFrom(*value);
1263
0
                return ParsedJsonMapValue(cloned, arena);
1264
0
              }
1265
0
              return ParsedJsonMapValue(value.try_as_arena_ptr()->get(), arena);
1266
0
            }),
1267
0
        well_known_types::AsVariant(std::move(value)));
1268
0
  }
1269
1270
0
  Value operator()(google::protobuf::Arena::UniquePtr<google::protobuf::Message> value) const {
1271
0
    if (value->GetArena() != arena) {
1272
0
      auto* cloned = value->New(arena);
1273
0
      cloned->CopyFrom(*value);
1274
0
      return ParsedMessageValue(cloned, arena);
1275
0
    }
1276
0
    return ParsedMessageValue(value.try_as_arena_ptr()->get(), arena);
1277
0
  }
1278
1279
  template <typename T>
1280
0
  Value operator()(T t) const {
1281
0
    return VistWellKnownTypeValue(t);
1282
0
  }
Unexecuted instantiation: value.cc:cel::Value cel::(anonymous namespace)::OwningWellKnownTypesValueVisitor::operator()<decltype(nullptr)>(decltype(nullptr)) const
Unexecuted instantiation: value.cc:cel::Value cel::(anonymous namespace)::OwningWellKnownTypesValueVisitor::operator()<bool>(bool) const
Unexecuted instantiation: value.cc:cel::Value cel::(anonymous namespace)::OwningWellKnownTypesValueVisitor::operator()<int>(int) const
Unexecuted instantiation: value.cc:cel::Value cel::(anonymous namespace)::OwningWellKnownTypesValueVisitor::operator()<long>(long) const
Unexecuted instantiation: value.cc:cel::Value cel::(anonymous namespace)::OwningWellKnownTypesValueVisitor::operator()<unsigned int>(unsigned int) const
Unexecuted instantiation: value.cc:cel::Value cel::(anonymous namespace)::OwningWellKnownTypesValueVisitor::operator()<unsigned long>(unsigned long) const
Unexecuted instantiation: value.cc:cel::Value cel::(anonymous namespace)::OwningWellKnownTypesValueVisitor::operator()<float>(float) const
Unexecuted instantiation: value.cc:cel::Value cel::(anonymous namespace)::OwningWellKnownTypesValueVisitor::operator()<double>(double) const
Unexecuted instantiation: value.cc:cel::Value cel::(anonymous namespace)::OwningWellKnownTypesValueVisitor::operator()<absl::lts_20260526::Duration>(absl::lts_20260526::Duration) const
Unexecuted instantiation: value.cc:cel::Value cel::(anonymous namespace)::OwningWellKnownTypesValueVisitor::operator()<absl::lts_20260526::Time>(absl::lts_20260526::Time) const
1283
};
1284
1285
struct BorrowingWellKnownTypesValueVisitor {
1286
  const google::protobuf::Message* absl_nonnull message;
1287
  google::protobuf::Arena* absl_nonnull arena;
1288
  std::string* absl_nonnull scratch;
1289
1290
24.3k
  Value operator()(well_known_types::BytesValue&& value) const {
1291
24.3k
    return absl::visit(
1292
24.3k
        absl::Overload(
1293
24.3k
            [&](absl::string_view string) -> BytesValue {
1294
24.3k
              if (string.data() == scratch->data() &&
1295
0
                  string.size() == scratch->size()) {
1296
0
                return BytesValue::From(std::move(*scratch), arena);
1297
24.3k
              } else {
1298
24.3k
                if (google::protobuf::Arena* message_arena = message->GetArena();
1299
24.3k
                    message_arena != nullptr) {
1300
24.3k
                  return BytesValue::Wrap(string, message_arena);
1301
24.3k
                }
1302
0
                return BytesValue::From(string, arena);
1303
24.3k
              }
1304
24.3k
            },
1305
24.3k
            [&](absl::Cord&& cord) -> BytesValue {
1306
0
              return BytesValue::From(std::move(cord), arena);
1307
0
            }),
1308
24.3k
        well_known_types::AsVariant(std::move(value)));
1309
24.3k
  }
1310
1311
197
  Value operator()(well_known_types::StringValue&& value) const {
1312
197
    return absl::visit(
1313
197
        absl::Overload(
1314
197
            [&](absl::string_view string) -> StringValue {
1315
197
              if (string.data() == scratch->data() &&
1316
0
                  string.size() == scratch->size()) {
1317
0
                return StringValue::From(std::move(*scratch), arena);
1318
197
              } else {
1319
197
                if (google::protobuf::Arena* message_arena = message->GetArena();
1320
197
                    message_arena != nullptr) {
1321
197
                  return StringValue::Wrap(string, message_arena);
1322
197
                }
1323
0
                return StringValue::From(string, arena);
1324
197
              }
1325
197
            },
1326
197
            [&](absl::Cord&& cord) -> StringValue {
1327
0
              return StringValue::From(std::move(cord), arena);
1328
0
            }),
1329
197
        well_known_types::AsVariant(std::move(value)));
1330
197
  }
1331
1332
403k
  Value operator()(well_known_types::ListValue&& value) const {
1333
403k
    return absl::visit(
1334
403k
        absl::Overload(
1335
403k
            [&](well_known_types::ListValueConstRef value)
1336
403k
                -> ParsedJsonListValue {
1337
403k
              return ParsedJsonListValue(&value.get(),
1338
403k
                                         MessageArenaOr(&value.get(), arena));
1339
403k
            },
1340
403k
            [&](well_known_types::ListValuePtr value) -> ParsedJsonListValue {
1341
0
              if (value->GetArena() != arena) {
1342
0
                auto* cloned = value->New(arena);
1343
0
                cloned->CopyFrom(*value);
1344
0
                return ParsedJsonListValue(cloned, arena);
1345
0
              }
1346
0
              return ParsedJsonListValue(value.try_as_arena_ptr()->get(),
1347
0
                                         arena);
1348
0
            }),
1349
403k
        well_known_types::AsVariant(std::move(value)));
1350
403k
  }
1351
1352
10.1k
  Value operator()(well_known_types::Struct&& value) const {
1353
10.1k
    return absl::visit(
1354
10.1k
        absl::Overload(
1355
10.1k
            [&](well_known_types::StructConstRef value) -> ParsedJsonMapValue {
1356
10.1k
              return ParsedJsonMapValue(&value.get(),
1357
10.1k
                                        MessageArenaOr(&value.get(), arena));
1358
10.1k
            },
1359
10.1k
            [&](well_known_types::StructPtr value) -> ParsedJsonMapValue {
1360
0
              if (value->GetArena() != arena) {
1361
0
                auto* cloned = value->New(arena);
1362
0
                cloned->CopyFrom(*value);
1363
0
                return ParsedJsonMapValue(cloned, arena);
1364
0
              }
1365
0
              return ParsedJsonMapValue(value.try_as_arena_ptr()->get(), arena);
1366
0
            }),
1367
10.1k
        well_known_types::AsVariant(std::move(value)));
1368
10.1k
  }
1369
1370
0
  Value operator()(google::protobuf::Arena::UniquePtr<google::protobuf::Message>&& value) const {
1371
0
    if (value->GetArena() != arena) {
1372
0
      auto* cloned = value->New(arena);
1373
0
      cloned->CopyFrom(*value);
1374
0
      return ParsedMessageValue(cloned, arena);
1375
0
    }
1376
0
    return ParsedMessageValue(value.try_as_arena_ptr()->get(), arena);
1377
0
  }
1378
1379
  template <typename T>
1380
10.8k
  Value operator()(T t) const {
1381
10.8k
    return VistWellKnownTypeValue(t);
1382
10.8k
  }
value.cc:cel::Value cel::(anonymous namespace)::BorrowingWellKnownTypesValueVisitor::operator()<decltype(nullptr)>(decltype(nullptr)) const
Line
Count
Source
1380
547
  Value operator()(T t) const {
1381
547
    return VistWellKnownTypeValue(t);
1382
547
  }
value.cc:cel::Value cel::(anonymous namespace)::BorrowingWellKnownTypesValueVisitor::operator()<bool>(bool) const
Line
Count
Source
1380
584
  Value operator()(T t) const {
1381
584
    return VistWellKnownTypeValue(t);
1382
584
  }
value.cc:cel::Value cel::(anonymous namespace)::BorrowingWellKnownTypesValueVisitor::operator()<int>(int) const
Line
Count
Source
1380
364
  Value operator()(T t) const {
1381
364
    return VistWellKnownTypeValue(t);
1382
364
  }
value.cc:cel::Value cel::(anonymous namespace)::BorrowingWellKnownTypesValueVisitor::operator()<long>(long) const
Line
Count
Source
1380
1.03k
  Value operator()(T t) const {
1381
1.03k
    return VistWellKnownTypeValue(t);
1382
1.03k
  }
value.cc:cel::Value cel::(anonymous namespace)::BorrowingWellKnownTypesValueVisitor::operator()<unsigned int>(unsigned int) const
Line
Count
Source
1380
528
  Value operator()(T t) const {
1381
528
    return VistWellKnownTypeValue(t);
1382
528
  }
value.cc:cel::Value cel::(anonymous namespace)::BorrowingWellKnownTypesValueVisitor::operator()<unsigned long>(unsigned long) const
Line
Count
Source
1380
533
  Value operator()(T t) const {
1381
533
    return VistWellKnownTypeValue(t);
1382
533
  }
value.cc:cel::Value cel::(anonymous namespace)::BorrowingWellKnownTypesValueVisitor::operator()<float>(float) const
Line
Count
Source
1380
250
  Value operator()(T t) const {
1381
250
    return VistWellKnownTypeValue(t);
1382
250
  }
value.cc:cel::Value cel::(anonymous namespace)::BorrowingWellKnownTypesValueVisitor::operator()<double>(double) const
Line
Count
Source
1380
292
  Value operator()(T t) const {
1381
292
    return VistWellKnownTypeValue(t);
1382
292
  }
value.cc:cel::Value cel::(anonymous namespace)::BorrowingWellKnownTypesValueVisitor::operator()<absl::lts_20260526::Duration>(absl::lts_20260526::Duration) const
Line
Count
Source
1380
703
  Value operator()(T t) const {
1381
703
    return VistWellKnownTypeValue(t);
1382
703
  }
value.cc:cel::Value cel::(anonymous namespace)::BorrowingWellKnownTypesValueVisitor::operator()<absl::lts_20260526::Time>(absl::lts_20260526::Time) const
Line
Count
Source
1380
6.02k
  Value operator()(T t) const {
1381
6.02k
    return VistWellKnownTypeValue(t);
1382
6.02k
  }
1383
};
1384
1385
}  // namespace
1386
1387
Value Value::FromMessage(
1388
    const google::protobuf::Message& message,
1389
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool
1390
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1391
    google::protobuf::MessageFactory* absl_nonnull message_factory
1392
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1393
0
    google::protobuf::Arena* absl_nonnull arena ABSL_ATTRIBUTE_LIFETIME_BOUND) {
1394
0
  ABSL_DCHECK(descriptor_pool != nullptr);
1395
0
  ABSL_DCHECK(message_factory != nullptr);
1396
0
  ABSL_DCHECK(arena != nullptr);
1397
1398
0
  std::string scratch;
1399
0
  auto status_or_adapted = well_known_types::AdaptFromMessage(
1400
0
      arena, message, descriptor_pool, message_factory, scratch);
1401
0
  if (ABSL_PREDICT_FALSE(!status_or_adapted.ok())) {
1402
0
    return ErrorValue::From(std::move(status_or_adapted).status(), arena);
1403
0
  }
1404
0
  return absl::visit(
1405
0
      absl::Overload(OwningWellKnownTypesValueVisitor{
1406
0
                         /* .arena = */ arena, /* .scratch = */ &scratch},
1407
0
                     [&](std::monostate) -> Value {
1408
0
                       auto* cloned = message.New(arena);
1409
0
                       cloned->CopyFrom(message);
1410
0
                       return ParsedMessageValue(cloned, arena);
1411
0
                     }),
1412
0
      std::move(status_or_adapted).value());
1413
0
}
1414
1415
Value Value::FromMessage(
1416
    google::protobuf::Message&& message,
1417
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool
1418
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1419
    google::protobuf::MessageFactory* absl_nonnull message_factory
1420
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1421
0
    google::protobuf::Arena* absl_nonnull arena ABSL_ATTRIBUTE_LIFETIME_BOUND) {
1422
0
  ABSL_DCHECK(descriptor_pool != nullptr);
1423
0
  ABSL_DCHECK(message_factory != nullptr);
1424
0
  ABSL_DCHECK(arena != nullptr);
1425
1426
0
  std::string scratch;
1427
0
  auto status_or_adapted = well_known_types::AdaptFromMessage(
1428
0
      arena, message, descriptor_pool, message_factory, scratch);
1429
0
  if (ABSL_PREDICT_FALSE(!status_or_adapted.ok())) {
1430
0
    return ErrorValue::From(std::move(status_or_adapted).status(), arena);
1431
0
  }
1432
0
  return absl::visit(
1433
0
      absl::Overload(OwningWellKnownTypesValueVisitor{
1434
0
                         /* .arena = */ arena, /* .scratch = */ &scratch},
1435
0
                     [&](std::monostate) -> Value {
1436
0
                       auto* cloned = message.New(arena);
1437
0
                       cloned->GetReflection()->Swap(cloned, &message);
1438
0
                       return ParsedMessageValue(cloned, arena);
1439
0
                     }),
1440
0
      std::move(status_or_adapted).value());
1441
0
}
1442
1443
Value Value::WrapMessage(
1444
    const google::protobuf::Message* absl_nonnull message ABSL_ATTRIBUTE_LIFETIME_BOUND,
1445
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool
1446
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1447
    google::protobuf::MessageFactory* absl_nonnull message_factory
1448
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1449
920k
    google::protobuf::Arena* absl_nonnull arena ABSL_ATTRIBUTE_LIFETIME_BOUND) {
1450
920k
  ABSL_DCHECK(message != nullptr);
1451
920k
  ABSL_DCHECK(descriptor_pool != nullptr);
1452
920k
  ABSL_DCHECK(message_factory != nullptr);
1453
920k
  ABSL_DCHECK(arena != nullptr);
1454
1455
920k
  std::string scratch;
1456
920k
  absl::StatusOr<well_known_types::Value> adapted_value =
1457
920k
      well_known_types::AdaptFromMessage(arena, *message, descriptor_pool,
1458
920k
                                         message_factory, scratch);
1459
920k
  if (ABSL_PREDICT_FALSE(!adapted_value.ok())) {
1460
4.24k
    return ErrorValue::From(std::move(adapted_value).status(), arena);
1461
4.24k
  }
1462
916k
  return absl::visit(
1463
916k
      absl::Overload(BorrowingWellKnownTypesValueVisitor{
1464
916k
                         /* .message = */ message, /* .arena = */ arena,
1465
916k
                         /* .scratch = */ &scratch},
1466
916k
                     [&](std::monostate) -> Value {
1467
467k
                       if (message->GetArena() != arena) {
1468
0
                         auto* cloned = message->New(arena);
1469
0
                         cloned->CopyFrom(*message);
1470
0
                         return ParsedMessageValue(cloned, arena);
1471
0
                       }
1472
467k
                       return ParsedMessageValue(message, arena);
1473
467k
                     }),
1474
916k
      std::move(adapted_value).value());
1475
920k
}
1476
1477
Value Value::WrapMessageUnsafe(
1478
    const google::protobuf::Message* absl_nonnull message ABSL_ATTRIBUTE_LIFETIME_BOUND,
1479
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool
1480
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1481
    google::protobuf::MessageFactory* absl_nonnull message_factory
1482
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1483
0
    google::protobuf::Arena* absl_nonnull arena ABSL_ATTRIBUTE_LIFETIME_BOUND) {
1484
0
  ABSL_DCHECK(message != nullptr);
1485
0
  ABSL_DCHECK(descriptor_pool != nullptr);
1486
0
  ABSL_DCHECK(message_factory != nullptr);
1487
0
  ABSL_DCHECK(arena != nullptr);
1488
1489
0
  std::string scratch;
1490
0
  absl::StatusOr<well_known_types::Value> adapted_value =
1491
0
      well_known_types::AdaptFromMessage(arena, *message, descriptor_pool,
1492
0
                                         message_factory, scratch);
1493
0
  if (ABSL_PREDICT_FALSE(!adapted_value.ok())) {
1494
0
    return ErrorValue::From(std::move(adapted_value).status(), arena);
1495
0
  }
1496
0
  return absl::visit(
1497
0
      absl::Overload(BorrowingWellKnownTypesValueVisitor{
1498
0
                         /* .message = */ message, /* .arena = */ arena,
1499
0
                         /* .scratch = */ &scratch},
1500
0
                     [&](std::monostate) -> Value {
1501
0
                       if (message->GetArena() != arena) {
1502
0
                         return UnsafeParsedMessageValue(message);
1503
0
                       }
1504
0
                       return ParsedMessageValue(message, arena);
1505
0
                     }),
1506
0
      std::move(adapted_value).value());
1507
0
}
1508
1509
namespace {
1510
1511
bool IsWellKnownMessageWrapperType(
1512
0
    const google::protobuf::Descriptor* absl_nonnull descriptor) {
1513
0
  switch (descriptor->well_known_type()) {
1514
0
    case google::protobuf::Descriptor::WELLKNOWNTYPE_BOOLVALUE:
1515
0
      ABSL_FALLTHROUGH_INTENDED;
1516
0
    case google::protobuf::Descriptor::WELLKNOWNTYPE_INT32VALUE:
1517
0
      ABSL_FALLTHROUGH_INTENDED;
1518
0
    case google::protobuf::Descriptor::WELLKNOWNTYPE_INT64VALUE:
1519
0
      ABSL_FALLTHROUGH_INTENDED;
1520
0
    case google::protobuf::Descriptor::WELLKNOWNTYPE_UINT32VALUE:
1521
0
      ABSL_FALLTHROUGH_INTENDED;
1522
0
    case google::protobuf::Descriptor::WELLKNOWNTYPE_UINT64VALUE:
1523
0
      ABSL_FALLTHROUGH_INTENDED;
1524
0
    case google::protobuf::Descriptor::WELLKNOWNTYPE_FLOATVALUE:
1525
0
      ABSL_FALLTHROUGH_INTENDED;
1526
0
    case google::protobuf::Descriptor::WELLKNOWNTYPE_DOUBLEVALUE:
1527
0
      ABSL_FALLTHROUGH_INTENDED;
1528
0
    case google::protobuf::Descriptor::WELLKNOWNTYPE_BYTESVALUE:
1529
0
      ABSL_FALLTHROUGH_INTENDED;
1530
0
    case google::protobuf::Descriptor::WELLKNOWNTYPE_STRINGVALUE:
1531
0
      return true;
1532
0
    default:
1533
0
      return false;
1534
0
  }
1535
0
}
1536
1537
template <typename Unsafe>
1538
Value WrapFieldImpl(
1539
    ProtoWrapperTypeOptions wrapper_type_options,
1540
    const google::protobuf::Message* absl_nonnull message ABSL_ATTRIBUTE_LIFETIME_BOUND,
1541
    const google::protobuf::FieldDescriptor* absl_nonnull field
1542
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1543
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool
1544
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1545
    google::protobuf::MessageFactory* absl_nonnull message_factory
1546
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1547
0
    google::protobuf::Arena* absl_nonnull arena ABSL_ATTRIBUTE_LIFETIME_BOUND) {
1548
0
  ABSL_DCHECK(field != nullptr);
1549
0
  ABSL_DCHECK_EQ(message->GetDescriptor(), field->containing_type());
1550
0
  ABSL_DCHECK(descriptor_pool != nullptr);
1551
0
  ABSL_DCHECK(message_factory != nullptr);
1552
0
  ABSL_DCHECK(!IsWellKnownMessageType(message->GetDescriptor()));
1553
1554
0
  const auto* reflection = message->GetReflection();
1555
0
  if (ABSL_PREDICT_FALSE(reflection == nullptr)) {
1556
    // This only happens for special implementations of Message that
1557
    // should not normally be used with CEL.
1558
0
    return ErrorValue::From(absl::InvalidArgumentError(absl::StrCat(
1559
0
                                "failed to get reflection for message type: ",
1560
0
                                message->GetDescriptor()->full_name())),
1561
0
                            arena);
1562
0
  }
1563
0
  if (field->is_map()) {
1564
0
    if constexpr (Unsafe::value) {
1565
0
      return UnsafeParsedMapFieldValue(message, field);
1566
0
    } else {
1567
0
      return ParsedMapFieldValue(message, field,
1568
0
                                 MessageArenaOr(message, arena));
1569
0
    }
1570
0
  }
1571
0
  if (field->is_repeated()) {
1572
0
    if constexpr (Unsafe::value) {
1573
0
      return UnsafeParsedRepeatedFieldValue(message, field);
1574
0
    } else {
1575
0
      return ParsedRepeatedFieldValue(message, field,
1576
0
                                      MessageArenaOr(message, arena));
1577
0
    }
1578
0
  }
1579
0
  switch (field->type()) {
1580
0
    case google::protobuf::FieldDescriptor::TYPE_DOUBLE:
1581
0
      return DoubleValue(reflection->GetDouble(*message, field));
1582
0
    case google::protobuf::FieldDescriptor::TYPE_FLOAT:
1583
0
      return DoubleValue(reflection->GetFloat(*message, field));
1584
0
    case google::protobuf::FieldDescriptor::TYPE_INT64:
1585
0
      return IntValue(reflection->GetInt64(*message, field));
1586
0
    case google::protobuf::FieldDescriptor::TYPE_UINT64:
1587
0
      return UintValue(reflection->GetUInt64(*message, field));
1588
0
    case google::protobuf::FieldDescriptor::TYPE_INT32:
1589
0
      return IntValue(reflection->GetInt32(*message, field));
1590
0
    case google::protobuf::FieldDescriptor::TYPE_FIXED64:
1591
0
      return UintValue(reflection->GetUInt64(*message, field));
1592
0
    case google::protobuf::FieldDescriptor::TYPE_FIXED32:
1593
0
      return UintValue(reflection->GetUInt32(*message, field));
1594
0
    case google::protobuf::FieldDescriptor::TYPE_BOOL:
1595
0
      return BoolValue(reflection->GetBool(*message, field));
1596
0
    case google::protobuf::FieldDescriptor::TYPE_STRING: {
1597
0
      std::string scratch;
1598
0
      return absl::visit(
1599
0
          absl::Overload(
1600
0
              [&](absl::string_view string) -> StringValue {
1601
0
                if (string.data() == scratch.data() &&
1602
0
                    string.size() == scratch.size()) {
1603
0
                  return StringValue::From(std::move(scratch), arena);
1604
0
                }
1605
0
                if constexpr (Unsafe::value) {
1606
0
                  return StringValue::WrapUnsafe(string);
1607
0
                } else {
1608
0
                  if (google::protobuf::Arena* message_arena = message->GetArena();
1609
0
                      message_arena != nullptr) {
1610
0
                    return StringValue::Wrap(string, message_arena);
1611
0
                  }
1612
0
                  return StringValue::From(string, arena);
1613
0
                }
1614
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
1615
0
              [&](absl::Cord&& cord) -> StringValue {
1616
0
                return StringValue::From(std::move(cord), arena);
1617
0
              }),
Unexecuted instantiation: value.cc:cel::(anonymous namespace)::WrapFieldImpl<std::__1::integral_constant<bool, false> >(cel::ProtoWrapperTypeOptions, google::protobuf::Message const*, google::protobuf::FieldDescriptor const*, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*)::{lambda(absl::lts_20260526::Cord&&)#1}::operator()(absl::lts_20260526::Cord&&) const
Unexecuted instantiation: value.cc:cel::(anonymous namespace)::WrapFieldImpl<std::__1::integral_constant<bool, true> >(cel::ProtoWrapperTypeOptions, google::protobuf::Message const*, google::protobuf::FieldDescriptor const*, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*)::{lambda(absl::lts_20260526::Cord&&)#1}::operator()(absl::lts_20260526::Cord&&) const
1618
0
          well_known_types::AsVariant(
1619
0
              well_known_types::GetStringField(*message, field, scratch)));
1620
0
    }
1621
0
    case google::protobuf::FieldDescriptor::TYPE_GROUP:
1622
0
      ABSL_FALLTHROUGH_INTENDED;
1623
0
    case google::protobuf::FieldDescriptor::TYPE_MESSAGE:
1624
0
      if (wrapper_type_options == ProtoWrapperTypeOptions::kUnsetNull &&
1625
0
          IsWellKnownMessageWrapperType(field->message_type()) &&
1626
0
          !reflection->HasField(*message, field)) {
1627
0
        return NullValue();
1628
0
      }
1629
0
      if constexpr (Unsafe::value) {
1630
0
        return Value::WrapMessageUnsafe(
1631
0
            &reflection->GetMessage(*message, field, message_factory),
1632
0
            descriptor_pool, message_factory, arena);
1633
0
      } else {
1634
0
        return Value::WrapMessage(
1635
0
            &reflection->GetMessage(*message, field, message_factory),
1636
0
            descriptor_pool, message_factory, arena);
1637
0
      }
1638
0
    case google::protobuf::FieldDescriptor::TYPE_BYTES: {
1639
0
      std::string scratch;
1640
0
      return absl::visit(
1641
0
          absl::Overload(
1642
0
              [&](absl::string_view string) -> BytesValue {
1643
0
                if (string.data() == scratch.data() &&
1644
0
                    string.size() == scratch.size()) {
1645
0
                  return BytesValue::From(std::move(scratch), arena);
1646
0
                }
1647
0
                if constexpr (Unsafe::value) {
1648
0
                  return BytesValue::WrapUnsafe(string);
1649
0
                } else {
1650
0
                  if (google::protobuf::Arena* message_arena = message->GetArena();
1651
0
                      message_arena != nullptr) {
1652
0
                    return BytesValue::Wrap(string, message_arena);
1653
0
                  }
1654
0
                  return BytesValue::From(string, arena);
1655
0
                }
1656
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
1657
0
              [&](absl::Cord&& cord) -> BytesValue {
1658
0
                return BytesValue::From(std::move(cord), arena);
1659
0
              }),
Unexecuted instantiation: value.cc:cel::(anonymous namespace)::WrapFieldImpl<std::__1::integral_constant<bool, false> >(cel::ProtoWrapperTypeOptions, google::protobuf::Message const*, google::protobuf::FieldDescriptor const*, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*)::{lambda(absl::lts_20260526::Cord&&)#2}::operator()(absl::lts_20260526::Cord&&) const
Unexecuted instantiation: value.cc:cel::(anonymous namespace)::WrapFieldImpl<std::__1::integral_constant<bool, true> >(cel::ProtoWrapperTypeOptions, google::protobuf::Message const*, google::protobuf::FieldDescriptor const*, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*)::{lambda(absl::lts_20260526::Cord&&)#2}::operator()(absl::lts_20260526::Cord&&) const
1660
0
          well_known_types::AsVariant(
1661
0
              well_known_types::GetBytesField(*message, field, scratch)));
1662
0
    }
1663
0
    case google::protobuf::FieldDescriptor::TYPE_UINT32:
1664
0
      return UintValue(reflection->GetUInt32(*message, field));
1665
0
    case google::protobuf::FieldDescriptor::TYPE_ENUM:
1666
0
      return Value::Enum(field->enum_type(),
1667
0
                         reflection->GetEnumValue(*message, field));
1668
0
    case google::protobuf::FieldDescriptor::TYPE_SFIXED32:
1669
0
      return IntValue(reflection->GetInt32(*message, field));
1670
0
    case google::protobuf::FieldDescriptor::TYPE_SFIXED64:
1671
0
      return IntValue(reflection->GetInt64(*message, field));
1672
0
    case google::protobuf::FieldDescriptor::TYPE_SINT32:
1673
0
      return IntValue(reflection->GetInt32(*message, field));
1674
0
    case google::protobuf::FieldDescriptor::TYPE_SINT64:
1675
0
      return IntValue(reflection->GetInt64(*message, field));
1676
0
    default:
1677
0
      return ErrorValue::From(
1678
0
          absl::InvalidArgumentError(
1679
0
              absl::StrCat("unexpected protocol buffer message field type: ",
1680
0
                           field->type_name())),
1681
0
          arena);
1682
0
  }
1683
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*)
1684
1685
template <typename Unsafe>
1686
Value WrapRepeatedFieldImpl(
1687
    int index,
1688
    const google::protobuf::Message* absl_nonnull message ABSL_ATTRIBUTE_LIFETIME_BOUND,
1689
    const google::protobuf::FieldDescriptor* absl_nonnull field
1690
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1691
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool
1692
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1693
    google::protobuf::MessageFactory* absl_nonnull message_factory
1694
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1695
0
    google::protobuf::Arena* absl_nonnull arena ABSL_ATTRIBUTE_LIFETIME_BOUND) {
1696
0
  ABSL_DCHECK(field != nullptr);
1697
0
  ABSL_DCHECK_EQ(field->containing_type(), message->GetDescriptor());
1698
0
  ABSL_DCHECK(!field->is_map() && field->is_repeated());
1699
0
  ABSL_DCHECK_GE(index, 0);
1700
0
  ABSL_DCHECK(message != nullptr);
1701
0
  ABSL_DCHECK(descriptor_pool != nullptr);
1702
0
  ABSL_DCHECK(message_factory != nullptr);
1703
0
  ABSL_DCHECK(arena != nullptr);
1704
1705
0
  const auto* reflection = message->GetReflection();
1706
0
  if (ABSL_PREDICT_FALSE(reflection == nullptr)) {
1707
    // This only happens for special implementations of Message that
1708
    // should not normally be used with CEL.
1709
0
    return ErrorValue::From(absl::InvalidArgumentError(absl::StrCat(
1710
0
                                "failed to get reflection for message type: ",
1711
0
                                message->GetDescriptor()->full_name())),
1712
0
                            arena);
1713
0
  }
1714
0
  const int size = reflection->FieldSize(*message, field);
1715
0
  if (ABSL_PREDICT_FALSE(index < 0 || index >= size)) {
1716
0
    return ErrorValue::From(absl::InvalidArgumentError(
1717
0
                                absl::StrCat("index out of bounds: ", index)),
1718
0
                            arena);
1719
0
  }
1720
0
  switch (field->type()) {
1721
0
    case google::protobuf::FieldDescriptor::TYPE_DOUBLE:
1722
0
      return DoubleValue(reflection->GetRepeatedDouble(*message, field, index));
1723
0
    case google::protobuf::FieldDescriptor::TYPE_FLOAT:
1724
0
      return DoubleValue(reflection->GetRepeatedFloat(*message, field, index));
1725
0
    case google::protobuf::FieldDescriptor::TYPE_SFIXED64:
1726
0
      ABSL_FALLTHROUGH_INTENDED;
1727
0
    case google::protobuf::FieldDescriptor::TYPE_SINT64:
1728
0
      ABSL_FALLTHROUGH_INTENDED;
1729
0
    case google::protobuf::FieldDescriptor::TYPE_INT64:
1730
0
      return IntValue(reflection->GetRepeatedInt64(*message, field, index));
1731
0
    case google::protobuf::FieldDescriptor::TYPE_FIXED64:
1732
0
      ABSL_FALLTHROUGH_INTENDED;
1733
0
    case google::protobuf::FieldDescriptor::TYPE_UINT64:
1734
0
      return UintValue(reflection->GetRepeatedUInt64(*message, field, index));
1735
0
    case google::protobuf::FieldDescriptor::TYPE_SFIXED32:
1736
0
      ABSL_FALLTHROUGH_INTENDED;
1737
0
    case google::protobuf::FieldDescriptor::TYPE_SINT32:
1738
0
      ABSL_FALLTHROUGH_INTENDED;
1739
0
    case google::protobuf::FieldDescriptor::TYPE_INT32:
1740
0
      return IntValue(reflection->GetRepeatedInt32(*message, field, index));
1741
0
    case google::protobuf::FieldDescriptor::TYPE_BOOL:
1742
0
      return BoolValue(reflection->GetRepeatedBool(*message, field, index));
1743
0
    case google::protobuf::FieldDescriptor::TYPE_STRING: {
1744
0
      std::string scratch;
1745
0
      return absl::visit(
1746
0
          absl::Overload(
1747
0
              [&](absl::string_view string) -> StringValue {
1748
0
                if (string.data() == scratch.data() &&
1749
0
                    string.size() == scratch.size()) {
1750
0
                  return StringValue::From(std::move(scratch), arena);
1751
0
                }
1752
0
                if constexpr (Unsafe::value) {
1753
0
                  return StringValue::WrapUnsafe(string);
1754
0
                } else {
1755
0
                  if (google::protobuf::Arena* message_arena = message->GetArena();
1756
0
                      message_arena != nullptr) {
1757
0
                    return StringValue::Wrap(string, message_arena);
1758
0
                  }
1759
0
                  return StringValue::From(string, arena);
1760
0
                }
1761
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
1762
0
              [&](absl::Cord&& cord) -> StringValue {
1763
0
                return StringValue::From(std::move(cord), arena);
1764
0
              }),
Unexecuted instantiation: value.cc:cel::(anonymous namespace)::WrapRepeatedFieldImpl<std::__1::integral_constant<bool, false> >(int, google::protobuf::Message const*, google::protobuf::FieldDescriptor const*, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*)::{lambda(absl::lts_20260526::Cord&&)#1}::operator()(absl::lts_20260526::Cord&&) const
Unexecuted instantiation: value.cc:cel::(anonymous namespace)::WrapRepeatedFieldImpl<std::__1::integral_constant<bool, true> >(int, google::protobuf::Message const*, google::protobuf::FieldDescriptor const*, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*)::{lambda(absl::lts_20260526::Cord&&)#1}::operator()(absl::lts_20260526::Cord&&) const
1765
0
          well_known_types::AsVariant(well_known_types::GetRepeatedStringField(
1766
0
              reflection, *message, field, index, scratch)));
1767
0
    }
1768
0
    case google::protobuf::FieldDescriptor::TYPE_GROUP:
1769
0
      ABSL_FALLTHROUGH_INTENDED;
1770
0
    case google::protobuf::FieldDescriptor::TYPE_MESSAGE:
1771
0
      if constexpr (Unsafe::value) {
1772
0
        return Value::WrapMessageUnsafe(
1773
0
            &reflection->GetRepeatedMessage(*message, field, index),
1774
0
            descriptor_pool, message_factory, arena);
1775
0
      } else {
1776
0
        return Value::WrapMessage(
1777
0
            &reflection->GetRepeatedMessage(*message, field, index),
1778
0
            descriptor_pool, message_factory, arena);
1779
0
      }
1780
0
    case google::protobuf::FieldDescriptor::TYPE_BYTES: {
1781
0
      std::string scratch;
1782
0
      return absl::visit(
1783
0
          absl::Overload(
1784
0
              [&](absl::string_view string) -> BytesValue {
1785
0
                if (string.data() == scratch.data() &&
1786
0
                    string.size() == scratch.size()) {
1787
0
                  return BytesValue::From(std::move(scratch), arena);
1788
0
                }
1789
0
                if constexpr (Unsafe::value) {
1790
0
                  return BytesValue::WrapUnsafe(string);
1791
0
                } else {
1792
0
                  if (google::protobuf::Arena* message_arena = message->GetArena();
1793
0
                      message_arena != nullptr) {
1794
0
                    return BytesValue::Wrap(string, message_arena);
1795
0
                  }
1796
0
                  return BytesValue::From(string, arena);
1797
0
                }
1798
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
1799
0
              [&](absl::Cord&& cord) -> BytesValue {
1800
0
                return BytesValue::From(std::move(cord), arena);
1801
0
              }),
Unexecuted instantiation: value.cc:cel::(anonymous namespace)::WrapRepeatedFieldImpl<std::__1::integral_constant<bool, false> >(int, google::protobuf::Message const*, google::protobuf::FieldDescriptor const*, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*)::{lambda(absl::lts_20260526::Cord&&)#2}::operator()(absl::lts_20260526::Cord&&) const
Unexecuted instantiation: value.cc:cel::(anonymous namespace)::WrapRepeatedFieldImpl<std::__1::integral_constant<bool, true> >(int, google::protobuf::Message const*, google::protobuf::FieldDescriptor const*, google::protobuf::DescriptorPool const*, google::protobuf::MessageFactory*, google::protobuf::Arena*)::{lambda(absl::lts_20260526::Cord&&)#2}::operator()(absl::lts_20260526::Cord&&) const
1802
0
          well_known_types::AsVariant(well_known_types::GetRepeatedBytesField(
1803
0
              reflection, *message, field, index, scratch)));
1804
0
    }
1805
0
    case google::protobuf::FieldDescriptor::TYPE_FIXED32:
1806
0
      ABSL_FALLTHROUGH_INTENDED;
1807
0
    case google::protobuf::FieldDescriptor::TYPE_UINT32:
1808
0
      return UintValue(reflection->GetRepeatedUInt32(*message, field, index));
1809
0
    case google::protobuf::FieldDescriptor::TYPE_ENUM:
1810
0
      return Value::Enum(field->enum_type(), reflection->GetRepeatedEnumValue(
1811
0
                                                 *message, field, index));
1812
0
    default:
1813
0
      return ErrorValue::From(
1814
0
          absl::InvalidArgumentError(absl::StrCat(
1815
0
              "unexpected message field type: ", field->type_name())),
1816
0
          arena);
1817
0
  }
1818
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*)
1819
1820
template <typename Unsafe>
1821
Value WrapMapFieldValueImpl(
1822
    const google::protobuf::MapValueConstRef& value,
1823
    const google::protobuf::Message* absl_nonnull message ABSL_ATTRIBUTE_LIFETIME_BOUND,
1824
    const google::protobuf::FieldDescriptor* absl_nonnull field
1825
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1826
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool
1827
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1828
    google::protobuf::MessageFactory* absl_nonnull message_factory
1829
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1830
0
    google::protobuf::Arena* absl_nonnull arena ABSL_ATTRIBUTE_LIFETIME_BOUND) {
1831
0
  ABSL_DCHECK(field != nullptr);
1832
0
  ABSL_DCHECK_EQ(field->containing_type()->containing_type(),
1833
0
                 message->GetDescriptor());
1834
0
  ABSL_DCHECK(!field->is_map() && !field->is_repeated());
1835
0
  ABSL_DCHECK_EQ(value.type(), field->cpp_type());
1836
0
  ABSL_DCHECK(message != nullptr);
1837
0
  ABSL_DCHECK(descriptor_pool != nullptr);
1838
0
  ABSL_DCHECK(message_factory != nullptr);
1839
0
  ABSL_DCHECK(arena != nullptr);
1840
1841
0
  switch (field->type()) {
1842
0
    case google::protobuf::FieldDescriptor::TYPE_DOUBLE:
1843
0
      return DoubleValue(value.GetDoubleValue());
1844
0
    case google::protobuf::FieldDescriptor::TYPE_FLOAT:
1845
0
      return DoubleValue(value.GetFloatValue());
1846
0
    case google::protobuf::FieldDescriptor::TYPE_SFIXED64:
1847
0
      ABSL_FALLTHROUGH_INTENDED;
1848
0
    case google::protobuf::FieldDescriptor::TYPE_SINT64:
1849
0
      ABSL_FALLTHROUGH_INTENDED;
1850
0
    case google::protobuf::FieldDescriptor::TYPE_INT64:
1851
0
      return IntValue(value.GetInt64Value());
1852
0
    case google::protobuf::FieldDescriptor::TYPE_FIXED64:
1853
0
      ABSL_FALLTHROUGH_INTENDED;
1854
0
    case google::protobuf::FieldDescriptor::TYPE_UINT64:
1855
0
      return UintValue(value.GetUInt64Value());
1856
0
    case google::protobuf::FieldDescriptor::TYPE_SFIXED32:
1857
0
      ABSL_FALLTHROUGH_INTENDED;
1858
0
    case google::protobuf::FieldDescriptor::TYPE_SINT32:
1859
0
      ABSL_FALLTHROUGH_INTENDED;
1860
0
    case google::protobuf::FieldDescriptor::TYPE_INT32:
1861
0
      return IntValue(value.GetInt32Value());
1862
0
    case google::protobuf::FieldDescriptor::TYPE_BOOL:
1863
0
      return BoolValue(value.GetBoolValue());
1864
0
    case google::protobuf::FieldDescriptor::TYPE_STRING:
1865
0
      if constexpr (Unsafe::value) {
1866
0
        return StringValue::WrapUnsafe(value.GetStringValue());
1867
0
      } else {
1868
0
        return StringValue::From(value.GetStringValue(), arena);
1869
0
      }
1870
0
    case google::protobuf::FieldDescriptor::TYPE_GROUP:
1871
0
      ABSL_FALLTHROUGH_INTENDED;
1872
0
    case google::protobuf::FieldDescriptor::TYPE_MESSAGE:
1873
0
      if constexpr (Unsafe::value) {
1874
0
        return Value::WrapMessageUnsafe(
1875
0
            &value.GetMessageValue(), descriptor_pool, message_factory, arena);
1876
0
      } else {
1877
0
        return Value::WrapMessage(&value.GetMessageValue(), descriptor_pool,
1878
0
                                  message_factory, arena);
1879
0
      }
1880
0
    case google::protobuf::FieldDescriptor::TYPE_BYTES:
1881
0
      if constexpr (Unsafe::value) {
1882
0
        return BytesValue::WrapUnsafe(value.GetStringValue());
1883
0
      } else {
1884
0
        return BytesValue::From(value.GetStringValue(), arena);
1885
0
      }
1886
0
    case google::protobuf::FieldDescriptor::TYPE_FIXED32:
1887
0
      ABSL_FALLTHROUGH_INTENDED;
1888
0
    case google::protobuf::FieldDescriptor::TYPE_UINT32:
1889
0
      return UintValue(value.GetUInt32Value());
1890
0
    case google::protobuf::FieldDescriptor::TYPE_ENUM:
1891
0
      return Value::Enum(field->enum_type(), value.GetEnumValue());
1892
0
    default:
1893
0
      return ErrorValue::From(
1894
0
          absl::InvalidArgumentError(absl::StrCat(
1895
0
              "unexpected message field type: ", field->type_name())),
1896
0
          arena);
1897
0
  }
1898
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*)
1899
1900
}  // namespace
1901
1902
Value Value::WrapField(
1903
    ProtoWrapperTypeOptions wrapper_type_options,
1904
    const google::protobuf::Message* absl_nonnull message ABSL_ATTRIBUTE_LIFETIME_BOUND,
1905
    const google::protobuf::FieldDescriptor* absl_nonnull field
1906
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1907
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool
1908
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1909
    google::protobuf::MessageFactory* absl_nonnull message_factory
1910
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1911
0
    google::protobuf::Arena* absl_nonnull arena ABSL_ATTRIBUTE_LIFETIME_BOUND) {
1912
0
  using Unsafe = std::false_type;
1913
0
  return WrapFieldImpl<Unsafe>(wrapper_type_options, message, field,
1914
0
                               descriptor_pool, message_factory, arena);
1915
0
}
1916
1917
Value Value::WrapFieldUnsafe(
1918
    ProtoWrapperTypeOptions wrapper_type_options,
1919
    const google::protobuf::Message* absl_nonnull message ABSL_ATTRIBUTE_LIFETIME_BOUND,
1920
    const google::protobuf::FieldDescriptor* absl_nonnull field
1921
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1922
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool
1923
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1924
    google::protobuf::MessageFactory* absl_nonnull message_factory
1925
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1926
0
    google::protobuf::Arena* absl_nonnull arena ABSL_ATTRIBUTE_LIFETIME_BOUND) {
1927
0
  using Unsafe = std::true_type;
1928
0
  return WrapFieldImpl<Unsafe>(wrapper_type_options, message, field,
1929
0
                               descriptor_pool, message_factory, arena);
1930
0
}
1931
1932
Value Value::WrapRepeatedField(
1933
    int index,
1934
    const google::protobuf::Message* absl_nonnull message ABSL_ATTRIBUTE_LIFETIME_BOUND,
1935
    const google::protobuf::FieldDescriptor* absl_nonnull field
1936
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1937
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool
1938
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1939
    google::protobuf::MessageFactory* absl_nonnull message_factory
1940
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1941
0
    google::protobuf::Arena* absl_nonnull arena ABSL_ATTRIBUTE_LIFETIME_BOUND) {
1942
0
  using Unsafe = std::false_type;
1943
0
  return WrapRepeatedFieldImpl<Unsafe>(index, message, field, descriptor_pool,
1944
0
                                       message_factory, arena);
1945
0
}
1946
1947
Value Value::WrapRepeatedFieldUnsafe(
1948
    int index,
1949
    const google::protobuf::Message* absl_nonnull message ABSL_ATTRIBUTE_LIFETIME_BOUND,
1950
    const google::protobuf::FieldDescriptor* absl_nonnull field
1951
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1952
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool
1953
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1954
    google::protobuf::MessageFactory* absl_nonnull message_factory
1955
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1956
0
    google::protobuf::Arena* absl_nonnull arena ABSL_ATTRIBUTE_LIFETIME_BOUND) {
1957
0
  using Unsafe = std::true_type;
1958
0
  return WrapRepeatedFieldImpl<Unsafe>(index, message, field, descriptor_pool,
1959
0
                                       message_factory, arena);
1960
0
}
1961
1962
StringValue Value::WrapMapFieldKeyString(
1963
    const google::protobuf::MapKey& key,
1964
    const google::protobuf::Message* absl_nonnull message ABSL_ATTRIBUTE_LIFETIME_BOUND,
1965
0
    google::protobuf::Arena* absl_nonnull arena ABSL_ATTRIBUTE_LIFETIME_BOUND) {
1966
0
  ABSL_DCHECK(message != nullptr);
1967
0
  ABSL_DCHECK(arena != nullptr);
1968
0
  ABSL_DCHECK_EQ(key.type(), google::protobuf::FieldDescriptor::CPPTYPE_STRING);
1969
1970
0
#if CEL_INTERNAL_PROTOBUF_OSS_VERSION_PREREQ(5, 30, 0)
1971
0
  if (google::protobuf::Arena* message_arena = message->GetArena();
1972
0
      message_arena != nullptr) {
1973
0
    return StringValue::Wrap(key.GetStringValue(), message_arena);
1974
0
  }
1975
0
#endif
1976
0
  return StringValue::From(key.GetStringValue(), arena);
1977
0
}
1978
1979
Value Value::WrapMapFieldValue(
1980
    const google::protobuf::MapValueConstRef& value,
1981
    const google::protobuf::Message* absl_nonnull message ABSL_ATTRIBUTE_LIFETIME_BOUND,
1982
    const google::protobuf::FieldDescriptor* absl_nonnull field
1983
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1984
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool
1985
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1986
    google::protobuf::MessageFactory* absl_nonnull message_factory
1987
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1988
0
    google::protobuf::Arena* absl_nonnull arena ABSL_ATTRIBUTE_LIFETIME_BOUND) {
1989
0
  using Unsafe = std::false_type;
1990
0
  return WrapMapFieldValueImpl<Unsafe>(value, message, field, descriptor_pool,
1991
0
                                       message_factory, arena);
1992
0
}
1993
1994
Value Value::WrapMapFieldValueUnsafe(
1995
    const google::protobuf::MapValueConstRef& value,
1996
    const google::protobuf::Message* absl_nonnull message ABSL_ATTRIBUTE_LIFETIME_BOUND,
1997
    const google::protobuf::FieldDescriptor* absl_nonnull field
1998
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
1999
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool
2000
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
2001
    google::protobuf::MessageFactory* absl_nonnull message_factory
2002
        ABSL_ATTRIBUTE_LIFETIME_BOUND,
2003
0
    google::protobuf::Arena* absl_nonnull arena ABSL_ATTRIBUTE_LIFETIME_BOUND) {
2004
0
  using Unsafe = std::true_type;
2005
0
  return WrapMapFieldValueImpl<Unsafe>(value, message, field, descriptor_pool,
2006
0
                                       message_factory, arena);
2007
0
}
2008
2009
4.23k
absl::optional<ListValue> Value::AsList() const& {
2010
4.23k
  if (const auto* alternative = variant_.As<common_internal::LegacyListValue>();
2011
4.23k
      alternative != nullptr) {
2012
0
    return *alternative;
2013
0
  }
2014
4.23k
  if (const auto* alternative = variant_.As<CustomListValue>();
2015
4.23k
      alternative != nullptr) {
2016
3.68k
    return *alternative;
2017
3.68k
  }
2018
552
  if (const auto* alternative = variant_.As<ParsedRepeatedFieldValue>();
2019
552
      alternative != nullptr) {
2020
0
    return *alternative;
2021
0
  }
2022
552
  if (const auto* alternative = variant_.As<ParsedJsonListValue>();
2023
552
      alternative != nullptr) {
2024
0
    return *alternative;
2025
0
  }
2026
552
  return std::nullopt;
2027
552
}
2028
2029
0
absl::optional<ListValue> Value::AsList() && {
2030
0
  if (auto* alternative = variant_.As<common_internal::LegacyListValue>();
2031
0
      alternative != nullptr) {
2032
0
    return std::move(*alternative);
2033
0
  }
2034
0
  if (auto* alternative = variant_.As<CustomListValue>();
2035
0
      alternative != nullptr) {
2036
0
    return std::move(*alternative);
2037
0
  }
2038
0
  if (auto* alternative = variant_.As<ParsedRepeatedFieldValue>();
2039
0
      alternative != nullptr) {
2040
0
    return std::move(*alternative);
2041
0
  }
2042
0
  if (auto* alternative = variant_.As<ParsedJsonListValue>();
2043
0
      alternative != nullptr) {
2044
0
    return std::move(*alternative);
2045
0
  }
2046
0
  return std::nullopt;
2047
0
}
2048
2049
11.7k
absl::optional<MapValue> Value::AsMap() const& {
2050
11.7k
  if (const auto* alternative = variant_.As<common_internal::LegacyMapValue>();
2051
11.7k
      alternative != nullptr) {
2052
0
    return *alternative;
2053
0
  }
2054
11.7k
  if (const auto* alternative = variant_.As<CustomMapValue>();
2055
11.7k
      alternative != nullptr) {
2056
6.07k
    return *alternative;
2057
6.07k
  }
2058
5.68k
  if (const auto* alternative = variant_.As<ParsedMapFieldValue>();
2059
5.68k
      alternative != nullptr) {
2060
0
    return *alternative;
2061
0
  }
2062
5.68k
  if (const auto* alternative = variant_.As<ParsedJsonMapValue>();
2063
5.68k
      alternative != nullptr) {
2064
0
    return *alternative;
2065
0
  }
2066
5.68k
  return std::nullopt;
2067
5.68k
}
2068
2069
0
absl::optional<MapValue> Value::AsMap() && {
2070
0
  if (auto* alternative = variant_.As<common_internal::LegacyMapValue>();
2071
0
      alternative != nullptr) {
2072
0
    return std::move(*alternative);
2073
0
  }
2074
0
  if (auto* alternative = variant_.As<CustomMapValue>();
2075
0
      alternative != nullptr) {
2076
0
    return std::move(*alternative);
2077
0
  }
2078
0
  if (auto* alternative = variant_.As<ParsedMapFieldValue>();
2079
0
      alternative != nullptr) {
2080
0
    return std::move(*alternative);
2081
0
  }
2082
0
  if (auto* alternative = variant_.As<ParsedJsonMapValue>();
2083
0
      alternative != nullptr) {
2084
0
    return std::move(*alternative);
2085
0
  }
2086
0
  return std::nullopt;
2087
0
}
2088
2089
222
absl::optional<StructValue> Value::AsStruct() const& {
2090
222
  if (const auto* alternative =
2091
222
          variant_.As<common_internal::LegacyStructValue>();
2092
222
      alternative != nullptr) {
2093
0
    return *alternative;
2094
0
  }
2095
222
  if (const auto* alternative = variant_.As<CustomStructValue>();
2096
222
      alternative != nullptr) {
2097
0
    return *alternative;
2098
0
  }
2099
222
  if (const auto* alternative = variant_.As<ParsedMessageValue>();
2100
222
      alternative != nullptr) {
2101
0
    return *alternative;
2102
0
  }
2103
222
  return std::nullopt;
2104
222
}
2105
2106
0
absl::optional<StructValue> Value::AsStruct() && {
2107
0
  if (auto* alternative = variant_.As<common_internal::LegacyStructValue>();
2108
0
      alternative != nullptr) {
2109
0
    return std::move(*alternative);
2110
0
  }
2111
0
  if (auto* alternative = variant_.As<CustomStructValue>();
2112
0
      alternative != nullptr) {
2113
0
    return std::move(*alternative);
2114
0
  }
2115
0
  if (auto* alternative = variant_.As<ParsedMessageValue>();
2116
0
      alternative != nullptr) {
2117
0
    return std::move(*alternative);
2118
0
  }
2119
0
  return std::nullopt;
2120
0
}
2121
2122
#ifdef ABSL_HAVE_EXCEPTIONS
2123
0
#define CEL_VALUE_THROW_BAD_VARIANT_ACCESS() throw absl::bad_variant_access()
2124
#else
2125
#define CEL_VALUE_THROW_BAD_VARIANT_ACCESS() \
2126
  ABSL_LOG(FATAL) << absl::bad_variant_access().what() /* Crash OK */
2127
#endif
2128
2129
1.64M
ListValue Value::GetList() const& {
2130
3.29M
  ABSL_DCHECK(IsList()) << *this;
2131
1.64M
  if (const auto* alternative = variant_.As<common_internal::LegacyListValue>();
2132
1.64M
      alternative != nullptr) {
2133
0
    return *alternative;
2134
0
  }
2135
1.64M
  if (const auto* alternative = variant_.As<CustomListValue>();
2136
1.64M
      alternative != nullptr) {
2137
1.53M
    return *alternative;
2138
1.53M
  }
2139
111k
  if (const auto* alternative = variant_.As<ParsedRepeatedFieldValue>();
2140
111k
      alternative != nullptr) {
2141
0
    return *alternative;
2142
0
  }
2143
111k
  if (const auto* alternative = variant_.As<ParsedJsonListValue>();
2144
111k
      alternative != nullptr) {
2145
111k
    return *alternative;
2146
111k
  }
2147
111k
  CEL_VALUE_THROW_BAD_VARIANT_ACCESS();
2148
111k
}
2149
2150
0
ListValue Value::GetList() && {
2151
0
  ABSL_DCHECK(IsList()) << *this;
2152
0
  if (auto* alternative = variant_.As<common_internal::LegacyListValue>();
2153
0
      alternative != nullptr) {
2154
0
    return std::move(*alternative);
2155
0
  }
2156
0
  if (auto* alternative = variant_.As<CustomListValue>();
2157
0
      alternative != nullptr) {
2158
0
    return std::move(*alternative);
2159
0
  }
2160
0
  if (auto* alternative = variant_.As<ParsedRepeatedFieldValue>();
2161
0
      alternative != nullptr) {
2162
0
    return std::move(*alternative);
2163
0
  }
2164
0
  if (auto* alternative = variant_.As<ParsedJsonListValue>();
2165
0
      alternative != nullptr) {
2166
0
    return std::move(*alternative);
2167
0
  }
2168
0
  CEL_VALUE_THROW_BAD_VARIANT_ACCESS();
2169
0
}
2170
2171
407k
MapValue Value::GetMap() const& {
2172
815k
  ABSL_DCHECK(IsMap()) << *this;
2173
407k
  if (const auto* alternative = variant_.As<common_internal::LegacyMapValue>();
2174
407k
      alternative != nullptr) {
2175
0
    return *alternative;
2176
0
  }
2177
407k
  if (const auto* alternative = variant_.As<CustomMapValue>();
2178
407k
      alternative != nullptr) {
2179
397k
    return *alternative;
2180
397k
  }
2181
9.80k
  if (const auto* alternative = variant_.As<ParsedMapFieldValue>();
2182
9.80k
      alternative != nullptr) {
2183
0
    return *alternative;
2184
0
  }
2185
9.80k
  if (const auto* alternative = variant_.As<ParsedJsonMapValue>();
2186
9.80k
      alternative != nullptr) {
2187
9.80k
    return *alternative;
2188
9.80k
  }
2189
9.80k
  CEL_VALUE_THROW_BAD_VARIANT_ACCESS();
2190
9.80k
}
2191
2192
0
MapValue Value::GetMap() && {
2193
0
  ABSL_DCHECK(IsMap()) << *this;
2194
0
  if (auto* alternative = variant_.As<common_internal::LegacyMapValue>();
2195
0
      alternative != nullptr) {
2196
0
    return std::move(*alternative);
2197
0
  }
2198
0
  if (auto* alternative = variant_.As<CustomMapValue>();
2199
0
      alternative != nullptr) {
2200
0
    return std::move(*alternative);
2201
0
  }
2202
0
  if (auto* alternative = variant_.As<ParsedMapFieldValue>();
2203
0
      alternative != nullptr) {
2204
0
    return std::move(*alternative);
2205
0
  }
2206
0
  if (auto* alternative = variant_.As<ParsedJsonMapValue>();
2207
0
      alternative != nullptr) {
2208
0
    return std::move(*alternative);
2209
0
  }
2210
0
  CEL_VALUE_THROW_BAD_VARIANT_ACCESS();
2211
0
}
2212
2213
407k
StructValue Value::GetStruct() const& {
2214
814k
  ABSL_DCHECK(IsStruct()) << *this;
2215
407k
  if (const auto* alternative =
2216
407k
          variant_.As<common_internal::LegacyStructValue>();
2217
407k
      alternative != nullptr) {
2218
407k
    return *alternative;
2219
407k
  }
2220
0
  if (const auto* alternative = variant_.As<CustomStructValue>();
2221
0
      alternative != nullptr) {
2222
0
    return *alternative;
2223
0
  }
2224
0
  if (const auto* alternative = variant_.As<ParsedMessageValue>();
2225
0
      alternative != nullptr) {
2226
0
    return *alternative;
2227
0
  }
2228
0
  CEL_VALUE_THROW_BAD_VARIANT_ACCESS();
2229
0
}
2230
2231
0
StructValue Value::GetStruct() && {
2232
0
  ABSL_DCHECK(IsStruct()) << *this;
2233
0
  if (auto* alternative = variant_.As<common_internal::LegacyStructValue>();
2234
0
      alternative != nullptr) {
2235
0
    return std::move(*alternative);
2236
0
  }
2237
0
  if (auto* alternative = variant_.As<CustomStructValue>();
2238
0
      alternative != nullptr) {
2239
0
    return std::move(*alternative);
2240
0
  }
2241
0
  if (auto* alternative = variant_.As<ParsedMessageValue>();
2242
0
      alternative != nullptr) {
2243
0
    return std::move(*alternative);
2244
0
  }
2245
0
  CEL_VALUE_THROW_BAD_VARIANT_ACCESS();
2246
0
}
2247
2248
namespace {
2249
2250
class EmptyValueIterator final : public ValueIterator {
2251
 public:
2252
595
  bool HasNext() override { return false; }
2253
2254
  absl::Status Next(const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
2255
                    google::protobuf::MessageFactory* absl_nonnull message_factory,
2256
                    google::protobuf::Arena* absl_nonnull arena,
2257
0
                    Value* absl_nonnull result) override {
2258
0
    ABSL_DCHECK(descriptor_pool != nullptr);
2259
0
    ABSL_DCHECK(message_factory != nullptr);
2260
0
    ABSL_DCHECK(arena != nullptr);
2261
0
    ABSL_DCHECK(result != nullptr);
2262
2263
0
    return absl::FailedPreconditionError(
2264
0
        "`ValueIterator::Next` called after `ValueIterator::HasNext` returned "
2265
0
        "false");
2266
0
  }
2267
2268
  absl::StatusOr<bool> Next1(
2269
      const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
2270
      google::protobuf::MessageFactory* absl_nonnull message_factory,
2271
      google::protobuf::Arena* absl_nonnull arena,
2272
152
      Value* absl_nonnull key_or_value) override {
2273
152
    ABSL_DCHECK(descriptor_pool != nullptr);
2274
152
    ABSL_DCHECK(message_factory != nullptr);
2275
152
    ABSL_DCHECK(arena != nullptr);
2276
152
    ABSL_DCHECK(key_or_value != nullptr);
2277
2278
152
    return false;
2279
152
  }
2280
2281
  absl::StatusOr<bool> Next2(
2282
      const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
2283
      google::protobuf::MessageFactory* absl_nonnull message_factory,
2284
      google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull key,
2285
0
      Value* absl_nullable value) override {
2286
0
    ABSL_DCHECK(descriptor_pool != nullptr);
2287
0
    ABSL_DCHECK(message_factory != nullptr);
2288
0
    ABSL_DCHECK(arena != nullptr);
2289
0
    ABSL_DCHECK(key != nullptr);
2290
2291
0
    return false;
2292
0
  }
2293
};
2294
2295
}  // namespace
2296
2297
6.28k
absl_nonnull std::unique_ptr<ValueIterator> NewEmptyValueIterator() {
2298
6.28k
  return std::make_unique<EmptyValueIterator>();
2299
6.28k
}
2300
2301
absl_nonnull ListValueBuilderPtr
2302
95.7k
NewListValueBuilder(google::protobuf::Arena* absl_nonnull arena) {
2303
95.7k
  ABSL_DCHECK(arena != nullptr);
2304
95.7k
  return common_internal::NewListValueBuilder(arena);
2305
95.7k
}
2306
2307
absl_nonnull MapValueBuilderPtr
2308
0
NewMapValueBuilder(google::protobuf::Arena* absl_nonnull arena) {
2309
0
  ABSL_DCHECK(arena != nullptr);
2310
0
  return common_internal::NewMapValueBuilder(arena);
2311
0
}
2312
2313
absl_nullable StructValueBuilderPtr NewStructValueBuilder(
2314
    google::protobuf::Arena* absl_nonnull arena,
2315
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
2316
    google::protobuf::MessageFactory* absl_nonnull message_factory,
2317
0
    absl::string_view name) {
2318
0
  ABSL_DCHECK(arena != nullptr);
2319
0
  ABSL_DCHECK(descriptor_pool != nullptr);
2320
0
  ABSL_DCHECK(message_factory != nullptr);
2321
0
  return common_internal::NewStructValueBuilder(arena, descriptor_pool,
2322
0
                                                message_factory, name);
2323
0
}
2324
2325
0
bool operator==(IntValue lhs, UintValue rhs) {
2326
0
  return internal::Number::FromInt64(lhs.NativeValue()) ==
2327
0
         internal::Number::FromUint64(rhs.NativeValue());
2328
0
}
2329
2330
0
bool operator==(UintValue lhs, IntValue rhs) {
2331
0
  return internal::Number::FromUint64(lhs.NativeValue()) ==
2332
0
         internal::Number::FromInt64(rhs.NativeValue());
2333
0
}
2334
2335
0
bool operator==(IntValue lhs, DoubleValue rhs) {
2336
0
  return internal::Number::FromInt64(lhs.NativeValue()) ==
2337
0
         internal::Number::FromDouble(rhs.NativeValue());
2338
0
}
2339
2340
0
bool operator==(DoubleValue lhs, IntValue rhs) {
2341
0
  return internal::Number::FromDouble(lhs.NativeValue()) ==
2342
0
         internal::Number::FromInt64(rhs.NativeValue());
2343
0
}
2344
2345
0
bool operator==(UintValue lhs, DoubleValue rhs) {
2346
0
  return internal::Number::FromUint64(lhs.NativeValue()) ==
2347
0
         internal::Number::FromDouble(rhs.NativeValue());
2348
0
}
2349
2350
0
bool operator==(DoubleValue lhs, UintValue rhs) {
2351
0
  return internal::Number::FromDouble(lhs.NativeValue()) ==
2352
0
         internal::Number::FromUint64(rhs.NativeValue());
2353
0
}
2354
2355
absl::StatusOr<bool> ValueIterator::Next1(
2356
    const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
2357
    google::protobuf::MessageFactory* absl_nonnull message_factory,
2358
0
    google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull value) {
2359
0
  ABSL_DCHECK(descriptor_pool != nullptr);
2360
0
  ABSL_DCHECK(message_factory != nullptr);
2361
0
  ABSL_DCHECK(arena != nullptr);
2362
0
  ABSL_DCHECK(value != nullptr);
2363
2364
0
  if (HasNext()) {
2365
0
    CEL_RETURN_IF_ERROR(Next(descriptor_pool, message_factory, arena, value));
2366
0
    return true;
2367
0
  }
2368
0
  return false;
2369
0
}
2370
2371
466
StringValue::StringValue(const BytesValue& other) : StringValue(other.value_) {
2372
466
  ABSL_DCHECK(value_.Visit(absl::Overload(
2373
466
      [](absl::string_view string) -> bool {
2374
466
        return internal::Utf8IsValid(string);
2375
466
      },
2376
466
      [](const absl::Cord& cord) -> bool {
2377
466
        return internal::Utf8IsValid(cord);
2378
466
      })));
2379
466
}
2380
2381
}  // namespace cel