Coverage Report

Created: 2025-12-05 06:14

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/sentencepiece/third_party/protobuf-lite/generated_message_util.cc
Line
Count
Source
1
// Protocol Buffers - Google's data interchange format
2
// Copyright 2008 Google Inc.  All rights reserved.
3
// https://developers.google.com/protocol-buffers/
4
//
5
// Redistribution and use in source and binary forms, with or without
6
// modification, are permitted provided that the following conditions are
7
// met:
8
//
9
//     * Redistributions of source code must retain the above copyright
10
// notice, this list of conditions and the following disclaimer.
11
//     * Redistributions in binary form must reproduce the above
12
// copyright notice, this list of conditions and the following disclaimer
13
// in the documentation and/or other materials provided with the
14
// distribution.
15
//     * Neither the name of Google Inc. nor the names of its
16
// contributors may be used to endorse or promote products derived from
17
// this software without specific prior written permission.
18
//
19
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
31
// Author: kenton@google.com (Kenton Varda)
32
//  Based on original Protocol Buffers design by
33
//  Sanjay Ghemawat, Jeff Dean, and others.
34
35
#include <google/protobuf/generated_message_util.h>
36
37
#include <limits>
38
39
#ifndef GOOGLE_PROTOBUF_SUPPORT_WINDOWS_XP
40
// We're only using this as a standard way for getting the thread id.
41
// We're not using any thread functionality.
42
#include <thread>  // NOLINT
43
#endif             // #ifndef GOOGLE_PROTOBUF_SUPPORT_WINDOWS_XP
44
45
#include <vector>
46
47
#include <google/protobuf/io/coded_stream.h>
48
#include <google/protobuf/io/zero_copy_stream_impl_lite.h>
49
#include <google/protobuf/arenastring.h>
50
#include <google/protobuf/extension_set.h>
51
#include <google/protobuf/generated_message_table_driven.h>
52
#include <google/protobuf/message_lite.h>
53
#include <google/protobuf/metadata_lite.h>
54
#include <google/protobuf/stubs/mutex.h>
55
#include <google/protobuf/port_def.inc>
56
#include <google/protobuf/repeated_field.h>
57
#include <google/protobuf/wire_format_lite.h>
58
59
60
namespace google {
61
namespace protobuf {
62
namespace internal {
63
64
0
void DestroyMessage(const void* message) {
65
0
  static_cast<const MessageLite*>(message)->~MessageLite();
66
0
}
67
0
void DestroyString(const void* s) {
68
0
  static_cast<const std::string*>(s)->~basic_string();
69
0
}
70
71
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT EmptyString
72
    fixed_address_empty_string;  // NOLINT
73
74
75
PROTOBUF_CONSTINIT std::atomic<bool> init_protobuf_defaults_state{false};
76
1
static bool InitProtobufDefaultsImpl() {
77
1
  ::new (static_cast<void*>(&fixed_address_empty_string.value)) std::string();
78
1
  OnShutdownDestroyString(&fixed_address_empty_string.value);
79
80
  // Verify that we can indeed get the address during constant evaluation.
81
1
  PROTOBUF_CONSTINIT static const std::string& fixed_address_empty_string_test =
82
1
      GetEmptyStringAlreadyInited();
83
1
  (void)fixed_address_empty_string_test;
84
85
1
  init_protobuf_defaults_state.store(true, std::memory_order_release);
86
1
  return true;
87
1
}
88
89
1
void InitProtobufDefaultsSlow() {
90
1
  static bool is_inited = InitProtobufDefaultsImpl();
91
1
  (void)is_inited;
92
1
}
93
94
0
size_t StringSpaceUsedExcludingSelfLong(const std::string& str) {
95
0
  const void* start = &str;
96
0
  const void* end = &str + 1;
97
0
  if (start <= str.data() && str.data() < end) {
98
    // The string's data is stored inside the string object itself.
99
0
    return 0;
100
0
  } else {
101
0
    return str.capacity();
102
0
  }
103
0
}
104
105
template <typename T>
106
0
const T& Get(const void* ptr) {
107
0
  return *static_cast<const T*>(ptr);
108
0
}
Unexecuted instantiation: google::protobuf::MessageLite const* const& google::protobuf::internal::Get<google::protobuf::MessageLite const*>(void const*)
Unexecuted instantiation: unsigned int const& google::protobuf::internal::Get<unsigned int>(void const*)
Unexecuted instantiation: unsigned long const& google::protobuf::internal::Get<unsigned long>(void const*)
Unexecuted instantiation: google::protobuf::RepeatedField<double> const& google::protobuf::internal::Get<google::protobuf::RepeatedField<double> >(void const*)
Unexecuted instantiation: int const& google::protobuf::internal::Get<int>(void const*)
Unexecuted instantiation: google::protobuf::RepeatedField<float> const& google::protobuf::internal::Get<google::protobuf::RepeatedField<float> >(void const*)
Unexecuted instantiation: long const& google::protobuf::internal::Get<long>(void const*)
Unexecuted instantiation: google::protobuf::RepeatedField<long> const& google::protobuf::internal::Get<google::protobuf::RepeatedField<long> >(void const*)
Unexecuted instantiation: google::protobuf::RepeatedField<unsigned long> const& google::protobuf::internal::Get<google::protobuf::RepeatedField<unsigned long> >(void const*)
Unexecuted instantiation: google::protobuf::RepeatedField<int> const& google::protobuf::internal::Get<google::protobuf::RepeatedField<int> >(void const*)
Unexecuted instantiation: google::protobuf::RepeatedField<unsigned int> const& google::protobuf::internal::Get<google::protobuf::RepeatedField<unsigned int> >(void const*)
Unexecuted instantiation: bool const& google::protobuf::internal::Get<bool>(void const*)
Unexecuted instantiation: google::protobuf::RepeatedField<bool> const& google::protobuf::internal::Get<google::protobuf::RepeatedField<bool> >(void const*)
Unexecuted instantiation: google::protobuf::internal::ArenaStringPtr const& google::protobuf::internal::Get<google::protobuf::internal::ArenaStringPtr>(void const*)
Unexecuted instantiation: google::protobuf::internal::RepeatedPtrFieldBase const& google::protobuf::internal::Get<google::protobuf::internal::RepeatedPtrFieldBase>(void const*)
109
110
// PrimitiveTypeHelper is a wrapper around the interface of WireFormatLite.
111
// WireFormatLite has a very inconvenient interface with respect to template
112
// meta-programming. This class wraps the different named functions into
113
// a single Serialize / SerializeToArray interface.
114
template <int type>
115
struct PrimitiveTypeHelper;
116
117
template <>
118
struct PrimitiveTypeHelper<WireFormatLite::TYPE_BOOL> {
119
  typedef bool Type;
120
0
  static void Serialize(const void* ptr, io::CodedOutputStream* output) {
121
0
    WireFormatLite::WriteBoolNoTag(Get<bool>(ptr), output);
122
0
  }
123
0
  static uint8* SerializeToArray(const void* ptr, uint8* buffer) {
124
0
    return WireFormatLite::WriteBoolNoTagToArray(Get<Type>(ptr), buffer);
125
0
  }
126
};
127
128
template <>
129
struct PrimitiveTypeHelper<WireFormatLite::TYPE_INT32> {
130
  typedef int32 Type;
131
0
  static void Serialize(const void* ptr, io::CodedOutputStream* output) {
132
0
    WireFormatLite::WriteInt32NoTag(Get<int32>(ptr), output);
133
0
  }
134
0
  static uint8* SerializeToArray(const void* ptr, uint8* buffer) {
135
0
    return WireFormatLite::WriteInt32NoTagToArray(Get<Type>(ptr), buffer);
136
0
  }
137
};
138
139
template <>
140
struct PrimitiveTypeHelper<WireFormatLite::TYPE_SINT32> {
141
  typedef int32 Type;
142
0
  static void Serialize(const void* ptr, io::CodedOutputStream* output) {
143
0
    WireFormatLite::WriteSInt32NoTag(Get<int32>(ptr), output);
144
0
  }
145
0
  static uint8* SerializeToArray(const void* ptr, uint8* buffer) {
146
0
    return WireFormatLite::WriteSInt32NoTagToArray(Get<Type>(ptr), buffer);
147
0
  }
148
};
149
150
template <>
151
struct PrimitiveTypeHelper<WireFormatLite::TYPE_UINT32> {
152
  typedef uint32 Type;
153
0
  static void Serialize(const void* ptr, io::CodedOutputStream* output) {
154
0
    WireFormatLite::WriteUInt32NoTag(Get<uint32>(ptr), output);
155
0
  }
156
0
  static uint8* SerializeToArray(const void* ptr, uint8* buffer) {
157
0
    return WireFormatLite::WriteUInt32NoTagToArray(Get<Type>(ptr), buffer);
158
0
  }
159
};
160
template <>
161
struct PrimitiveTypeHelper<WireFormatLite::TYPE_INT64> {
162
  typedef int64 Type;
163
0
  static void Serialize(const void* ptr, io::CodedOutputStream* output) {
164
0
    WireFormatLite::WriteInt64NoTag(Get<int64>(ptr), output);
165
0
  }
166
0
  static uint8* SerializeToArray(const void* ptr, uint8* buffer) {
167
0
    return WireFormatLite::WriteInt64NoTagToArray(Get<Type>(ptr), buffer);
168
0
  }
169
};
170
171
template <>
172
struct PrimitiveTypeHelper<WireFormatLite::TYPE_SINT64> {
173
  typedef int64 Type;
174
0
  static void Serialize(const void* ptr, io::CodedOutputStream* output) {
175
0
    WireFormatLite::WriteSInt64NoTag(Get<int64>(ptr), output);
176
0
  }
177
0
  static uint8* SerializeToArray(const void* ptr, uint8* buffer) {
178
0
    return WireFormatLite::WriteSInt64NoTagToArray(Get<Type>(ptr), buffer);
179
0
  }
180
};
181
template <>
182
struct PrimitiveTypeHelper<WireFormatLite::TYPE_UINT64> {
183
  typedef uint64 Type;
184
0
  static void Serialize(const void* ptr, io::CodedOutputStream* output) {
185
0
    WireFormatLite::WriteUInt64NoTag(Get<uint64>(ptr), output);
186
0
  }
187
0
  static uint8* SerializeToArray(const void* ptr, uint8* buffer) {
188
0
    return WireFormatLite::WriteUInt64NoTagToArray(Get<Type>(ptr), buffer);
189
0
  }
190
};
191
192
template <>
193
struct PrimitiveTypeHelper<WireFormatLite::TYPE_FIXED32> {
194
  typedef uint32 Type;
195
0
  static void Serialize(const void* ptr, io::CodedOutputStream* output) {
196
0
    WireFormatLite::WriteFixed32NoTag(Get<uint32>(ptr), output);
197
0
  }
198
0
  static uint8* SerializeToArray(const void* ptr, uint8* buffer) {
199
0
    return WireFormatLite::WriteFixed32NoTagToArray(Get<Type>(ptr), buffer);
200
0
  }
201
};
202
203
template <>
204
struct PrimitiveTypeHelper<WireFormatLite::TYPE_FIXED64> {
205
  typedef uint64 Type;
206
0
  static void Serialize(const void* ptr, io::CodedOutputStream* output) {
207
0
    WireFormatLite::WriteFixed64NoTag(Get<uint64>(ptr), output);
208
0
  }
209
0
  static uint8* SerializeToArray(const void* ptr, uint8* buffer) {
210
0
    return WireFormatLite::WriteFixed64NoTagToArray(Get<Type>(ptr), buffer);
211
0
  }
212
};
213
214
template <>
215
struct PrimitiveTypeHelper<WireFormatLite::TYPE_ENUM>
216
    : PrimitiveTypeHelper<WireFormatLite::TYPE_INT32> {};
217
218
template <>
219
struct PrimitiveTypeHelper<WireFormatLite::TYPE_SFIXED32>
220
    : PrimitiveTypeHelper<WireFormatLite::TYPE_FIXED32> {
221
  typedef int32 Type;
222
};
223
template <>
224
struct PrimitiveTypeHelper<WireFormatLite::TYPE_SFIXED64>
225
    : PrimitiveTypeHelper<WireFormatLite::TYPE_FIXED64> {
226
  typedef int64 Type;
227
};
228
template <>
229
struct PrimitiveTypeHelper<WireFormatLite::TYPE_FLOAT>
230
    : PrimitiveTypeHelper<WireFormatLite::TYPE_FIXED32> {
231
  typedef float Type;
232
};
233
template <>
234
struct PrimitiveTypeHelper<WireFormatLite::TYPE_DOUBLE>
235
    : PrimitiveTypeHelper<WireFormatLite::TYPE_FIXED64> {
236
  typedef double Type;
237
};
238
239
template <>
240
struct PrimitiveTypeHelper<WireFormatLite::TYPE_STRING> {
241
  typedef std::string Type;
242
0
  static void Serialize(const void* ptr, io::CodedOutputStream* output) {
243
0
    const Type& value = *static_cast<const Type*>(ptr);
244
0
    output->WriteVarint32(value.size());
245
0
    output->WriteRawMaybeAliased(value.data(), value.size());
246
0
  }
247
0
  static uint8* SerializeToArray(const void* ptr, uint8* buffer) {
248
0
    const Type& value = *static_cast<const Type*>(ptr);
249
0
    return io::CodedOutputStream::WriteStringWithSizeToArray(value, buffer);
250
0
  }
251
};
252
253
template <>
254
struct PrimitiveTypeHelper<WireFormatLite::TYPE_BYTES>
255
    : PrimitiveTypeHelper<WireFormatLite::TYPE_STRING> {};
256
257
258
// We want to serialize to both CodedOutputStream and directly into byte arrays
259
// without duplicating the code. In fact we might want extra output channels in
260
// the future.
261
template <typename O, int type>
262
struct OutputHelper;
263
264
template <int type, typename O>
265
0
void SerializeTo(const void* ptr, O* output) {
266
0
  OutputHelper<O, type>::Serialize(ptr, output);
267
0
}
Unexecuted instantiation: void google::protobuf::internal::SerializeTo<13, google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::SerializeTo<1, google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::SerializeTo<2, google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::SerializeTo<3, google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::SerializeTo<4, google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::SerializeTo<5, google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::SerializeTo<6, google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::SerializeTo<7, google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::SerializeTo<8, google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::SerializeTo<9, google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::SerializeTo<14, google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::SerializeTo<15, google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::SerializeTo<16, google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::SerializeTo<17, google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::SerializeTo<18, google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::SerializeTo<13, google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::SerializeTo<1, google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::SerializeTo<2, google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::SerializeTo<3, google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::SerializeTo<4, google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::SerializeTo<5, google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::SerializeTo<6, google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::SerializeTo<7, google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::SerializeTo<8, google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::SerializeTo<9, google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::SerializeTo<14, google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::SerializeTo<15, google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::SerializeTo<16, google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::SerializeTo<17, google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::SerializeTo<18, google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::ArrayOutput*)
268
269
template <typename O>
270
0
void WriteTagTo(uint32 tag, O* output) {
271
0
  SerializeTo<WireFormatLite::TYPE_UINT32>(&tag, output);
272
0
}
Unexecuted instantiation: void google::protobuf::internal::WriteTagTo<google::protobuf::io::CodedOutputStream>(unsigned int, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::WriteTagTo<google::protobuf::internal::ArrayOutput>(unsigned int, google::protobuf::internal::ArrayOutput*)
273
274
template <typename O>
275
0
void WriteLengthTo(uint32 length, O* output) {
276
0
  SerializeTo<WireFormatLite::TYPE_UINT32>(&length, output);
277
0
}
Unexecuted instantiation: void google::protobuf::internal::WriteLengthTo<google::protobuf::io::CodedOutputStream>(unsigned int, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::WriteLengthTo<google::protobuf::internal::ArrayOutput>(unsigned int, google::protobuf::internal::ArrayOutput*)
278
279
// Specialization for coded output stream
280
template <int type>
281
struct OutputHelper<io::CodedOutputStream, type> {
282
0
  static void Serialize(const void* ptr, io::CodedOutputStream* output) {
283
0
    PrimitiveTypeHelper<type>::Serialize(ptr, output);
284
0
  }
Unexecuted instantiation: google::protobuf::internal::OutputHelper<google::protobuf::io::CodedOutputStream, 13>::Serialize(void const*, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: google::protobuf::internal::OutputHelper<google::protobuf::io::CodedOutputStream, 1>::Serialize(void const*, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: google::protobuf::internal::OutputHelper<google::protobuf::io::CodedOutputStream, 2>::Serialize(void const*, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: google::protobuf::internal::OutputHelper<google::protobuf::io::CodedOutputStream, 3>::Serialize(void const*, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: google::protobuf::internal::OutputHelper<google::protobuf::io::CodedOutputStream, 4>::Serialize(void const*, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: google::protobuf::internal::OutputHelper<google::protobuf::io::CodedOutputStream, 5>::Serialize(void const*, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: google::protobuf::internal::OutputHelper<google::protobuf::io::CodedOutputStream, 6>::Serialize(void const*, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: google::protobuf::internal::OutputHelper<google::protobuf::io::CodedOutputStream, 7>::Serialize(void const*, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: google::protobuf::internal::OutputHelper<google::protobuf::io::CodedOutputStream, 8>::Serialize(void const*, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: google::protobuf::internal::OutputHelper<google::protobuf::io::CodedOutputStream, 9>::Serialize(void const*, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: google::protobuf::internal::OutputHelper<google::protobuf::io::CodedOutputStream, 14>::Serialize(void const*, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: google::protobuf::internal::OutputHelper<google::protobuf::io::CodedOutputStream, 15>::Serialize(void const*, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: google::protobuf::internal::OutputHelper<google::protobuf::io::CodedOutputStream, 16>::Serialize(void const*, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: google::protobuf::internal::OutputHelper<google::protobuf::io::CodedOutputStream, 17>::Serialize(void const*, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: google::protobuf::internal::OutputHelper<google::protobuf::io::CodedOutputStream, 18>::Serialize(void const*, google::protobuf::io::CodedOutputStream*)
285
};
286
287
// Specialization for writing into a plain array
288
struct ArrayOutput {
289
  uint8* ptr;
290
  bool is_deterministic;
291
};
292
293
template <int type>
294
struct OutputHelper<ArrayOutput, type> {
295
0
  static void Serialize(const void* ptr, ArrayOutput* output) {
296
0
    output->ptr = PrimitiveTypeHelper<type>::SerializeToArray(ptr, output->ptr);
297
0
  }
Unexecuted instantiation: google::protobuf::internal::OutputHelper<google::protobuf::internal::ArrayOutput, 13>::Serialize(void const*, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: google::protobuf::internal::OutputHelper<google::protobuf::internal::ArrayOutput, 1>::Serialize(void const*, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: google::protobuf::internal::OutputHelper<google::protobuf::internal::ArrayOutput, 2>::Serialize(void const*, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: google::protobuf::internal::OutputHelper<google::protobuf::internal::ArrayOutput, 3>::Serialize(void const*, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: google::protobuf::internal::OutputHelper<google::protobuf::internal::ArrayOutput, 4>::Serialize(void const*, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: google::protobuf::internal::OutputHelper<google::protobuf::internal::ArrayOutput, 5>::Serialize(void const*, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: google::protobuf::internal::OutputHelper<google::protobuf::internal::ArrayOutput, 6>::Serialize(void const*, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: google::protobuf::internal::OutputHelper<google::protobuf::internal::ArrayOutput, 7>::Serialize(void const*, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: google::protobuf::internal::OutputHelper<google::protobuf::internal::ArrayOutput, 8>::Serialize(void const*, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: google::protobuf::internal::OutputHelper<google::protobuf::internal::ArrayOutput, 9>::Serialize(void const*, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: google::protobuf::internal::OutputHelper<google::protobuf::internal::ArrayOutput, 14>::Serialize(void const*, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: google::protobuf::internal::OutputHelper<google::protobuf::internal::ArrayOutput, 15>::Serialize(void const*, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: google::protobuf::internal::OutputHelper<google::protobuf::internal::ArrayOutput, 16>::Serialize(void const*, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: google::protobuf::internal::OutputHelper<google::protobuf::internal::ArrayOutput, 17>::Serialize(void const*, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: google::protobuf::internal::OutputHelper<google::protobuf::internal::ArrayOutput, 18>::Serialize(void const*, google::protobuf::internal::ArrayOutput*)
298
};
299
300
void SerializeMessageNoTable(const MessageLite* msg,
301
0
                             io::CodedOutputStream* output) {
302
0
  msg->SerializeWithCachedSizes(output);
303
0
}
304
305
0
void SerializeMessageNoTable(const MessageLite* msg, ArrayOutput* output) {
306
0
  io::ArrayOutputStream array_stream(output->ptr, INT_MAX);
307
0
  io::CodedOutputStream o(&array_stream);
308
0
  o.SetSerializationDeterministic(output->is_deterministic);
309
0
  msg->SerializeWithCachedSizes(&o);
310
0
  output->ptr += o.ByteCount();
311
0
}
312
313
// Helper to branch to fast path if possible
314
void SerializeMessageDispatch(const MessageLite& msg,
315
                              const FieldMetadata* field_table, int num_fields,
316
                              int32 cached_size,
317
0
                              io::CodedOutputStream* output) {
318
0
  const uint8* base = reinterpret_cast<const uint8*>(&msg);
319
0
  SerializeInternal(base, field_table, num_fields, output);
320
0
}
321
322
// Helper to branch to fast path if possible
323
void SerializeMessageDispatch(const MessageLite& msg,
324
                              const FieldMetadata* field_table, int num_fields,
325
0
                              int32 cached_size, ArrayOutput* output) {
326
0
  const uint8* base = reinterpret_cast<const uint8*>(&msg);
327
0
  output->ptr = SerializeInternalToArray(base, field_table, num_fields,
328
0
                                         output->is_deterministic, output->ptr);
329
0
}
330
331
// Serializing messages is special as it's not a primitive type and needs an
332
// explicit overload for each output type.
333
template <typename O>
334
void SerializeMessageTo(const MessageLite* msg, const void* table_ptr,
335
0
                        O* output) {
336
0
  const SerializationTable* table =
337
0
      static_cast<const SerializationTable*>(table_ptr);
338
0
  if (!table) {
339
    // Proto1
340
0
    WriteLengthTo(msg->GetCachedSize(), output);
341
0
    SerializeMessageNoTable(msg, output);
342
0
    return;
343
0
  }
344
0
  const FieldMetadata* field_table = table->field_table;
345
0
  const uint8* base = reinterpret_cast<const uint8*>(msg);
346
0
  int cached_size = *reinterpret_cast<const int32*>(base + field_table->offset);
347
0
  WriteLengthTo(cached_size, output);
348
0
  int num_fields = table->num_fields - 1;
349
0
  SerializeMessageDispatch(*msg, field_table + 1, num_fields, cached_size,
350
0
                           output);
351
0
}
Unexecuted instantiation: void google::protobuf::internal::SerializeMessageTo<google::protobuf::io::CodedOutputStream>(google::protobuf::MessageLite const*, void const*, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::SerializeMessageTo<google::protobuf::internal::ArrayOutput>(google::protobuf::MessageLite const*, void const*, google::protobuf::internal::ArrayOutput*)
352
353
// Almost the same as above only it doesn't output the length field.
354
template <typename O>
355
void SerializeGroupTo(const MessageLite* msg, const void* table_ptr,
356
0
                      O* output) {
357
0
  const SerializationTable* table =
358
0
      static_cast<const SerializationTable*>(table_ptr);
359
0
  if (!table) {
360
    // Proto1
361
0
    SerializeMessageNoTable(msg, output);
362
0
    return;
363
0
  }
364
0
  const FieldMetadata* field_table = table->field_table;
365
0
  const uint8* base = reinterpret_cast<const uint8*>(msg);
366
0
  int cached_size = *reinterpret_cast<const int32*>(base + field_table->offset);
367
0
  int num_fields = table->num_fields - 1;
368
0
  SerializeMessageDispatch(*msg, field_table + 1, num_fields, cached_size,
369
0
                           output);
370
0
}
Unexecuted instantiation: void google::protobuf::internal::SerializeGroupTo<google::protobuf::io::CodedOutputStream>(google::protobuf::MessageLite const*, void const*, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::SerializeGroupTo<google::protobuf::internal::ArrayOutput>(google::protobuf::MessageLite const*, void const*, google::protobuf::internal::ArrayOutput*)
371
372
template <int type>
373
struct SingularFieldHelper {
374
  template <typename O>
375
0
  static void Serialize(const void* field, const FieldMetadata& md, O* output) {
376
0
    WriteTagTo(md.tag, output);
377
0
    SerializeTo<type>(field, output);
378
0
  }
Unexecuted instantiation: void google::protobuf::internal::SingularFieldHelper<1>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::SingularFieldHelper<2>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::SingularFieldHelper<3>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::SingularFieldHelper<4>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::SingularFieldHelper<5>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::SingularFieldHelper<6>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::SingularFieldHelper<7>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::SingularFieldHelper<8>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::SingularFieldHelper<13>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::SingularFieldHelper<14>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::SingularFieldHelper<15>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::SingularFieldHelper<16>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::SingularFieldHelper<17>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::SingularFieldHelper<18>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::SingularFieldHelper<1>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::SingularFieldHelper<2>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::SingularFieldHelper<3>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::SingularFieldHelper<4>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::SingularFieldHelper<5>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::SingularFieldHelper<6>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::SingularFieldHelper<7>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::SingularFieldHelper<8>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::SingularFieldHelper<13>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::SingularFieldHelper<14>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::SingularFieldHelper<15>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::SingularFieldHelper<16>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::SingularFieldHelper<17>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::SingularFieldHelper<18>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
379
};
380
381
template <>
382
struct SingularFieldHelper<WireFormatLite::TYPE_STRING> {
383
  template <typename O>
384
0
  static void Serialize(const void* field, const FieldMetadata& md, O* output) {
385
0
    WriteTagTo(md.tag, output);
386
0
    SerializeTo<WireFormatLite::TYPE_STRING>(&Get<ArenaStringPtr>(field).Get(),
387
0
                                             output);
388
0
  }
Unexecuted instantiation: void google::protobuf::internal::SingularFieldHelper<9>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::SingularFieldHelper<9>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
389
};
390
391
template <>
392
struct SingularFieldHelper<WireFormatLite::TYPE_BYTES>
393
    : SingularFieldHelper<WireFormatLite::TYPE_STRING> {};
394
395
template <>
396
struct SingularFieldHelper<WireFormatLite::TYPE_GROUP> {
397
  template <typename O>
398
0
  static void Serialize(const void* field, const FieldMetadata& md, O* output) {
399
0
    WriteTagTo(md.tag, output);
400
0
    SerializeGroupTo(Get<const MessageLite*>(field),
401
0
                     static_cast<const SerializationTable*>(md.ptr), output);
402
0
    WriteTagTo(md.tag + 1, output);
403
0
  }
Unexecuted instantiation: void google::protobuf::internal::SingularFieldHelper<10>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::SingularFieldHelper<10>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
404
};
405
406
template <>
407
struct SingularFieldHelper<WireFormatLite::TYPE_MESSAGE> {
408
  template <typename O>
409
0
  static void Serialize(const void* field, const FieldMetadata& md, O* output) {
410
0
    WriteTagTo(md.tag, output);
411
0
    SerializeMessageTo(Get<const MessageLite*>(field),
412
0
                       static_cast<const SerializationTable*>(md.ptr), output);
413
0
  }
Unexecuted instantiation: void google::protobuf::internal::SingularFieldHelper<11>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::SingularFieldHelper<11>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
414
};
415
416
template <int type>
417
struct RepeatedFieldHelper {
418
  template <typename O>
419
0
  static void Serialize(const void* field, const FieldMetadata& md, O* output) {
420
0
    typedef typename PrimitiveTypeHelper<type>::Type T;
421
0
    const RepeatedField<T>& array = Get<RepeatedField<T> >(field);
422
0
    for (int i = 0; i < array.size(); i++) {
423
0
      WriteTagTo(md.tag, output);
424
0
      SerializeTo<type>(&array[i], output);
425
0
    }
426
0
  }
Unexecuted instantiation: void google::protobuf::internal::RepeatedFieldHelper<1>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::RepeatedFieldHelper<2>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::RepeatedFieldHelper<3>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::RepeatedFieldHelper<4>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::RepeatedFieldHelper<5>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::RepeatedFieldHelper<6>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::RepeatedFieldHelper<7>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::RepeatedFieldHelper<8>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::RepeatedFieldHelper<13>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::RepeatedFieldHelper<14>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::RepeatedFieldHelper<15>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::RepeatedFieldHelper<16>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::RepeatedFieldHelper<17>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::RepeatedFieldHelper<18>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::RepeatedFieldHelper<1>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::RepeatedFieldHelper<2>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::RepeatedFieldHelper<3>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::RepeatedFieldHelper<4>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::RepeatedFieldHelper<5>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::RepeatedFieldHelper<6>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::RepeatedFieldHelper<7>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::RepeatedFieldHelper<8>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::RepeatedFieldHelper<13>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::RepeatedFieldHelper<14>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::RepeatedFieldHelper<15>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::RepeatedFieldHelper<16>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::RepeatedFieldHelper<17>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::RepeatedFieldHelper<18>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
427
};
428
429
// We need to use a helper class to get access to the private members
430
class AccessorHelper {
431
 public:
432
0
  static int Size(const RepeatedPtrFieldBase& x) { return x.size(); }
433
0
  static void const* Get(const RepeatedPtrFieldBase& x, int idx) {
434
0
    return x.raw_data()[idx];
435
0
  }
436
};
437
438
template <>
439
struct RepeatedFieldHelper<WireFormatLite::TYPE_STRING> {
440
  template <typename O>
441
0
  static void Serialize(const void* field, const FieldMetadata& md, O* output) {
442
0
    const internal::RepeatedPtrFieldBase& array =
443
0
        Get<internal::RepeatedPtrFieldBase>(field);
444
0
    for (int i = 0; i < AccessorHelper::Size(array); i++) {
445
0
      WriteTagTo(md.tag, output);
446
0
      SerializeTo<WireFormatLite::TYPE_STRING>(AccessorHelper::Get(array, i),
447
0
                                               output);
448
0
    }
449
0
  }
Unexecuted instantiation: void google::protobuf::internal::RepeatedFieldHelper<9>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::RepeatedFieldHelper<9>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
450
};
451
452
template <>
453
struct RepeatedFieldHelper<WireFormatLite::TYPE_BYTES>
454
    : RepeatedFieldHelper<WireFormatLite::TYPE_STRING> {};
455
456
template <>
457
struct RepeatedFieldHelper<WireFormatLite::TYPE_GROUP> {
458
  template <typename O>
459
0
  static void Serialize(const void* field, const FieldMetadata& md, O* output) {
460
0
    const internal::RepeatedPtrFieldBase& array =
461
0
        Get<internal::RepeatedPtrFieldBase>(field);
462
0
    for (int i = 0; i < AccessorHelper::Size(array); i++) {
463
0
      WriteTagTo(md.tag, output);
464
0
      SerializeGroupTo(
465
0
          static_cast<const MessageLite*>(AccessorHelper::Get(array, i)),
466
0
          static_cast<const SerializationTable*>(md.ptr), output);
467
0
      WriteTagTo(md.tag + 1, output);
468
0
    }
469
0
  }
Unexecuted instantiation: void google::protobuf::internal::RepeatedFieldHelper<10>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::RepeatedFieldHelper<10>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
470
};
471
472
template <>
473
struct RepeatedFieldHelper<WireFormatLite::TYPE_MESSAGE> {
474
  template <typename O>
475
0
  static void Serialize(const void* field, const FieldMetadata& md, O* output) {
476
0
    const internal::RepeatedPtrFieldBase& array =
477
0
        Get<internal::RepeatedPtrFieldBase>(field);
478
0
    for (int i = 0; i < AccessorHelper::Size(array); i++) {
479
0
      WriteTagTo(md.tag, output);
480
0
      SerializeMessageTo(
481
0
          static_cast<const MessageLite*>(AccessorHelper::Get(array, i)),
482
0
          md.ptr, output);
483
0
    }
484
0
  }
Unexecuted instantiation: void google::protobuf::internal::RepeatedFieldHelper<11>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::RepeatedFieldHelper<11>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
485
};
486
487
488
template <int type>
489
struct PackedFieldHelper {
490
  template <typename O>
491
0
  static void Serialize(const void* field, const FieldMetadata& md, O* output) {
492
0
    typedef typename PrimitiveTypeHelper<type>::Type T;
493
0
    const RepeatedField<T>& array = Get<RepeatedField<T> >(field);
494
0
    if (array.empty()) return;
495
0
    WriteTagTo(md.tag, output);
496
0
    int cached_size =
497
0
        Get<int>(static_cast<const uint8*>(field) + sizeof(RepeatedField<T>));
498
0
    WriteLengthTo(cached_size, output);
499
0
    for (int i = 0; i < array.size(); i++) {
500
0
      SerializeTo<type>(&array[i], output);
501
0
    }
502
0
  }
Unexecuted instantiation: void google::protobuf::internal::PackedFieldHelper<1>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::PackedFieldHelper<2>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::PackedFieldHelper<3>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::PackedFieldHelper<4>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::PackedFieldHelper<5>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::PackedFieldHelper<6>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::PackedFieldHelper<7>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::PackedFieldHelper<8>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::PackedFieldHelper<13>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::PackedFieldHelper<14>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::PackedFieldHelper<15>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::PackedFieldHelper<16>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::PackedFieldHelper<17>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::PackedFieldHelper<18>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::PackedFieldHelper<1>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::PackedFieldHelper<2>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::PackedFieldHelper<3>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::PackedFieldHelper<4>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::PackedFieldHelper<5>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::PackedFieldHelper<6>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::PackedFieldHelper<7>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::PackedFieldHelper<8>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::PackedFieldHelper<13>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::PackedFieldHelper<14>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::PackedFieldHelper<15>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::PackedFieldHelper<16>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::PackedFieldHelper<17>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::PackedFieldHelper<18>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
503
};
504
505
template <>
506
struct PackedFieldHelper<WireFormatLite::TYPE_STRING> {
507
  template <typename O>
508
0
  static void Serialize(const void* field, const FieldMetadata& md, O* output) {
509
0
    GOOGLE_LOG(FATAL) << "Not implemented field number " << md.tag << " with type "
510
0
               << md.type;
511
0
  }
Unexecuted instantiation: void google::protobuf::internal::PackedFieldHelper<9>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::PackedFieldHelper<9>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
512
};
513
514
template <>
515
struct PackedFieldHelper<WireFormatLite::TYPE_BYTES>
516
    : PackedFieldHelper<WireFormatLite::TYPE_STRING> {};
517
template <>
518
struct PackedFieldHelper<WireFormatLite::TYPE_GROUP>
519
    : PackedFieldHelper<WireFormatLite::TYPE_STRING> {};
520
template <>
521
struct PackedFieldHelper<WireFormatLite::TYPE_MESSAGE>
522
    : PackedFieldHelper<WireFormatLite::TYPE_STRING> {};
523
524
template <int type>
525
struct OneOfFieldHelper {
526
  template <typename O>
527
0
  static void Serialize(const void* field, const FieldMetadata& md, O* output) {
528
0
    SingularFieldHelper<type>::Serialize(field, md, output);
529
0
  }
Unexecuted instantiation: void google::protobuf::internal::OneOfFieldHelper<1>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::OneOfFieldHelper<2>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::OneOfFieldHelper<3>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::OneOfFieldHelper<4>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::OneOfFieldHelper<5>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::OneOfFieldHelper<6>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::OneOfFieldHelper<7>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::OneOfFieldHelper<8>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::OneOfFieldHelper<9>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::OneOfFieldHelper<10>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::OneOfFieldHelper<11>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::OneOfFieldHelper<12>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::OneOfFieldHelper<13>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::OneOfFieldHelper<14>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::OneOfFieldHelper<15>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::OneOfFieldHelper<16>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::OneOfFieldHelper<17>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::OneOfFieldHelper<18>::Serialize<google::protobuf::io::CodedOutputStream>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::io::CodedOutputStream*)
Unexecuted instantiation: void google::protobuf::internal::OneOfFieldHelper<1>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::OneOfFieldHelper<2>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::OneOfFieldHelper<3>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::OneOfFieldHelper<4>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::OneOfFieldHelper<5>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::OneOfFieldHelper<6>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::OneOfFieldHelper<7>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::OneOfFieldHelper<8>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::OneOfFieldHelper<9>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::OneOfFieldHelper<10>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::OneOfFieldHelper<11>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::OneOfFieldHelper<12>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::OneOfFieldHelper<13>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::OneOfFieldHelper<14>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::OneOfFieldHelper<15>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::OneOfFieldHelper<16>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::OneOfFieldHelper<17>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
Unexecuted instantiation: void google::protobuf::internal::OneOfFieldHelper<18>::Serialize<google::protobuf::internal::ArrayOutput>(void const*, google::protobuf::internal::FieldMetadata const&, google::protobuf::internal::ArrayOutput*)
530
};
531
532
533
0
void SerializeNotImplemented(int field) {
534
0
  GOOGLE_LOG(FATAL) << "Not implemented field number " << field;
535
0
}
536
537
// When switching to c++11 we should make these constexpr functions
538
#define SERIALIZE_TABLE_OP(type, type_class) \
539
0
  ((type - 1) + static_cast<int>(type_class) * FieldMetadata::kNumTypes)
540
541
int FieldMetadata::CalculateType(int type,
542
0
                                 FieldMetadata::FieldTypeClass type_class) {
543
0
  return SERIALIZE_TABLE_OP(type, type_class);
544
0
}
545
546
template <int type>
547
0
bool IsNull(const void* ptr) {
548
0
  return *static_cast<const typename PrimitiveTypeHelper<type>::Type*>(ptr) ==
549
0
         0;
550
0
}
Unexecuted instantiation: bool google::protobuf::internal::IsNull<1>(void const*)
Unexecuted instantiation: bool google::protobuf::internal::IsNull<2>(void const*)
Unexecuted instantiation: bool google::protobuf::internal::IsNull<3>(void const*)
Unexecuted instantiation: bool google::protobuf::internal::IsNull<4>(void const*)
Unexecuted instantiation: bool google::protobuf::internal::IsNull<5>(void const*)
Unexecuted instantiation: bool google::protobuf::internal::IsNull<6>(void const*)
Unexecuted instantiation: bool google::protobuf::internal::IsNull<7>(void const*)
Unexecuted instantiation: bool google::protobuf::internal::IsNull<8>(void const*)
Unexecuted instantiation: bool google::protobuf::internal::IsNull<13>(void const*)
Unexecuted instantiation: bool google::protobuf::internal::IsNull<14>(void const*)
Unexecuted instantiation: bool google::protobuf::internal::IsNull<15>(void const*)
Unexecuted instantiation: bool google::protobuf::internal::IsNull<16>(void const*)
Unexecuted instantiation: bool google::protobuf::internal::IsNull<17>(void const*)
Unexecuted instantiation: bool google::protobuf::internal::IsNull<18>(void const*)
551
552
template <>
553
0
bool IsNull<WireFormatLite::TYPE_STRING>(const void* ptr) {
554
0
  return static_cast<const ArenaStringPtr*>(ptr)->Get().size() == 0;
555
0
}
556
557
template <>
558
0
bool IsNull<WireFormatLite::TYPE_BYTES>(const void* ptr) {
559
0
  return static_cast<const ArenaStringPtr*>(ptr)->Get().size() == 0;
560
0
}
561
562
template <>
563
0
bool IsNull<WireFormatLite::TYPE_GROUP>(const void* ptr) {
564
0
  return Get<const MessageLite*>(ptr) == NULL;
565
0
}
566
567
template <>
568
0
bool IsNull<WireFormatLite::TYPE_MESSAGE>(const void* ptr) {
569
0
  return Get<const MessageLite*>(ptr) == NULL;
570
0
}
571
572
573
#define SERIALIZERS_FOR_TYPE(type)                                            \
574
0
  case SERIALIZE_TABLE_OP(type, FieldMetadata::kPresence):                    \
575
0
    if (!IsPresent(base, field_metadata.has_offset)) continue;                \
576
0
    SingularFieldHelper<type>::Serialize(ptr, field_metadata, output);        \
577
0
    break;                                                                    \
578
0
  case SERIALIZE_TABLE_OP(type, FieldMetadata::kNoPresence):                  \
579
0
    if (IsNull<type>(ptr)) continue;                                          \
580
0
    SingularFieldHelper<type>::Serialize(ptr, field_metadata, output);        \
581
0
    break;                                                                    \
582
0
  case SERIALIZE_TABLE_OP(type, FieldMetadata::kRepeated):                    \
583
0
    RepeatedFieldHelper<type>::Serialize(ptr, field_metadata, output);        \
584
0
    break;                                                                    \
585
0
  case SERIALIZE_TABLE_OP(type, FieldMetadata::kPacked):                      \
586
0
    PackedFieldHelper<type>::Serialize(ptr, field_metadata, output);          \
587
0
    break;                                                                    \
588
0
  case SERIALIZE_TABLE_OP(type, FieldMetadata::kOneOf):                       \
589
0
    if (!IsOneofPresent(base, field_metadata.has_offset, field_metadata.tag)) \
590
0
      continue;                                                               \
591
0
    OneOfFieldHelper<type>::Serialize(ptr, field_metadata, output);           \
592
0
    break
593
594
void SerializeInternal(const uint8* base,
595
                       const FieldMetadata* field_metadata_table,
596
0
                       int32 num_fields, io::CodedOutputStream* output) {
597
0
  SpecialSerializer func = nullptr;
598
0
  for (int i = 0; i < num_fields; i++) {
599
0
    const FieldMetadata& field_metadata = field_metadata_table[i];
600
0
    const uint8* ptr = base + field_metadata.offset;
601
0
    switch (field_metadata.type) {
602
0
      SERIALIZERS_FOR_TYPE(WireFormatLite::TYPE_DOUBLE);
603
0
      SERIALIZERS_FOR_TYPE(WireFormatLite::TYPE_FLOAT);
604
0
      SERIALIZERS_FOR_TYPE(WireFormatLite::TYPE_INT64);
605
0
      SERIALIZERS_FOR_TYPE(WireFormatLite::TYPE_UINT64);
606
0
      SERIALIZERS_FOR_TYPE(WireFormatLite::TYPE_INT32);
607
0
      SERIALIZERS_FOR_TYPE(WireFormatLite::TYPE_FIXED64);
608
0
      SERIALIZERS_FOR_TYPE(WireFormatLite::TYPE_FIXED32);
609
0
      SERIALIZERS_FOR_TYPE(WireFormatLite::TYPE_BOOL);
610
0
      SERIALIZERS_FOR_TYPE(WireFormatLite::TYPE_STRING);
611
0
      SERIALIZERS_FOR_TYPE(WireFormatLite::TYPE_GROUP);
612
0
      SERIALIZERS_FOR_TYPE(WireFormatLite::TYPE_MESSAGE);
613
0
      SERIALIZERS_FOR_TYPE(WireFormatLite::TYPE_BYTES);
614
0
      SERIALIZERS_FOR_TYPE(WireFormatLite::TYPE_UINT32);
615
0
      SERIALIZERS_FOR_TYPE(WireFormatLite::TYPE_ENUM);
616
0
      SERIALIZERS_FOR_TYPE(WireFormatLite::TYPE_SFIXED32);
617
0
      SERIALIZERS_FOR_TYPE(WireFormatLite::TYPE_SFIXED64);
618
0
      SERIALIZERS_FOR_TYPE(WireFormatLite::TYPE_SINT32);
619
0
      SERIALIZERS_FOR_TYPE(WireFormatLite::TYPE_SINT64);
620
621
      // Special cases
622
0
      case FieldMetadata::kSpecial:
623
0
        func = reinterpret_cast<SpecialSerializer>(
624
0
            const_cast<void*>(field_metadata.ptr));
625
0
        func(base, field_metadata.offset, field_metadata.tag,
626
0
             field_metadata.has_offset, output);
627
0
        break;
628
0
      default:
629
        // __builtin_unreachable()
630
0
        SerializeNotImplemented(field_metadata.type);
631
0
    }
632
0
  }
633
0
}
634
635
uint8* SerializeInternalToArray(const uint8* base,
636
                                const FieldMetadata* field_metadata_table,
637
                                int32 num_fields, bool is_deterministic,
638
0
                                uint8* buffer) {
639
0
  ArrayOutput array_output = {buffer, is_deterministic};
640
0
  ArrayOutput* output = &array_output;
641
0
  SpecialSerializer func = nullptr;
642
0
  for (int i = 0; i < num_fields; i++) {
643
0
    const FieldMetadata& field_metadata = field_metadata_table[i];
644
0
    const uint8* ptr = base + field_metadata.offset;
645
0
    switch (field_metadata.type) {
646
0
      SERIALIZERS_FOR_TYPE(WireFormatLite::TYPE_DOUBLE);
647
0
      SERIALIZERS_FOR_TYPE(WireFormatLite::TYPE_FLOAT);
648
0
      SERIALIZERS_FOR_TYPE(WireFormatLite::TYPE_INT64);
649
0
      SERIALIZERS_FOR_TYPE(WireFormatLite::TYPE_UINT64);
650
0
      SERIALIZERS_FOR_TYPE(WireFormatLite::TYPE_INT32);
651
0
      SERIALIZERS_FOR_TYPE(WireFormatLite::TYPE_FIXED64);
652
0
      SERIALIZERS_FOR_TYPE(WireFormatLite::TYPE_FIXED32);
653
0
      SERIALIZERS_FOR_TYPE(WireFormatLite::TYPE_BOOL);
654
0
      SERIALIZERS_FOR_TYPE(WireFormatLite::TYPE_STRING);
655
0
      SERIALIZERS_FOR_TYPE(WireFormatLite::TYPE_GROUP);
656
0
      SERIALIZERS_FOR_TYPE(WireFormatLite::TYPE_MESSAGE);
657
0
      SERIALIZERS_FOR_TYPE(WireFormatLite::TYPE_BYTES);
658
0
      SERIALIZERS_FOR_TYPE(WireFormatLite::TYPE_UINT32);
659
0
      SERIALIZERS_FOR_TYPE(WireFormatLite::TYPE_ENUM);
660
0
      SERIALIZERS_FOR_TYPE(WireFormatLite::TYPE_SFIXED32);
661
0
      SERIALIZERS_FOR_TYPE(WireFormatLite::TYPE_SFIXED64);
662
0
      SERIALIZERS_FOR_TYPE(WireFormatLite::TYPE_SINT32);
663
0
      SERIALIZERS_FOR_TYPE(WireFormatLite::TYPE_SINT64);
664
      // Special cases
665
0
      case FieldMetadata::kSpecial: {
666
0
        io::ArrayOutputStream array_stream(array_output.ptr, INT_MAX);
667
0
        io::CodedOutputStream output(&array_stream);
668
0
        output.SetSerializationDeterministic(is_deterministic);
669
0
        func = reinterpret_cast<SpecialSerializer>(
670
0
            const_cast<void*>(field_metadata.ptr));
671
0
        func(base, field_metadata.offset, field_metadata.tag,
672
0
             field_metadata.has_offset, &output);
673
0
        array_output.ptr += output.ByteCount();
674
0
      } break;
675
0
      default:
676
        // __builtin_unreachable()
677
0
        SerializeNotImplemented(field_metadata.type);
678
0
    }
679
0
  }
680
0
  return array_output.ptr;
681
0
}
682
#undef SERIALIZERS_FOR_TYPE
683
684
void ExtensionSerializer(const uint8* ptr, uint32 offset, uint32 tag,
685
0
                         uint32 has_offset, io::CodedOutputStream* output) {
686
0
  reinterpret_cast<const ExtensionSet*>(ptr + offset)
687
0
      ->SerializeWithCachedSizes(tag, has_offset, output);
688
0
}
689
690
void UnknownFieldSerializerLite(const uint8* ptr, uint32 offset, uint32 tag,
691
                                uint32 has_offset,
692
0
                                io::CodedOutputStream* output) {
693
0
  output->WriteString(
694
0
      reinterpret_cast<const InternalMetadata*>(ptr + offset)
695
0
          ->unknown_fields<std::string>(&internal::GetEmptyString));
696
0
}
697
698
0
MessageLite* DuplicateIfNonNullInternal(MessageLite* message) {
699
0
  if (message) {
700
0
    MessageLite* ret = message->New();
701
0
    ret->CheckTypeAndMergeFrom(*message);
702
0
    return ret;
703
0
  } else {
704
0
    return NULL;
705
0
  }
706
0
}
707
708
0
void GenericSwap(MessageLite* m1, MessageLite* m2) {
709
0
  std::unique_ptr<MessageLite> tmp(m1->New());
710
0
  tmp->CheckTypeAndMergeFrom(*m1);
711
0
  m1->Clear();
712
0
  m1->CheckTypeAndMergeFrom(*m2);
713
0
  m2->Clear();
714
0
  m2->CheckTypeAndMergeFrom(*tmp);
715
0
}
716
717
// Returns a message owned by this Arena.  This may require Own()ing or
718
// duplicating the message.
719
MessageLite* GetOwnedMessageInternal(Arena* message_arena,
720
                                     MessageLite* submessage,
721
0
                                     Arena* submessage_arena) {
722
0
  GOOGLE_DCHECK(submessage->GetArena() == submessage_arena);
723
0
  GOOGLE_DCHECK(message_arena != submessage_arena);
724
0
  if (message_arena != NULL && submessage_arena == NULL) {
725
0
    message_arena->Own(submessage);
726
0
    return submessage;
727
0
  } else {
728
0
    MessageLite* ret = submessage->New(message_arena);
729
0
    ret->CheckTypeAndMergeFrom(*submessage);
730
0
    return ret;
731
0
  }
732
0
}
733
734
namespace {
735
736
2
void InitSCC_DFS(SCCInfoBase* scc) {
737
2
  if (scc->visit_status.load(std::memory_order_relaxed) !=
738
2
      SCCInfoBase::kUninitialized)
739
0
    return;
740
2
  scc->visit_status.store(SCCInfoBase::kRunning, std::memory_order_relaxed);
741
  // Each base is followed by an array of void*, containing first pointers to
742
  // SCCInfoBase and then pointers-to-pointers to SCCInfoBase.
743
2
  auto deps = reinterpret_cast<void**>(scc + 1);
744
2
  auto strong_deps = reinterpret_cast<SCCInfoBase* const*>(deps);
745
3
  for (int i = 0; i < scc->num_deps; ++i) {
746
1
    if (strong_deps[i]) InitSCC_DFS(strong_deps[i]);
747
1
  }
748
2
  auto implicit_weak_deps =
749
2
      reinterpret_cast<SCCInfoBase** const*>(deps + scc->num_deps);
750
2
  for (int i = 0; i < scc->num_implicit_weak_deps; ++i) {
751
0
    if (*implicit_weak_deps[i]) {
752
0
      InitSCC_DFS(*implicit_weak_deps[i]);
753
0
    }
754
0
  }
755
2
  scc->init_func();
756
  // Mark done (note we use memory order release here), other threads could
757
  // now see this as initialized and thus the initialization must have happened
758
  // before.
759
2
  scc->visit_status.store(SCCInfoBase::kInitialized, std::memory_order_release);
760
2
}
761
762
}  // namespace
763
764
3
void InitSCCImpl(SCCInfoBase* scc) {
765
3
  static WrappedMutex mu{GOOGLE_PROTOBUF_LINKER_INITIALIZED};
766
  // Either the default in case no initialization is running or the id of the
767
  // thread that is currently initializing.
768
3
#ifndef GOOGLE_PROTOBUF_SUPPORT_WINDOWS_XP
769
3
  static std::atomic<std::thread::id> runner;
770
3
  auto me = std::this_thread::get_id();
771
#else
772
  // This is a lightweight replacement for std::thread::id. std::thread does not
773
  // work on Windows XP SP2 with the latest VC++ libraries, because it utilizes
774
  // the Concurrency Runtime that is only supported on Windows XP SP3 and above.
775
  static std::atomic_llong runner(-1);
776
  auto me = ::GetCurrentThreadId();
777
#endif  // #ifndef GOOGLE_PROTOBUF_SUPPORT_WINDOWS_XP
778
779
  // This will only happen because the constructor will call InitSCC while
780
  // constructing the default instance.
781
3
  if (runner.load(std::memory_order_relaxed) == me) {
782
    // Because we're in the process of constructing the default instance.
783
    // We can be assured that we're already exploring this SCC.
784
2
    GOOGLE_CHECK_EQ(scc->visit_status.load(std::memory_order_relaxed),
785
2
             SCCInfoBase::kRunning);
786
2
    return;
787
2
  }
788
1
  InitProtobufDefaults();
789
1
  mu.Lock();
790
1
  runner.store(me, std::memory_order_relaxed);
791
1
  InitSCC_DFS(scc);
792
793
1
#ifndef GOOGLE_PROTOBUF_SUPPORT_WINDOWS_XP
794
1
  runner.store(std::thread::id{}, std::memory_order_relaxed);
795
#else
796
  runner.store(-1, std::memory_order_relaxed);
797
#endif  // #ifndef GOOGLE_PROTOBUF_SUPPORT_WINDOWS_XP
798
799
1
  mu.Unlock();
800
1
}
801
802
}  // namespace internal
803
}  // namespace protobuf
804
}  // namespace google