Coverage Report

Created: 2023-03-26 07:54

/src/LPM/external.protobuf/include/google/protobuf/arena.h
Line
Count
Source (jump to first uncovered line)
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
// This file defines an Arena allocator for better allocation performance.
32
33
#ifndef GOOGLE_PROTOBUF_ARENA_H__
34
#define GOOGLE_PROTOBUF_ARENA_H__
35
36
37
#include <limits>
38
#include <type_traits>
39
#include <utility>
40
#if defined(_MSC_VER) && !defined(_LIBCPP_STD_VER) && !_HAS_EXCEPTIONS
41
// Work around bugs in MSVC <typeinfo> header when _HAS_EXCEPTIONS=0.
42
#include <exception>
43
#include <typeinfo>
44
namespace std {
45
using type_info = ::type_info;
46
}
47
#else
48
#include <typeinfo>
49
#endif
50
51
#include <type_traits>
52
#include <google/protobuf/arena_impl.h>
53
#include <google/protobuf/port.h>
54
55
// Must be included last.
56
#include <google/protobuf/port_def.inc>
57
58
#ifdef SWIG
59
#error "You cannot SWIG proto headers"
60
#endif
61
62
namespace google {
63
namespace protobuf {
64
65
struct ArenaOptions;  // defined below
66
class Arena;    // defined below
67
class Message;  // defined in message.h
68
class MessageLite;
69
template <typename Key, typename T>
70
class Map;
71
72
namespace arena_metrics {
73
74
void EnableArenaMetrics(ArenaOptions* options);
75
76
}  // namespace arena_metrics
77
78
namespace TestUtil {
79
class ReflectionTester;  // defined in test_util.h
80
}  // namespace TestUtil
81
82
namespace internal {
83
84
struct ArenaTestPeer;        // defined in arena_test_util.h
85
class InternalMetadata;      // defined in metadata_lite.h
86
class LazyField;             // defined in lazy_field.h
87
class EpsCopyInputStream;    // defined in parse_context.h
88
class RepeatedPtrFieldBase;  // defined in repeated_ptr_field.h
89
90
template <typename Type>
91
class GenericTypeHandler;  // defined in repeated_field.h
92
93
inline PROTOBUF_ALWAYS_INLINE
94
0
void* AlignTo(void* ptr, size_t align) {
95
0
  return reinterpret_cast<void*>(
96
0
      (reinterpret_cast<uintptr_t>(ptr) + align - 1) & (~align + 1));
97
0
}
98
99
// Templated cleanup methods.
100
template <typename T>
101
0
void arena_destruct_object(void* object) {
102
0
  reinterpret_cast<T*>(object)->~T();
103
0
}
Unexecuted instantiation: void google::protobuf::internal::arena_destruct_object<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(void*)
Unexecuted instantiation: void google::protobuf::internal::arena_destruct_object<google::protobuf::internal::InternalMetadata::Container<google::protobuf::UnknownFieldSet> >(void*)
Unexecuted instantiation: void google::protobuf::internal::arena_destruct_object<google::protobuf::internal::InternalMetadata::Container<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >(void*)
Unexecuted instantiation: void google::protobuf::internal::arena_destruct_object<google::protobuf::internal::ImplicitWeakMessage>(void*)
104
105
template <bool destructor_skippable, typename T>
106
struct ObjectDestructor {
107
  constexpr static void (*destructor)(void*) = &arena_destruct_object<T>;
108
};
109
110
template <typename T>
111
struct ObjectDestructor<true, T> {
112
  constexpr static void (*destructor)(void*) = nullptr;
113
};
114
115
template <typename T>
116
0
void arena_delete_object(void* object) {
117
0
  delete reinterpret_cast<T*>(object);
118
0
}
119
}  // namespace internal
120
121
// ArenaOptions provides optional additional parameters to arena construction
122
// that control its block-allocation behavior.
123
struct ArenaOptions {
124
  // This defines the size of the first block requested from the system malloc.
125
  // Subsequent block sizes will increase in a geometric series up to a maximum.
126
  size_t start_block_size;
127
128
  // This defines the maximum block size requested from system malloc (unless an
129
  // individual arena allocation request occurs with a size larger than this
130
  // maximum). Requested block sizes increase up to this value, then remain
131
  // here.
132
  size_t max_block_size;
133
134
  // An initial block of memory for the arena to use, or NULL for none. If
135
  // provided, the block must live at least as long as the arena itself. The
136
  // creator of the Arena retains ownership of the block after the Arena is
137
  // destroyed.
138
  char* initial_block;
139
140
  // The size of the initial block, if provided.
141
  size_t initial_block_size;
142
143
  // A function pointer to an alloc method that returns memory blocks of size
144
  // requested. By default, it contains a ptr to the malloc function.
145
  //
146
  // NOTE: block_alloc and dealloc functions are expected to behave like
147
  // malloc and free, including Asan poisoning.
148
  void* (*block_alloc)(size_t);
149
  // A function pointer to a dealloc method that takes ownership of the blocks
150
  // from the arena. By default, it contains a ptr to a wrapper function that
151
  // calls free.
152
  void (*block_dealloc)(void*, size_t);
153
154
  ArenaOptions()
155
      : start_block_size(internal::AllocationPolicy::kDefaultStartBlockSize),
156
        max_block_size(internal::AllocationPolicy::kDefaultMaxBlockSize),
157
        initial_block(NULL),
158
        initial_block_size(0),
159
        block_alloc(nullptr),
160
        block_dealloc(nullptr),
161
0
        make_metrics_collector(nullptr) {}
162
163
 private:
164
  // If make_metrics_collector is not nullptr, it will be called at Arena init
165
  // time. It may return a pointer to a collector instance that will be notified
166
  // of interesting events related to the arena.
167
  internal::ArenaMetricsCollector* (*make_metrics_collector)();
168
169
0
  internal::ArenaMetricsCollector* MetricsCollector() const {
170
0
    return make_metrics_collector ? (*make_metrics_collector)() : nullptr;
171
0
  }
172
173
0
  internal::AllocationPolicy AllocationPolicy() const {
174
0
    internal::AllocationPolicy res;
175
0
    res.start_block_size = start_block_size;
176
0
    res.max_block_size = max_block_size;
177
0
    res.block_alloc = block_alloc;
178
0
    res.block_dealloc = block_dealloc;
179
0
    res.metrics_collector = MetricsCollector();
180
0
    return res;
181
0
  }
182
183
  friend void arena_metrics::EnableArenaMetrics(ArenaOptions*);
184
185
  friend class Arena;
186
  friend class ArenaOptionsTestFriend;
187
};
188
189
// Support for non-RTTI environments. (The metrics hooks API uses type
190
// information.)
191
#if PROTOBUF_RTTI
192
0
#define RTTI_TYPE_ID(type) (&typeid(type))
193
#else
194
#define RTTI_TYPE_ID(type) (NULL)
195
#endif
196
197
// Arena allocator. Arena allocation replaces ordinary (heap-based) allocation
198
// with new/delete, and improves performance by aggregating allocations into
199
// larger blocks and freeing allocations all at once. Protocol messages are
200
// allocated on an arena by using Arena::CreateMessage<T>(Arena*), below, and
201
// are automatically freed when the arena is destroyed.
202
//
203
// This is a thread-safe implementation: multiple threads may allocate from the
204
// arena concurrently. Destruction is not thread-safe and the destructing
205
// thread must synchronize with users of the arena first.
206
//
207
// An arena provides two allocation interfaces: CreateMessage<T>, which works
208
// for arena-enabled proto2 message types as well as other types that satisfy
209
// the appropriate protocol (described below), and Create<T>, which works for
210
// any arbitrary type T. CreateMessage<T> is better when the type T supports it,
211
// because this interface (i) passes the arena pointer to the created object so
212
// that its sub-objects and internal allocations can use the arena too, and (ii)
213
// elides the object's destructor call when possible. Create<T> does not place
214
// any special requirements on the type T, and will invoke the object's
215
// destructor when the arena is destroyed.
216
//
217
// The arena message allocation protocol, required by
218
// CreateMessage<T>(Arena* arena, Args&&... args), is as follows:
219
//
220
// - The type T must have (at least) two constructors: a constructor callable
221
//   with `args` (without `arena`), called when a T is allocated on the heap;
222
//   and a constructor callable with `Arena* arena, Args&&... args`, called when
223
//   a T is allocated on an arena. If the second constructor is called with a
224
//   NULL arena pointer, it must be equivalent to invoking the first
225
//   (`args`-only) constructor.
226
//
227
// - The type T must have a particular type trait: a nested type
228
//   |InternalArenaConstructable_|. This is usually a typedef to |void|. If no
229
//   such type trait exists, then the instantiation CreateMessage<T> will fail
230
//   to compile.
231
//
232
// - The type T *may* have the type trait |DestructorSkippable_|. If this type
233
//   trait is present in the type, then its destructor will not be called if and
234
//   only if it was passed a non-NULL arena pointer. If this type trait is not
235
//   present on the type, then its destructor is always called when the
236
//   containing arena is destroyed.
237
//
238
// This protocol is implemented by all arena-enabled proto2 message classes as
239
// well as protobuf container types like RepeatedPtrField and Map. The protocol
240
// is internal to protobuf and is not guaranteed to be stable. Non-proto types
241
// should not rely on this protocol.
242
class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena final {
243
 public:
244
  // Default constructor with sensible default options, tuned for average
245
  // use-cases.
246
0
  inline Arena() : impl_() {}
247
248
  // Construct an arena with default options, except for the supplied
249
  // initial block. It is more efficient to use this constructor
250
  // instead of passing ArenaOptions if the only configuration needed
251
  // by the caller is supplying an initial block.
252
  inline Arena(char* initial_block, size_t initial_block_size)
253
0
      : impl_(initial_block, initial_block_size) {}
254
255
  // Arena constructor taking custom options. See ArenaOptions above for
256
  // descriptions of the options available.
257
  explicit Arena(const ArenaOptions& options)
258
      : impl_(options.initial_block, options.initial_block_size,
259
0
              options.AllocationPolicy()) {}
260
261
  // Block overhead.  Use this as a guide for how much to over-allocate the
262
  // initial block if you want an allocation of size N to fit inside it.
263
  //
264
  // WARNING: if you allocate multiple objects, it is difficult to guarantee
265
  // that a series of allocations will fit in the initial block, especially if
266
  // Arena changes its alignment guarantees in the future!
267
  static const size_t kBlockOverhead =
268
      internal::ThreadSafeArena::kBlockHeaderSize +
269
      internal::ThreadSafeArena::kSerialArenaSize;
270
271
0
  inline ~Arena() {}
272
273
  // TODO(protobuf-team): Fix callers to use constructor and delete this method.
274
0
  void Init(const ArenaOptions&) {}
275
276
  // API to create proto2 message objects on the arena. If the arena passed in
277
  // is NULL, then a heap allocated object is returned. Type T must be a message
278
  // defined in a .proto file with cc_enable_arenas set to true, otherwise a
279
  // compilation error will occur.
280
  //
281
  // RepeatedField and RepeatedPtrField may also be instantiated directly on an
282
  // arena with this method.
283
  //
284
  // This function also accepts any type T that satisfies the arena message
285
  // allocation protocol, documented above.
286
  template <typename T, typename... Args>
287
0
  PROTOBUF_ALWAYS_INLINE static T* CreateMessage(Arena* arena, Args&&... args) {
288
0
    static_assert(
289
0
        InternalHelper<T>::is_arena_constructable::value,
290
0
        "CreateMessage can only construct types that are ArenaConstructable");
291
0
    // We must delegate to CreateMaybeMessage() and NOT CreateMessageInternal()
292
0
    // because protobuf generated classes specialize CreateMaybeMessage() and we
293
0
    // need to use that specialization for code size reasons.
294
0
    return Arena::CreateMaybeMessage<T>(arena, static_cast<Args&&>(args)...);
295
0
  }
296
297
  // API to create any objects on the arena. Note that only the object will
298
  // be created on the arena; the underlying ptrs (in case of a proto2 message)
299
  // will be still heap allocated. Proto messages should usually be allocated
300
  // with CreateMessage<T>() instead.
301
  //
302
  // Note that even if T satisfies the arena message construction protocol
303
  // (InternalArenaConstructable_ trait and optional DestructorSkippable_
304
  // trait), as described above, this function does not follow the protocol;
305
  // instead, it treats T as a black-box type, just as if it did not have these
306
  // traits. Specifically, T's constructor arguments will always be only those
307
  // passed to Create<T>() -- no additional arena pointer is implicitly added.
308
  // Furthermore, the destructor will always be called at arena destruction time
309
  // (unless the destructor is trivial). Hence, from T's point of view, it is as
310
  // if the object were allocated on the heap (except that the underlying memory
311
  // is obtained from the arena).
312
  template <typename T, typename... Args>
313
0
  PROTOBUF_NDEBUG_INLINE static T* Create(Arena* arena, Args&&... args) {
314
0
    return CreateInternal<T>(arena, std::is_convertible<T*, MessageLite*>(),
315
0
                             static_cast<Args&&>(args)...);
316
0
  }
Unexecuted instantiation: std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >* google::protobuf::Arena::Create<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >>(google::protobuf::Arena*)
Unexecuted instantiation: google::protobuf::internal::InternalMetadata::Container<google::protobuf::UnknownFieldSet>* google::protobuf::Arena::Create<google::protobuf::internal::InternalMetadata::Container<google::protobuf::UnknownFieldSet>>(google::protobuf::Arena*)
Unexecuted instantiation: google::protobuf::internal::InternalMetadata::Container<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >* google::protobuf::Arena::Create<google::protobuf::internal::InternalMetadata::Container<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >>(google::protobuf::Arena*)
Unexecuted instantiation: std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >* google::protobuf::Arena::Create<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(google::protobuf::Arena*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&&)
317
318
  // Allocates memory with the specific size and alignment.
319
0
  void* AllocateAligned(size_t size, size_t align = 8) {
320
0
    if (align <= 8) {
321
0
      return AllocateAlignedNoHook(internal::AlignUpTo8(size));
322
0
    } else {
323
0
      // We are wasting space by over allocating align - 8 bytes. Compared
324
0
      // to a dedicated function that takes current alignment in consideration.
325
0
      // Such a scheme would only waste (align - 8)/2 bytes on average, but
326
0
      // requires a dedicated function in the outline arena allocation
327
0
      // functions. Possibly re-evaluate tradeoffs later.
328
0
      return internal::AlignTo(AllocateAlignedNoHook(size + align - 8), align);
329
0
    }
330
0
  }
331
332
  // Create an array of object type T on the arena *without* invoking the
333
  // constructor of T. If `arena` is null, then the return value should be freed
334
  // with `delete[] x;` (or `::operator delete[](x);`).
335
  // To ensure safe uses, this function checks at compile time
336
  // (when compiled as C++11) that T is trivially default-constructible and
337
  // trivially destructible.
338
  template <typename T>
339
  PROTOBUF_NDEBUG_INLINE static T* CreateArray(Arena* arena,
340
                                               size_t num_elements) {
341
    static_assert(std::is_trivial<T>::value,
342
                  "CreateArray requires a trivially constructible type");
343
    static_assert(std::is_trivially_destructible<T>::value,
344
                  "CreateArray requires a trivially destructible type");
345
    GOOGLE_CHECK_LE(num_elements, std::numeric_limits<size_t>::max() / sizeof(T))
346
        << "Requested size is too large to fit into size_t.";
347
    if (arena == NULL) {
348
      return static_cast<T*>(::operator new[](num_elements * sizeof(T)));
349
    } else {
350
      return arena->CreateInternalRawArray<T>(num_elements);
351
    }
352
  }
353
354
  // The following are routines are for monitoring. They will approximate the
355
  // total sum allocated and used memory, but the exact value is an
356
  // implementation deal. For instance allocated space depends on growth
357
  // policies. Do not use these in unit tests.
358
  // Returns the total space allocated by the arena, which is the sum of the
359
  // sizes of the underlying blocks.
360
0
  uint64_t SpaceAllocated() const { return impl_.SpaceAllocated(); }
361
  // Returns the total space used by the arena. Similar to SpaceAllocated but
362
  // does not include free space and block overhead. The total space returned
363
  // may not include space used by other threads executing concurrently with
364
  // the call to this method.
365
0
  uint64_t SpaceUsed() const { return impl_.SpaceUsed(); }
366
367
  // Frees all storage allocated by this arena after calling destructors
368
  // registered with OwnDestructor() and freeing objects registered with Own().
369
  // Any objects allocated on this arena are unusable after this call. It also
370
  // returns the total space used by the arena which is the sums of the sizes
371
  // of the allocated blocks. This method is not thread-safe.
372
0
  uint64_t Reset() { return impl_.Reset(); }
373
374
  // Adds |object| to a list of heap-allocated objects to be freed with |delete|
375
  // when the arena is destroyed or reset.
376
  template <typename T>
377
0
  PROTOBUF_ALWAYS_INLINE void Own(T* object) {
378
0
    OwnInternal(object, std::is_convertible<T*, MessageLite*>());
379
0
  }
380
381
  // Adds |object| to a list of objects whose destructors will be manually
382
  // called when the arena is destroyed or reset. This differs from Own() in
383
  // that it does not free the underlying memory with |delete|; hence, it is
384
  // normally only used for objects that are placement-newed into
385
  // arena-allocated memory.
386
  template <typename T>
387
  PROTOBUF_ALWAYS_INLINE void OwnDestructor(T* object) {
388
    if (object != NULL) {
389
      impl_.AddCleanup(object, &internal::arena_destruct_object<T>);
390
    }
391
  }
392
393
  // Adds a custom member function on an object to the list of destructors that
394
  // will be manually called when the arena is destroyed or reset. This differs
395
  // from OwnDestructor() in that any member function may be specified, not only
396
  // the class destructor.
397
  PROTOBUF_ALWAYS_INLINE void OwnCustomDestructor(void* object,
398
0
                                                  void (*destruct)(void*)) {
399
0
    impl_.AddCleanup(object, destruct);
400
0
  }
401
402
  // Retrieves the arena associated with |value| if |value| is an arena-capable
403
  // message, or NULL otherwise. If possible, the call resolves at compile time.
404
  // Note that we can often devirtualize calls to `value->GetArena()` so usually
405
  // calling this method is unnecessary.
406
  template <typename T>
407
  PROTOBUF_ALWAYS_INLINE static Arena* GetArena(const T* value) {
408
    return GetArenaInternal(value);
409
  }
410
411
  template <typename T>
412
  class InternalHelper {
413
   private:
414
    // Provides access to protected GetOwningArena to generated messages.
415
0
    static Arena* GetOwningArena(const T* p) { return p->GetOwningArena(); }
Unexecuted instantiation: google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::ExtSubsetDecl>::GetOwningArena(xmlProtoFuzzer::ExtSubsetDecl const*)
Unexecuted instantiation: google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::ExternalId>::GetOwningArena(xmlProtoFuzzer::ExternalId const*)
Unexecuted instantiation: google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::ProcessingInstruction>::GetOwningArena(xmlProtoFuzzer::ProcessingInstruction const*)
Unexecuted instantiation: google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::EntityValue>::GetOwningArena(xmlProtoFuzzer::EntityValue const*)
Unexecuted instantiation: google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::MarkupDecl>::GetOwningArena(xmlProtoFuzzer::MarkupDecl const*)
Unexecuted instantiation: google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::ConditionalSect>::GetOwningArena(xmlProtoFuzzer::ConditionalSect const*)
Unexecuted instantiation: google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::ElementDecl>::GetOwningArena(xmlProtoFuzzer::ElementDecl const*)
Unexecuted instantiation: google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::AttListDecl>::GetOwningArena(xmlProtoFuzzer::AttListDecl const*)
Unexecuted instantiation: google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::NotationDecl>::GetOwningArena(xmlProtoFuzzer::NotationDecl const*)
Unexecuted instantiation: google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::Misc>::GetOwningArena(xmlProtoFuzzer::Misc const*)
Unexecuted instantiation: google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::EntityDecl>::GetOwningArena(xmlProtoFuzzer::EntityDecl const*)
Unexecuted instantiation: google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::Element>::GetOwningArena(xmlProtoFuzzer::Element const*)
Unexecuted instantiation: google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::CData>::GetOwningArena(xmlProtoFuzzer::CData const*)
Unexecuted instantiation: google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::AttrType>::GetOwningArena(xmlProtoFuzzer::AttrType const*)
Unexecuted instantiation: google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::EnumeratedType>::GetOwningArena(xmlProtoFuzzer::EnumeratedType const*)
Unexecuted instantiation: google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::DefaultDecl>::GetOwningArena(xmlProtoFuzzer::DefaultDecl const*)
Unexecuted instantiation: google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::AttValue>::GetOwningArena(xmlProtoFuzzer::AttValue const*)
Unexecuted instantiation: google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::NDataDecl>::GetOwningArena(xmlProtoFuzzer::NDataDecl const*)
Unexecuted instantiation: google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::EntityDef>::GetOwningArena(xmlProtoFuzzer::EntityDef const*)
Unexecuted instantiation: google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::PEDef>::GetOwningArena(xmlProtoFuzzer::PEDef const*)
Unexecuted instantiation: google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::XmlDeclaration>::GetOwningArena(xmlProtoFuzzer::XmlDeclaration const*)
Unexecuted instantiation: google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::DocTypeDecl>::GetOwningArena(xmlProtoFuzzer::DocTypeDecl const*)
Unexecuted instantiation: google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::Content>::GetOwningArena(xmlProtoFuzzer::Content const*)
Unexecuted instantiation: google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::VersionNum>::GetOwningArena(xmlProtoFuzzer::VersionNum const*)
Unexecuted instantiation: google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::Encodings>::GetOwningArena(xmlProtoFuzzer::Encodings const*)
Unexecuted instantiation: google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::Prolog>::GetOwningArena(xmlProtoFuzzer::Prolog const*)
Unexecuted instantiation: google::protobuf::Arena::InternalHelper<google::protobuf::FileOptions>::GetOwningArena(google::protobuf::FileOptions const*)
Unexecuted instantiation: google::protobuf::Arena::InternalHelper<google::protobuf::SourceCodeInfo>::GetOwningArena(google::protobuf::SourceCodeInfo const*)
Unexecuted instantiation: google::protobuf::Arena::InternalHelper<google::protobuf::ExtensionRangeOptions>::GetOwningArena(google::protobuf::ExtensionRangeOptions const*)
Unexecuted instantiation: google::protobuf::Arena::InternalHelper<google::protobuf::MessageOptions>::GetOwningArena(google::protobuf::MessageOptions const*)
Unexecuted instantiation: google::protobuf::Arena::InternalHelper<google::protobuf::FieldOptions>::GetOwningArena(google::protobuf::FieldOptions const*)
Unexecuted instantiation: google::protobuf::Arena::InternalHelper<google::protobuf::OneofOptions>::GetOwningArena(google::protobuf::OneofOptions const*)
Unexecuted instantiation: google::protobuf::Arena::InternalHelper<google::protobuf::EnumOptions>::GetOwningArena(google::protobuf::EnumOptions const*)
Unexecuted instantiation: google::protobuf::Arena::InternalHelper<google::protobuf::EnumValueOptions>::GetOwningArena(google::protobuf::EnumValueOptions const*)
Unexecuted instantiation: google::protobuf::Arena::InternalHelper<google::protobuf::ServiceOptions>::GetOwningArena(google::protobuf::ServiceOptions const*)
Unexecuted instantiation: google::protobuf::Arena::InternalHelper<google::protobuf::MethodOptions>::GetOwningArena(google::protobuf::MethodOptions const*)
416
417
    static void InternalSwap(T* a, T* b) { a->InternalSwap(b); }
418
419
    static Arena* GetArenaForAllocationInternal(
420
        const T* p, std::true_type /*is_derived_from<MessageLite>*/) {
421
      return p->GetArenaForAllocation();
422
    }
423
424
    static Arena* GetArenaForAllocationInternal(
425
        const T* p, std::false_type /*is_derived_from<MessageLite>*/) {
426
      return GetArenaForAllocationForNonMessage(
427
          p, typename is_arena_constructable::type());
428
    }
429
430
    static Arena* GetArenaForAllocationForNonMessage(
431
        const T* p, std::true_type /*is_arena_constructible*/) {
432
      return p->GetArena();
433
    }
434
435
    static Arena* GetArenaForAllocationForNonMessage(
436
        const T* p, std::false_type /*is_arena_constructible*/) {
437
      return GetArenaForAllocationForNonMessageNonArenaConstructible(
438
          p, typename has_get_arena::type());
439
    }
440
441
    static Arena* GetArenaForAllocationForNonMessageNonArenaConstructible(
442
        const T* p, std::true_type /*has_get_arena*/) {
443
      return p->GetArena();
444
    }
445
446
    static Arena* GetArenaForAllocationForNonMessageNonArenaConstructible(
447
        const T* /* p */, std::false_type /*has_get_arena*/) {
448
      return nullptr;
449
    }
450
451
    template <typename U>
452
    static char DestructorSkippable(const typename U::DestructorSkippable_*);
453
    template <typename U>
454
    static double DestructorSkippable(...);
455
456
    typedef std::integral_constant<
457
        bool, sizeof(DestructorSkippable<T>(static_cast<const T*>(0))) ==
458
                      sizeof(char) ||
459
                  std::is_trivially_destructible<T>::value>
460
        is_destructor_skippable;
461
462
    template <typename U>
463
    static char ArenaConstructable(
464
        const typename U::InternalArenaConstructable_*);
465
    template <typename U>
466
    static double ArenaConstructable(...);
467
468
    typedef std::integral_constant<bool, sizeof(ArenaConstructable<T>(
469
                                             static_cast<const T*>(0))) ==
470
                                             sizeof(char)>
471
        is_arena_constructable;
472
473
    template <typename U,
474
              typename std::enable_if<
475
                  std::is_same<Arena*, decltype(std::declval<const U>()
476
                                                    .GetArena())>::value,
477
                  int>::type = 0>
478
    static char HasGetArena(decltype(&U::GetArena));
479
    template <typename U>
480
    static double HasGetArena(...);
481
482
    typedef std::integral_constant<bool, sizeof(HasGetArena<T>(nullptr)) ==
483
                                             sizeof(char)>
484
        has_get_arena;
485
486
    template <typename... Args>
487
0
    static T* Construct(void* ptr, Args&&... args) {
488
0
      return new (ptr) T(static_cast<Args&&>(args)...);
489
0
    }
Unexecuted instantiation: xmlProtoFuzzer::Misc* google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::Misc>::Construct<google::protobuf::Arena*>(void*, google::protobuf::Arena*&&)
Unexecuted instantiation: xmlProtoFuzzer::PEReference* google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::PEReference>::Construct<google::protobuf::Arena*>(void*, google::protobuf::Arena*&&)
Unexecuted instantiation: xmlProtoFuzzer::ElementDecl* google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::ElementDecl>::Construct<google::protobuf::Arena*>(void*, google::protobuf::Arena*&&)
Unexecuted instantiation: xmlProtoFuzzer::AttrType* google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::AttrType>::Construct<google::protobuf::Arena*>(void*, google::protobuf::Arena*&&)
Unexecuted instantiation: xmlProtoFuzzer::EnumeratedType* google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::EnumeratedType>::Construct<google::protobuf::Arena*>(void*, google::protobuf::Arena*&&)
Unexecuted instantiation: xmlProtoFuzzer::AttrListDecl* google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::AttrListDecl>::Construct<google::protobuf::Arena*>(void*, google::protobuf::Arena*&&)
Unexecuted instantiation: xmlProtoFuzzer::ExternalId* google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::ExternalId>::Construct<google::protobuf::Arena*>(void*, google::protobuf::Arena*&&)
Unexecuted instantiation: xmlProtoFuzzer::AttValue* google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::AttValue>::Construct<google::protobuf::Arena*>(void*, google::protobuf::Arena*&&)
Unexecuted instantiation: xmlProtoFuzzer::DefaultDecl* google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::DefaultDecl>::Construct<google::protobuf::Arena*>(void*, google::protobuf::Arena*&&)
Unexecuted instantiation: xmlProtoFuzzer::AttDef* google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::AttDef>::Construct<google::protobuf::Arena*>(void*, google::protobuf::Arena*&&)
Unexecuted instantiation: xmlProtoFuzzer::AttListDecl* google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::AttListDecl>::Construct<google::protobuf::Arena*>(void*, google::protobuf::Arena*&&)
Unexecuted instantiation: xmlProtoFuzzer::NotationDecl* google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::NotationDecl>::Construct<google::protobuf::Arena*>(void*, google::protobuf::Arena*&&)
Unexecuted instantiation: xmlProtoFuzzer::EntityValue* google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::EntityValue>::Construct<google::protobuf::Arena*>(void*, google::protobuf::Arena*&&)
Unexecuted instantiation: xmlProtoFuzzer::NDataDecl* google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::NDataDecl>::Construct<google::protobuf::Arena*>(void*, google::protobuf::Arena*&&)
Unexecuted instantiation: xmlProtoFuzzer::EntityDef* google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::EntityDef>::Construct<google::protobuf::Arena*>(void*, google::protobuf::Arena*&&)
Unexecuted instantiation: xmlProtoFuzzer::PEDef* google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::PEDef>::Construct<google::protobuf::Arena*>(void*, google::protobuf::Arena*&&)
Unexecuted instantiation: xmlProtoFuzzer::EntityDecl* google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::EntityDecl>::Construct<google::protobuf::Arena*>(void*, google::protobuf::Arena*&&)
Unexecuted instantiation: xmlProtoFuzzer::ConditionalSect* google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::ConditionalSect>::Construct<google::protobuf::Arena*>(void*, google::protobuf::Arena*&&)
Unexecuted instantiation: xmlProtoFuzzer::OneExtSubsetDecl* google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::OneExtSubsetDecl>::Construct<google::protobuf::Arena*>(void*, google::protobuf::Arena*&&)
Unexecuted instantiation: xmlProtoFuzzer::ExtSubsetDecl* google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::ExtSubsetDecl>::Construct<google::protobuf::Arena*>(void*, google::protobuf::Arena*&&)
Unexecuted instantiation: xmlProtoFuzzer::MarkupDecl* google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::MarkupDecl>::Construct<google::protobuf::Arena*>(void*, google::protobuf::Arena*&&)
Unexecuted instantiation: xmlProtoFuzzer::DocTypeDecl* google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::DocTypeDecl>::Construct<google::protobuf::Arena*>(void*, google::protobuf::Arena*&&)
Unexecuted instantiation: xmlProtoFuzzer::Prolog* google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::Prolog>::Construct<google::protobuf::Arena*>(void*, google::protobuf::Arena*&&)
Unexecuted instantiation: xmlProtoFuzzer::KeyValue* google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::KeyValue>::Construct<google::protobuf::Arena*>(void*, google::protobuf::Arena*&&)
Unexecuted instantiation: xmlProtoFuzzer::ProcessingInstruction* google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::ProcessingInstruction>::Construct<google::protobuf::Arena*>(void*, google::protobuf::Arena*&&)
Unexecuted instantiation: xmlProtoFuzzer::CData* google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::CData>::Construct<google::protobuf::Arena*>(void*, google::protobuf::Arena*&&)
Unexecuted instantiation: xmlProtoFuzzer::Content* google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::Content>::Construct<google::protobuf::Arena*>(void*, google::protobuf::Arena*&&)
Unexecuted instantiation: xmlProtoFuzzer::Element* google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::Element>::Construct<google::protobuf::Arena*>(void*, google::protobuf::Arena*&&)
Unexecuted instantiation: xmlProtoFuzzer::VersionNum* google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::VersionNum>::Construct<google::protobuf::Arena*>(void*, google::protobuf::Arena*&&)
Unexecuted instantiation: xmlProtoFuzzer::Encodings* google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::Encodings>::Construct<google::protobuf::Arena*>(void*, google::protobuf::Arena*&&)
Unexecuted instantiation: xmlProtoFuzzer::XmlDeclaration* google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::XmlDeclaration>::Construct<google::protobuf::Arena*>(void*, google::protobuf::Arena*&&)
Unexecuted instantiation: xmlProtoFuzzer::XmlDocument* google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::XmlDocument>::Construct<google::protobuf::Arena*>(void*, google::protobuf::Arena*&&)
Unexecuted instantiation: google::protobuf::internal::ImplicitWeakMessage* google::protobuf::Arena::InternalHelper<google::protobuf::internal::ImplicitWeakMessage>::Construct<google::protobuf::Arena*>(void*, google::protobuf::Arena*&&)
490
491
674k
    static inline PROTOBUF_ALWAYS_INLINE T* New() {
492
674k
      return new T(nullptr);
493
674k
    }
google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::Misc>::New()
Line
Count
Source
491
4.89k
    static inline PROTOBUF_ALWAYS_INLINE T* New() {
492
4.89k
      return new T(nullptr);
493
4.89k
    }
Unexecuted instantiation: google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::PEReference>::New()
google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::ElementDecl>::New()
Line
Count
Source
491
5.73k
    static inline PROTOBUF_ALWAYS_INLINE T* New() {
492
5.73k
      return new T(nullptr);
493
5.73k
    }
Unexecuted instantiation: google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::AttrType>::New()
Unexecuted instantiation: google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::EnumeratedType>::New()
Unexecuted instantiation: google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::AttrListDecl>::New()
google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::ExternalId>::New()
Line
Count
Source
491
7.21k
    static inline PROTOBUF_ALWAYS_INLINE T* New() {
492
7.21k
      return new T(nullptr);
493
7.21k
    }
google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::AttValue>::New()
Line
Count
Source
491
2.69k
    static inline PROTOBUF_ALWAYS_INLINE T* New() {
492
2.69k
      return new T(nullptr);
493
2.69k
    }
google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::DefaultDecl>::New()
Line
Count
Source
491
4.58k
    static inline PROTOBUF_ALWAYS_INLINE T* New() {
492
4.58k
      return new T(nullptr);
493
4.58k
    }
google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::AttDef>::New()
Line
Count
Source
491
19.2k
    static inline PROTOBUF_ALWAYS_INLINE T* New() {
492
19.2k
      return new T(nullptr);
493
19.2k
    }
google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::AttListDecl>::New()
Line
Count
Source
491
3.92k
    static inline PROTOBUF_ALWAYS_INLINE T* New() {
492
3.92k
      return new T(nullptr);
493
3.92k
    }
google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::NotationDecl>::New()
Line
Count
Source
491
5.63k
    static inline PROTOBUF_ALWAYS_INLINE T* New() {
492
5.63k
      return new T(nullptr);
493
5.63k
    }
google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::EntityValue>::New()
Line
Count
Source
491
4.36k
    static inline PROTOBUF_ALWAYS_INLINE T* New() {
492
4.36k
      return new T(nullptr);
493
4.36k
    }
google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::NDataDecl>::New()
Line
Count
Source
491
1.71k
    static inline PROTOBUF_ALWAYS_INLINE T* New() {
492
1.71k
      return new T(nullptr);
493
1.71k
    }
google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::EntityDef>::New()
Line
Count
Source
491
7.68k
    static inline PROTOBUF_ALWAYS_INLINE T* New() {
492
7.68k
      return new T(nullptr);
493
7.68k
    }
google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::PEDef>::New()
Line
Count
Source
491
3.42k
    static inline PROTOBUF_ALWAYS_INLINE T* New() {
492
3.42k
      return new T(nullptr);
493
3.42k
    }
google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::EntityDecl>::New()
Line
Count
Source
491
13.0k
    static inline PROTOBUF_ALWAYS_INLINE T* New() {
492
13.0k
      return new T(nullptr);
493
13.0k
    }
google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::ConditionalSect>::New()
Line
Count
Source
491
7.30k
    static inline PROTOBUF_ALWAYS_INLINE T* New() {
492
7.30k
      return new T(nullptr);
493
7.30k
    }
google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::OneExtSubsetDecl>::New()
Line
Count
Source
491
34.5k
    static inline PROTOBUF_ALWAYS_INLINE T* New() {
492
34.5k
      return new T(nullptr);
493
34.5k
    }
google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::ExtSubsetDecl>::New()
Line
Count
Source
491
8.80k
    static inline PROTOBUF_ALWAYS_INLINE T* New() {
492
8.80k
      return new T(nullptr);
493
8.80k
    }
google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::MarkupDecl>::New()
Line
Count
Source
491
42.0k
    static inline PROTOBUF_ALWAYS_INLINE T* New() {
492
42.0k
      return new T(nullptr);
493
42.0k
    }
google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::DocTypeDecl>::New()
Line
Count
Source
491
7.75k
    static inline PROTOBUF_ALWAYS_INLINE T* New() {
492
7.75k
      return new T(nullptr);
493
7.75k
    }
google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::Prolog>::New()
Line
Count
Source
491
8.20k
    static inline PROTOBUF_ALWAYS_INLINE T* New() {
492
8.20k
      return new T(nullptr);
493
8.20k
    }
google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::KeyValue>::New()
Line
Count
Source
491
34.2k
    static inline PROTOBUF_ALWAYS_INLINE T* New() {
492
34.2k
      return new T(nullptr);
493
34.2k
    }
google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::ProcessingInstruction>::New()
Line
Count
Source
491
1.51k
    static inline PROTOBUF_ALWAYS_INLINE T* New() {
492
1.51k
      return new T(nullptr);
493
1.51k
    }
google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::CData>::New()
Line
Count
Source
491
3.65k
    static inline PROTOBUF_ALWAYS_INLINE T* New() {
492
3.65k
      return new T(nullptr);
493
3.65k
    }
google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::Content>::New()
Line
Count
Source
491
21.2k
    static inline PROTOBUF_ALWAYS_INLINE T* New() {
492
21.2k
      return new T(nullptr);
493
21.2k
    }
google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::Element>::New()
Line
Count
Source
491
417k
    static inline PROTOBUF_ALWAYS_INLINE T* New() {
492
417k
      return new T(nullptr);
493
417k
    }
google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::VersionNum>::New()
Line
Count
Source
491
224
    static inline PROTOBUF_ALWAYS_INLINE T* New() {
492
224
      return new T(nullptr);
493
224
    }
google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::Encodings>::New()
Line
Count
Source
491
1.75k
    static inline PROTOBUF_ALWAYS_INLINE T* New() {
492
1.75k
      return new T(nullptr);
493
1.75k
    }
google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::XmlDeclaration>::New()
Line
Count
Source
491
2.11k
    static inline PROTOBUF_ALWAYS_INLINE T* New() {
492
2.11k
      return new T(nullptr);
493
2.11k
    }
Unexecuted instantiation: google::protobuf::Arena::InternalHelper<xmlProtoFuzzer::XmlDocument>::New()
Unexecuted instantiation: google::protobuf::Arena::InternalHelper<google::protobuf::internal::ImplicitWeakMessage>::New()
494
495
    static Arena* GetArena(const T* p) { return p->GetArena(); }
496
497
    friend class Arena;
498
    friend class TestUtil::ReflectionTester;
499
  };
500
501
  // Provides access to protected GetOwningArena to generated messages.  For
502
  // internal use only.
503
  template <typename T>
504
0
  static Arena* InternalGetOwningArena(const T* p) {
505
0
    return InternalHelper<T>::GetOwningArena(p);
506
0
  }
Unexecuted instantiation: google::protobuf::Arena* google::protobuf::Arena::InternalGetOwningArena<xmlProtoFuzzer::ExtSubsetDecl>(xmlProtoFuzzer::ExtSubsetDecl const*)
Unexecuted instantiation: google::protobuf::Arena* google::protobuf::Arena::InternalGetOwningArena<xmlProtoFuzzer::ExternalId>(xmlProtoFuzzer::ExternalId const*)
Unexecuted instantiation: google::protobuf::Arena* google::protobuf::Arena::InternalGetOwningArena<xmlProtoFuzzer::ProcessingInstruction>(xmlProtoFuzzer::ProcessingInstruction const*)
Unexecuted instantiation: google::protobuf::Arena* google::protobuf::Arena::InternalGetOwningArena<xmlProtoFuzzer::EntityValue>(xmlProtoFuzzer::EntityValue const*)
Unexecuted instantiation: google::protobuf::Arena* google::protobuf::Arena::InternalGetOwningArena<xmlProtoFuzzer::MarkupDecl>(xmlProtoFuzzer::MarkupDecl const*)
Unexecuted instantiation: google::protobuf::Arena* google::protobuf::Arena::InternalGetOwningArena<xmlProtoFuzzer::ConditionalSect>(xmlProtoFuzzer::ConditionalSect const*)
Unexecuted instantiation: google::protobuf::Arena* google::protobuf::Arena::InternalGetOwningArena<xmlProtoFuzzer::ElementDecl>(xmlProtoFuzzer::ElementDecl const*)
Unexecuted instantiation: google::protobuf::Arena* google::protobuf::Arena::InternalGetOwningArena<xmlProtoFuzzer::AttListDecl>(xmlProtoFuzzer::AttListDecl const*)
Unexecuted instantiation: google::protobuf::Arena* google::protobuf::Arena::InternalGetOwningArena<xmlProtoFuzzer::NotationDecl>(xmlProtoFuzzer::NotationDecl const*)
Unexecuted instantiation: google::protobuf::Arena* google::protobuf::Arena::InternalGetOwningArena<xmlProtoFuzzer::Misc>(xmlProtoFuzzer::Misc const*)
Unexecuted instantiation: google::protobuf::Arena* google::protobuf::Arena::InternalGetOwningArena<xmlProtoFuzzer::EntityDecl>(xmlProtoFuzzer::EntityDecl const*)
Unexecuted instantiation: google::protobuf::Arena* google::protobuf::Arena::InternalGetOwningArena<xmlProtoFuzzer::Element>(xmlProtoFuzzer::Element const*)
Unexecuted instantiation: google::protobuf::Arena* google::protobuf::Arena::InternalGetOwningArena<xmlProtoFuzzer::CData>(xmlProtoFuzzer::CData const*)
Unexecuted instantiation: google::protobuf::Arena* google::protobuf::Arena::InternalGetOwningArena<xmlProtoFuzzer::AttrType>(xmlProtoFuzzer::AttrType const*)
Unexecuted instantiation: google::protobuf::Arena* google::protobuf::Arena::InternalGetOwningArena<xmlProtoFuzzer::EnumeratedType>(xmlProtoFuzzer::EnumeratedType const*)
Unexecuted instantiation: google::protobuf::Arena* google::protobuf::Arena::InternalGetOwningArena<xmlProtoFuzzer::DefaultDecl>(xmlProtoFuzzer::DefaultDecl const*)
Unexecuted instantiation: google::protobuf::Arena* google::protobuf::Arena::InternalGetOwningArena<xmlProtoFuzzer::AttValue>(xmlProtoFuzzer::AttValue const*)
Unexecuted instantiation: google::protobuf::Arena* google::protobuf::Arena::InternalGetOwningArena<xmlProtoFuzzer::NDataDecl>(xmlProtoFuzzer::NDataDecl const*)
Unexecuted instantiation: google::protobuf::Arena* google::protobuf::Arena::InternalGetOwningArena<xmlProtoFuzzer::EntityDef>(xmlProtoFuzzer::EntityDef const*)
Unexecuted instantiation: google::protobuf::Arena* google::protobuf::Arena::InternalGetOwningArena<xmlProtoFuzzer::PEDef>(xmlProtoFuzzer::PEDef const*)
Unexecuted instantiation: google::protobuf::Arena* google::protobuf::Arena::InternalGetOwningArena<xmlProtoFuzzer::XmlDeclaration>(xmlProtoFuzzer::XmlDeclaration const*)
Unexecuted instantiation: google::protobuf::Arena* google::protobuf::Arena::InternalGetOwningArena<xmlProtoFuzzer::DocTypeDecl>(xmlProtoFuzzer::DocTypeDecl const*)
Unexecuted instantiation: google::protobuf::Arena* google::protobuf::Arena::InternalGetOwningArena<xmlProtoFuzzer::Content>(xmlProtoFuzzer::Content const*)
Unexecuted instantiation: google::protobuf::Arena* google::protobuf::Arena::InternalGetOwningArena<xmlProtoFuzzer::VersionNum>(xmlProtoFuzzer::VersionNum const*)
Unexecuted instantiation: google::protobuf::Arena* google::protobuf::Arena::InternalGetOwningArena<xmlProtoFuzzer::Encodings>(xmlProtoFuzzer::Encodings const*)
Unexecuted instantiation: google::protobuf::Arena* google::protobuf::Arena::InternalGetOwningArena<xmlProtoFuzzer::Prolog>(xmlProtoFuzzer::Prolog const*)
Unexecuted instantiation: google::protobuf::Arena* google::protobuf::Arena::InternalGetOwningArena<google::protobuf::FileOptions>(google::protobuf::FileOptions const*)
Unexecuted instantiation: google::protobuf::Arena* google::protobuf::Arena::InternalGetOwningArena<google::protobuf::SourceCodeInfo>(google::protobuf::SourceCodeInfo const*)
Unexecuted instantiation: google::protobuf::Arena* google::protobuf::Arena::InternalGetOwningArena<google::protobuf::ExtensionRangeOptions>(google::protobuf::ExtensionRangeOptions const*)
Unexecuted instantiation: google::protobuf::Arena* google::protobuf::Arena::InternalGetOwningArena<google::protobuf::MessageOptions>(google::protobuf::MessageOptions const*)
Unexecuted instantiation: google::protobuf::Arena* google::protobuf::Arena::InternalGetOwningArena<google::protobuf::FieldOptions>(google::protobuf::FieldOptions const*)
Unexecuted instantiation: google::protobuf::Arena* google::protobuf::Arena::InternalGetOwningArena<google::protobuf::OneofOptions>(google::protobuf::OneofOptions const*)
Unexecuted instantiation: google::protobuf::Arena* google::protobuf::Arena::InternalGetOwningArena<google::protobuf::EnumOptions>(google::protobuf::EnumOptions const*)
Unexecuted instantiation: google::protobuf::Arena* google::protobuf::Arena::InternalGetOwningArena<google::protobuf::EnumValueOptions>(google::protobuf::EnumValueOptions const*)
Unexecuted instantiation: google::protobuf::Arena* google::protobuf::Arena::InternalGetOwningArena<google::protobuf::ServiceOptions>(google::protobuf::ServiceOptions const*)
Unexecuted instantiation: google::protobuf::Arena* google::protobuf::Arena::InternalGetOwningArena<google::protobuf::MethodOptions>(google::protobuf::MethodOptions const*)
507
508
  // Provides access to protected GetArenaForAllocation to generated messages.
509
  // For internal use only.
510
  template <typename T>
511
  static Arena* InternalGetArenaForAllocation(const T* p) {
512
    return InternalHelper<T>::GetArenaForAllocationInternal(
513
        p, std::is_convertible<T*, MessageLite*>());
514
  }
515
516
  // Creates message-owned arena.  For internal use only.
517
0
  static Arena* InternalCreateMessageOwnedArena() {
518
0
    return new Arena(internal::MessageOwned{});
519
0
  }
520
521
  // Checks whether this arena is message-owned.  For internal use only.
522
0
  bool InternalIsMessageOwnedArena() { return IsMessageOwned(); }
523
524
  // Helper typetraits that indicates support for arenas in a type T at compile
525
  // time. This is public only to allow construction of higher-level templated
526
  // utilities.
527
  //
528
  // is_arena_constructable<T>::value is true if the message type T has arena
529
  // support enabled, and false otherwise.
530
  //
531
  // is_destructor_skippable<T>::value is true if the message type T has told
532
  // the arena that it is safe to skip the destructor, and false otherwise.
533
  //
534
  // This is inside Arena because only Arena has the friend relationships
535
  // necessary to see the underlying generated code traits.
536
  template <typename T>
537
  struct is_arena_constructable : InternalHelper<T>::is_arena_constructable {};
538
  template <typename T>
539
  struct is_destructor_skippable : InternalHelper<T>::is_destructor_skippable {
540
  };
541
542
 private:
543
  internal::ThreadSafeArena impl_;
544
545
  template <typename T>
546
  struct has_get_arena : InternalHelper<T>::has_get_arena {};
547
548
  // Constructor solely used by message-owned arena.
549
0
  inline Arena(internal::MessageOwned) : impl_(internal::MessageOwned{}) {}
550
551
  // Checks whether this arena is message-owned.
552
0
  PROTOBUF_ALWAYS_INLINE bool IsMessageOwned() const {
553
0
    return impl_.IsMessageOwned();
554
0
  }
555
556
0
  void ReturnArrayMemory(void* p, size_t size) {
557
0
    impl_.ReturnArrayMemory(p, size);
558
0
  }
559
560
  template <typename T, typename... Args>
561
  PROTOBUF_NDEBUG_INLINE static T* CreateMessageInternal(Arena* arena,
562
                                                         Args&&... args) {
563
    static_assert(
564
        InternalHelper<T>::is_arena_constructable::value,
565
        "CreateMessage can only construct types that are ArenaConstructable");
566
    if (arena == NULL) {
567
      return new T(nullptr, static_cast<Args&&>(args)...);
568
    } else {
569
      return arena->DoCreateMessage<T>(static_cast<Args&&>(args)...);
570
    }
571
  }
572
573
  // This specialization for no arguments is necessary, because its behavior is
574
  // slightly different.  When the arena pointer is nullptr, it calls T()
575
  // instead of T(nullptr).
576
  template <typename T>
577
674k
  PROTOBUF_NDEBUG_INLINE static T* CreateMessageInternal(Arena* arena) {
578
674k
    static_assert(
579
674k
        InternalHelper<T>::is_arena_constructable::value,
580
674k
        "CreateMessage can only construct types that are ArenaConstructable");
581
674k
    if (arena == NULL) {
582
      // Generated arena constructor T(Arena*) is protected. Call via
583
      // InternalHelper.
584
674k
      return InternalHelper<T>::New();
585
674k
    } else {
586
0
      return arena->DoCreateMessage<T>();
587
0
    }
588
674k
  }
xmlProtoFuzzer::Misc* google::protobuf::Arena::CreateMessageInternal<xmlProtoFuzzer::Misc>(google::protobuf::Arena*)
Line
Count
Source
577
4.89k
  PROTOBUF_NDEBUG_INLINE static T* CreateMessageInternal(Arena* arena) {
578
4.89k
    static_assert(
579
4.89k
        InternalHelper<T>::is_arena_constructable::value,
580
4.89k
        "CreateMessage can only construct types that are ArenaConstructable");
581
4.89k
    if (arena == NULL) {
582
      // Generated arena constructor T(Arena*) is protected. Call via
583
      // InternalHelper.
584
4.89k
      return InternalHelper<T>::New();
585
4.89k
    } else {
586
0
      return arena->DoCreateMessage<T>();
587
0
    }
588
4.89k
  }
Unexecuted instantiation: xmlProtoFuzzer::PEReference* google::protobuf::Arena::CreateMessageInternal<xmlProtoFuzzer::PEReference>(google::protobuf::Arena*)
xmlProtoFuzzer::ElementDecl* google::protobuf::Arena::CreateMessageInternal<xmlProtoFuzzer::ElementDecl>(google::protobuf::Arena*)
Line
Count
Source
577
5.73k
  PROTOBUF_NDEBUG_INLINE static T* CreateMessageInternal(Arena* arena) {
578
5.73k
    static_assert(
579
5.73k
        InternalHelper<T>::is_arena_constructable::value,
580
5.73k
        "CreateMessage can only construct types that are ArenaConstructable");
581
5.73k
    if (arena == NULL) {
582
      // Generated arena constructor T(Arena*) is protected. Call via
583
      // InternalHelper.
584
5.73k
      return InternalHelper<T>::New();
585
5.73k
    } else {
586
0
      return arena->DoCreateMessage<T>();
587
0
    }
588
5.73k
  }
Unexecuted instantiation: xmlProtoFuzzer::AttrType* google::protobuf::Arena::CreateMessageInternal<xmlProtoFuzzer::AttrType>(google::protobuf::Arena*)
Unexecuted instantiation: xmlProtoFuzzer::EnumeratedType* google::protobuf::Arena::CreateMessageInternal<xmlProtoFuzzer::EnumeratedType>(google::protobuf::Arena*)
Unexecuted instantiation: xmlProtoFuzzer::AttrListDecl* google::protobuf::Arena::CreateMessageInternal<xmlProtoFuzzer::AttrListDecl>(google::protobuf::Arena*)
xmlProtoFuzzer::ExternalId* google::protobuf::Arena::CreateMessageInternal<xmlProtoFuzzer::ExternalId>(google::protobuf::Arena*)
Line
Count
Source
577
7.21k
  PROTOBUF_NDEBUG_INLINE static T* CreateMessageInternal(Arena* arena) {
578
7.21k
    static_assert(
579
7.21k
        InternalHelper<T>::is_arena_constructable::value,
580
7.21k
        "CreateMessage can only construct types that are ArenaConstructable");
581
7.21k
    if (arena == NULL) {
582
      // Generated arena constructor T(Arena*) is protected. Call via
583
      // InternalHelper.
584
7.21k
      return InternalHelper<T>::New();
585
7.21k
    } else {
586
0
      return arena->DoCreateMessage<T>();
587
0
    }
588
7.21k
  }
xmlProtoFuzzer::AttValue* google::protobuf::Arena::CreateMessageInternal<xmlProtoFuzzer::AttValue>(google::protobuf::Arena*)
Line
Count
Source
577
2.69k
  PROTOBUF_NDEBUG_INLINE static T* CreateMessageInternal(Arena* arena) {
578
2.69k
    static_assert(
579
2.69k
        InternalHelper<T>::is_arena_constructable::value,
580
2.69k
        "CreateMessage can only construct types that are ArenaConstructable");
581
2.69k
    if (arena == NULL) {
582
      // Generated arena constructor T(Arena*) is protected. Call via
583
      // InternalHelper.
584
2.69k
      return InternalHelper<T>::New();
585
2.69k
    } else {
586
0
      return arena->DoCreateMessage<T>();
587
0
    }
588
2.69k
  }
xmlProtoFuzzer::DefaultDecl* google::protobuf::Arena::CreateMessageInternal<xmlProtoFuzzer::DefaultDecl>(google::protobuf::Arena*)
Line
Count
Source
577
4.58k
  PROTOBUF_NDEBUG_INLINE static T* CreateMessageInternal(Arena* arena) {
578
4.58k
    static_assert(
579
4.58k
        InternalHelper<T>::is_arena_constructable::value,
580
4.58k
        "CreateMessage can only construct types that are ArenaConstructable");
581
4.58k
    if (arena == NULL) {
582
      // Generated arena constructor T(Arena*) is protected. Call via
583
      // InternalHelper.
584
4.58k
      return InternalHelper<T>::New();
585
4.58k
    } else {
586
0
      return arena->DoCreateMessage<T>();
587
0
    }
588
4.58k
  }
xmlProtoFuzzer::AttDef* google::protobuf::Arena::CreateMessageInternal<xmlProtoFuzzer::AttDef>(google::protobuf::Arena*)
Line
Count
Source
577
19.2k
  PROTOBUF_NDEBUG_INLINE static T* CreateMessageInternal(Arena* arena) {
578
19.2k
    static_assert(
579
19.2k
        InternalHelper<T>::is_arena_constructable::value,
580
19.2k
        "CreateMessage can only construct types that are ArenaConstructable");
581
19.2k
    if (arena == NULL) {
582
      // Generated arena constructor T(Arena*) is protected. Call via
583
      // InternalHelper.
584
19.2k
      return InternalHelper<T>::New();
585
19.2k
    } else {
586
0
      return arena->DoCreateMessage<T>();
587
0
    }
588
19.2k
  }
xmlProtoFuzzer::AttListDecl* google::protobuf::Arena::CreateMessageInternal<xmlProtoFuzzer::AttListDecl>(google::protobuf::Arena*)
Line
Count
Source
577
3.92k
  PROTOBUF_NDEBUG_INLINE static T* CreateMessageInternal(Arena* arena) {
578
3.92k
    static_assert(
579
3.92k
        InternalHelper<T>::is_arena_constructable::value,
580
3.92k
        "CreateMessage can only construct types that are ArenaConstructable");
581
3.92k
    if (arena == NULL) {
582
      // Generated arena constructor T(Arena*) is protected. Call via
583
      // InternalHelper.
584
3.92k
      return InternalHelper<T>::New();
585
3.92k
    } else {
586
0
      return arena->DoCreateMessage<T>();
587
0
    }
588
3.92k
  }
xmlProtoFuzzer::NotationDecl* google::protobuf::Arena::CreateMessageInternal<xmlProtoFuzzer::NotationDecl>(google::protobuf::Arena*)
Line
Count
Source
577
5.63k
  PROTOBUF_NDEBUG_INLINE static T* CreateMessageInternal(Arena* arena) {
578
5.63k
    static_assert(
579
5.63k
        InternalHelper<T>::is_arena_constructable::value,
580
5.63k
        "CreateMessage can only construct types that are ArenaConstructable");
581
5.63k
    if (arena == NULL) {
582
      // Generated arena constructor T(Arena*) is protected. Call via
583
      // InternalHelper.
584
5.63k
      return InternalHelper<T>::New();
585
5.63k
    } else {
586
0
      return arena->DoCreateMessage<T>();
587
0
    }
588
5.63k
  }
xmlProtoFuzzer::EntityValue* google::protobuf::Arena::CreateMessageInternal<xmlProtoFuzzer::EntityValue>(google::protobuf::Arena*)
Line
Count
Source
577
4.36k
  PROTOBUF_NDEBUG_INLINE static T* CreateMessageInternal(Arena* arena) {
578
4.36k
    static_assert(
579
4.36k
        InternalHelper<T>::is_arena_constructable::value,
580
4.36k
        "CreateMessage can only construct types that are ArenaConstructable");
581
4.36k
    if (arena == NULL) {
582
      // Generated arena constructor T(Arena*) is protected. Call via
583
      // InternalHelper.
584
4.36k
      return InternalHelper<T>::New();
585
4.36k
    } else {
586
0
      return arena->DoCreateMessage<T>();
587
0
    }
588
4.36k
  }
xmlProtoFuzzer::NDataDecl* google::protobuf::Arena::CreateMessageInternal<xmlProtoFuzzer::NDataDecl>(google::protobuf::Arena*)
Line
Count
Source
577
1.71k
  PROTOBUF_NDEBUG_INLINE static T* CreateMessageInternal(Arena* arena) {
578
1.71k
    static_assert(
579
1.71k
        InternalHelper<T>::is_arena_constructable::value,
580
1.71k
        "CreateMessage can only construct types that are ArenaConstructable");
581
1.71k
    if (arena == NULL) {
582
      // Generated arena constructor T(Arena*) is protected. Call via
583
      // InternalHelper.
584
1.71k
      return InternalHelper<T>::New();
585
1.71k
    } else {
586
0
      return arena->DoCreateMessage<T>();
587
0
    }
588
1.71k
  }
xmlProtoFuzzer::EntityDef* google::protobuf::Arena::CreateMessageInternal<xmlProtoFuzzer::EntityDef>(google::protobuf::Arena*)
Line
Count
Source
577
7.68k
  PROTOBUF_NDEBUG_INLINE static T* CreateMessageInternal(Arena* arena) {
578
7.68k
    static_assert(
579
7.68k
        InternalHelper<T>::is_arena_constructable::value,
580
7.68k
        "CreateMessage can only construct types that are ArenaConstructable");
581
7.68k
    if (arena == NULL) {
582
      // Generated arena constructor T(Arena*) is protected. Call via
583
      // InternalHelper.
584
7.68k
      return InternalHelper<T>::New();
585
7.68k
    } else {
586
0
      return arena->DoCreateMessage<T>();
587
0
    }
588
7.68k
  }
xmlProtoFuzzer::PEDef* google::protobuf::Arena::CreateMessageInternal<xmlProtoFuzzer::PEDef>(google::protobuf::Arena*)
Line
Count
Source
577
3.42k
  PROTOBUF_NDEBUG_INLINE static T* CreateMessageInternal(Arena* arena) {
578
3.42k
    static_assert(
579
3.42k
        InternalHelper<T>::is_arena_constructable::value,
580
3.42k
        "CreateMessage can only construct types that are ArenaConstructable");
581
3.42k
    if (arena == NULL) {
582
      // Generated arena constructor T(Arena*) is protected. Call via
583
      // InternalHelper.
584
3.42k
      return InternalHelper<T>::New();
585
3.42k
    } else {
586
0
      return arena->DoCreateMessage<T>();
587
0
    }
588
3.42k
  }
xmlProtoFuzzer::EntityDecl* google::protobuf::Arena::CreateMessageInternal<xmlProtoFuzzer::EntityDecl>(google::protobuf::Arena*)
Line
Count
Source
577
13.0k
  PROTOBUF_NDEBUG_INLINE static T* CreateMessageInternal(Arena* arena) {
578
13.0k
    static_assert(
579
13.0k
        InternalHelper<T>::is_arena_constructable::value,
580
13.0k
        "CreateMessage can only construct types that are ArenaConstructable");
581
13.0k
    if (arena == NULL) {
582
      // Generated arena constructor T(Arena*) is protected. Call via
583
      // InternalHelper.
584
13.0k
      return InternalHelper<T>::New();
585
13.0k
    } else {
586
0
      return arena->DoCreateMessage<T>();
587
0
    }
588
13.0k
  }
xmlProtoFuzzer::ConditionalSect* google::protobuf::Arena::CreateMessageInternal<xmlProtoFuzzer::ConditionalSect>(google::protobuf::Arena*)
Line
Count
Source
577
7.30k
  PROTOBUF_NDEBUG_INLINE static T* CreateMessageInternal(Arena* arena) {
578
7.30k
    static_assert(
579
7.30k
        InternalHelper<T>::is_arena_constructable::value,
580
7.30k
        "CreateMessage can only construct types that are ArenaConstructable");
581
7.30k
    if (arena == NULL) {
582
      // Generated arena constructor T(Arena*) is protected. Call via
583
      // InternalHelper.
584
7.30k
      return InternalHelper<T>::New();
585
7.30k
    } else {
586
0
      return arena->DoCreateMessage<T>();
587
0
    }
588
7.30k
  }
xmlProtoFuzzer::OneExtSubsetDecl* google::protobuf::Arena::CreateMessageInternal<xmlProtoFuzzer::OneExtSubsetDecl>(google::protobuf::Arena*)
Line
Count
Source
577
34.5k
  PROTOBUF_NDEBUG_INLINE static T* CreateMessageInternal(Arena* arena) {
578
34.5k
    static_assert(
579
34.5k
        InternalHelper<T>::is_arena_constructable::value,
580
34.5k
        "CreateMessage can only construct types that are ArenaConstructable");
581
34.5k
    if (arena == NULL) {
582
      // Generated arena constructor T(Arena*) is protected. Call via
583
      // InternalHelper.
584
34.5k
      return InternalHelper<T>::New();
585
34.5k
    } else {
586
0
      return arena->DoCreateMessage<T>();
587
0
    }
588
34.5k
  }
xmlProtoFuzzer::ExtSubsetDecl* google::protobuf::Arena::CreateMessageInternal<xmlProtoFuzzer::ExtSubsetDecl>(google::protobuf::Arena*)
Line
Count
Source
577
8.80k
  PROTOBUF_NDEBUG_INLINE static T* CreateMessageInternal(Arena* arena) {
578
8.80k
    static_assert(
579
8.80k
        InternalHelper<T>::is_arena_constructable::value,
580
8.80k
        "CreateMessage can only construct types that are ArenaConstructable");
581
8.80k
    if (arena == NULL) {
582
      // Generated arena constructor T(Arena*) is protected. Call via
583
      // InternalHelper.
584
8.80k
      return InternalHelper<T>::New();
585
8.80k
    } else {
586
0
      return arena->DoCreateMessage<T>();
587
0
    }
588
8.80k
  }
xmlProtoFuzzer::MarkupDecl* google::protobuf::Arena::CreateMessageInternal<xmlProtoFuzzer::MarkupDecl>(google::protobuf::Arena*)
Line
Count
Source
577
42.0k
  PROTOBUF_NDEBUG_INLINE static T* CreateMessageInternal(Arena* arena) {
578
42.0k
    static_assert(
579
42.0k
        InternalHelper<T>::is_arena_constructable::value,
580
42.0k
        "CreateMessage can only construct types that are ArenaConstructable");
581
42.0k
    if (arena == NULL) {
582
      // Generated arena constructor T(Arena*) is protected. Call via
583
      // InternalHelper.
584
42.0k
      return InternalHelper<T>::New();
585
42.0k
    } else {
586
0
      return arena->DoCreateMessage<T>();
587
0
    }
588
42.0k
  }
xmlProtoFuzzer::DocTypeDecl* google::protobuf::Arena::CreateMessageInternal<xmlProtoFuzzer::DocTypeDecl>(google::protobuf::Arena*)
Line
Count
Source
577
7.75k
  PROTOBUF_NDEBUG_INLINE static T* CreateMessageInternal(Arena* arena) {
578
7.75k
    static_assert(
579
7.75k
        InternalHelper<T>::is_arena_constructable::value,
580
7.75k
        "CreateMessage can only construct types that are ArenaConstructable");
581
7.75k
    if (arena == NULL) {
582
      // Generated arena constructor T(Arena*) is protected. Call via
583
      // InternalHelper.
584
7.75k
      return InternalHelper<T>::New();
585
7.75k
    } else {
586
0
      return arena->DoCreateMessage<T>();
587
0
    }
588
7.75k
  }
xmlProtoFuzzer::Prolog* google::protobuf::Arena::CreateMessageInternal<xmlProtoFuzzer::Prolog>(google::protobuf::Arena*)
Line
Count
Source
577
8.20k
  PROTOBUF_NDEBUG_INLINE static T* CreateMessageInternal(Arena* arena) {
578
8.20k
    static_assert(
579
8.20k
        InternalHelper<T>::is_arena_constructable::value,
580
8.20k
        "CreateMessage can only construct types that are ArenaConstructable");
581
8.20k
    if (arena == NULL) {
582
      // Generated arena constructor T(Arena*) is protected. Call via
583
      // InternalHelper.
584
8.20k
      return InternalHelper<T>::New();
585
8.20k
    } else {
586
0
      return arena->DoCreateMessage<T>();
587
0
    }
588
8.20k
  }
xmlProtoFuzzer::KeyValue* google::protobuf::Arena::CreateMessageInternal<xmlProtoFuzzer::KeyValue>(google::protobuf::Arena*)
Line
Count
Source
577
34.2k
  PROTOBUF_NDEBUG_INLINE static T* CreateMessageInternal(Arena* arena) {
578
34.2k
    static_assert(
579
34.2k
        InternalHelper<T>::is_arena_constructable::value,
580
34.2k
        "CreateMessage can only construct types that are ArenaConstructable");
581
34.2k
    if (arena == NULL) {
582
      // Generated arena constructor T(Arena*) is protected. Call via
583
      // InternalHelper.
584
34.2k
      return InternalHelper<T>::New();
585
34.2k
    } else {
586
0
      return arena->DoCreateMessage<T>();
587
0
    }
588
34.2k
  }
xmlProtoFuzzer::ProcessingInstruction* google::protobuf::Arena::CreateMessageInternal<xmlProtoFuzzer::ProcessingInstruction>(google::protobuf::Arena*)
Line
Count
Source
577
1.51k
  PROTOBUF_NDEBUG_INLINE static T* CreateMessageInternal(Arena* arena) {
578
1.51k
    static_assert(
579
1.51k
        InternalHelper<T>::is_arena_constructable::value,
580
1.51k
        "CreateMessage can only construct types that are ArenaConstructable");
581
1.51k
    if (arena == NULL) {
582
      // Generated arena constructor T(Arena*) is protected. Call via
583
      // InternalHelper.
584
1.51k
      return InternalHelper<T>::New();
585
1.51k
    } else {
586
0
      return arena->DoCreateMessage<T>();
587
0
    }
588
1.51k
  }
xmlProtoFuzzer::CData* google::protobuf::Arena::CreateMessageInternal<xmlProtoFuzzer::CData>(google::protobuf::Arena*)
Line
Count
Source
577
3.65k
  PROTOBUF_NDEBUG_INLINE static T* CreateMessageInternal(Arena* arena) {
578
3.65k
    static_assert(
579
3.65k
        InternalHelper<T>::is_arena_constructable::value,
580
3.65k
        "CreateMessage can only construct types that are ArenaConstructable");
581
3.65k
    if (arena == NULL) {
582
      // Generated arena constructor T(Arena*) is protected. Call via
583
      // InternalHelper.
584
3.65k
      return InternalHelper<T>::New();
585
3.65k
    } else {
586
0
      return arena->DoCreateMessage<T>();
587
0
    }
588
3.65k
  }
xmlProtoFuzzer::Content* google::protobuf::Arena::CreateMessageInternal<xmlProtoFuzzer::Content>(google::protobuf::Arena*)
Line
Count
Source
577
21.2k
  PROTOBUF_NDEBUG_INLINE static T* CreateMessageInternal(Arena* arena) {
578
21.2k
    static_assert(
579
21.2k
        InternalHelper<T>::is_arena_constructable::value,
580
21.2k
        "CreateMessage can only construct types that are ArenaConstructable");
581
21.2k
    if (arena == NULL) {
582
      // Generated arena constructor T(Arena*) is protected. Call via
583
      // InternalHelper.
584
21.2k
      return InternalHelper<T>::New();
585
21.2k
    } else {
586
0
      return arena->DoCreateMessage<T>();
587
0
    }
588
21.2k
  }
xmlProtoFuzzer::Element* google::protobuf::Arena::CreateMessageInternal<xmlProtoFuzzer::Element>(google::protobuf::Arena*)
Line
Count
Source
577
417k
  PROTOBUF_NDEBUG_INLINE static T* CreateMessageInternal(Arena* arena) {
578
417k
    static_assert(
579
417k
        InternalHelper<T>::is_arena_constructable::value,
580
417k
        "CreateMessage can only construct types that are ArenaConstructable");
581
417k
    if (arena == NULL) {
582
      // Generated arena constructor T(Arena*) is protected. Call via
583
      // InternalHelper.
584
417k
      return InternalHelper<T>::New();
585
417k
    } else {
586
0
      return arena->DoCreateMessage<T>();
587
0
    }
588
417k
  }
xmlProtoFuzzer::VersionNum* google::protobuf::Arena::CreateMessageInternal<xmlProtoFuzzer::VersionNum>(google::protobuf::Arena*)
Line
Count
Source
577
224
  PROTOBUF_NDEBUG_INLINE static T* CreateMessageInternal(Arena* arena) {
578
224
    static_assert(
579
224
        InternalHelper<T>::is_arena_constructable::value,
580
224
        "CreateMessage can only construct types that are ArenaConstructable");
581
224
    if (arena == NULL) {
582
      // Generated arena constructor T(Arena*) is protected. Call via
583
      // InternalHelper.
584
224
      return InternalHelper<T>::New();
585
224
    } else {
586
0
      return arena->DoCreateMessage<T>();
587
0
    }
588
224
  }
xmlProtoFuzzer::Encodings* google::protobuf::Arena::CreateMessageInternal<xmlProtoFuzzer::Encodings>(google::protobuf::Arena*)
Line
Count
Source
577
1.75k
  PROTOBUF_NDEBUG_INLINE static T* CreateMessageInternal(Arena* arena) {
578
1.75k
    static_assert(
579
1.75k
        InternalHelper<T>::is_arena_constructable::value,
580
1.75k
        "CreateMessage can only construct types that are ArenaConstructable");
581
1.75k
    if (arena == NULL) {
582
      // Generated arena constructor T(Arena*) is protected. Call via
583
      // InternalHelper.
584
1.75k
      return InternalHelper<T>::New();
585
1.75k
    } else {
586
0
      return arena->DoCreateMessage<T>();
587
0
    }
588
1.75k
  }
xmlProtoFuzzer::XmlDeclaration* google::protobuf::Arena::CreateMessageInternal<xmlProtoFuzzer::XmlDeclaration>(google::protobuf::Arena*)
Line
Count
Source
577
2.11k
  PROTOBUF_NDEBUG_INLINE static T* CreateMessageInternal(Arena* arena) {
578
2.11k
    static_assert(
579
2.11k
        InternalHelper<T>::is_arena_constructable::value,
580
2.11k
        "CreateMessage can only construct types that are ArenaConstructable");
581
2.11k
    if (arena == NULL) {
582
      // Generated arena constructor T(Arena*) is protected. Call via
583
      // InternalHelper.
584
2.11k
      return InternalHelper<T>::New();
585
2.11k
    } else {
586
0
      return arena->DoCreateMessage<T>();
587
0
    }
588
2.11k
  }
Unexecuted instantiation: xmlProtoFuzzer::XmlDocument* google::protobuf::Arena::CreateMessageInternal<xmlProtoFuzzer::XmlDocument>(google::protobuf::Arena*)
Unexecuted instantiation: google::protobuf::internal::ImplicitWeakMessage* google::protobuf::Arena::CreateMessageInternal<google::protobuf::internal::ImplicitWeakMessage>(google::protobuf::Arena*)
589
590
  // Allocate and also optionally call collector with the allocated type info
591
  // when allocation recording is enabled.
592
  PROTOBUF_NDEBUG_INLINE void* AllocateInternal(size_t size, size_t align,
593
                                                void (*destructor)(void*),
594
0
                                                const std::type_info* type) {
595
    // Monitor allocation if needed.
596
0
    if (destructor == nullptr) {
597
0
      return AllocateAlignedWithHook(size, align, type);
598
0
    } else {
599
0
      if (align <= 8) {
600
0
        auto res = AllocateAlignedWithCleanup(internal::AlignUpTo8(size), type);
601
0
        res.second->elem = res.first;
602
0
        res.second->cleanup = destructor;
603
0
        return res.first;
604
0
      } else {
605
0
        auto res = AllocateAlignedWithCleanup(size + align - 8, type);
606
0
        auto ptr = internal::AlignTo(res.first, align);
607
0
        res.second->elem = ptr;
608
0
        res.second->cleanup = destructor;
609
0
        return ptr;
610
0
      }
611
0
    }
612
0
  }
613
614
  // CreateMessage<T> requires that T supports arenas, but this private method
615
  // works whether or not T supports arenas. These are not exposed to user code
616
  // as it can cause confusing API usages, and end up having double free in
617
  // user code. These are used only internally from LazyField and Repeated
618
  // fields, since they are designed to work in all mode combinations.
619
  template <typename Msg, typename... Args>
620
  PROTOBUF_ALWAYS_INLINE static Msg* DoCreateMaybeMessage(Arena* arena,
621
                                                          std::true_type,
622
0
                                                          Args&&... args) {
623
0
    return CreateMessageInternal<Msg>(arena, std::forward<Args>(args)...);
624
0
  }
625
626
  template <typename T, typename... Args>
627
  PROTOBUF_ALWAYS_INLINE static T* DoCreateMaybeMessage(Arena* arena,
628
                                                        std::false_type,
629
                                                        Args&&... args) {
630
    return Create<T>(arena, std::forward<Args>(args)...);
631
  }
632
633
  template <typename T, typename... Args>
634
  PROTOBUF_ALWAYS_INLINE static T* CreateMaybeMessage(Arena* arena,
635
0
                                                      Args&&... args) {
636
0
    return DoCreateMaybeMessage<T>(arena, is_arena_constructable<T>(),
637
0
                                   std::forward<Args>(args)...);
638
0
  }
639
640
  // Just allocate the required size for the given type assuming the
641
  // type has a trivial constructor.
642
  template <typename T>
643
  PROTOBUF_NDEBUG_INLINE T* CreateInternalRawArray(size_t num_elements) {
644
    GOOGLE_CHECK_LE(num_elements, std::numeric_limits<size_t>::max() / sizeof(T))
645
        << "Requested size is too large to fit into size_t.";
646
    // We count on compiler to realize that if sizeof(T) is a multiple of
647
    // 8 AlignUpTo can be elided.
648
    const size_t n = sizeof(T) * num_elements;
649
    return static_cast<T*>(
650
        AllocateAlignedWithHookForArray(n, alignof(T), RTTI_TYPE_ID(T)));
651
  }
652
653
  template <typename T, typename... Args>
654
0
  PROTOBUF_NDEBUG_INLINE T* DoCreateMessage(Args&&... args) {
655
0
    return InternalHelper<T>::Construct(
656
0
        AllocateInternal(sizeof(T), alignof(T),
657
0
                         internal::ObjectDestructor<
658
0
                             InternalHelper<T>::is_destructor_skippable::value,
659
0
                             T>::destructor,
660
0
                         RTTI_TYPE_ID(T)),
661
0
        this, std::forward<Args>(args)...);
662
0
  }
Unexecuted instantiation: xmlProtoFuzzer::Misc* google::protobuf::Arena::DoCreateMessage<xmlProtoFuzzer::Misc>()
Unexecuted instantiation: xmlProtoFuzzer::PEReference* google::protobuf::Arena::DoCreateMessage<xmlProtoFuzzer::PEReference>()
Unexecuted instantiation: xmlProtoFuzzer::ElementDecl* google::protobuf::Arena::DoCreateMessage<xmlProtoFuzzer::ElementDecl>()
Unexecuted instantiation: xmlProtoFuzzer::AttrType* google::protobuf::Arena::DoCreateMessage<xmlProtoFuzzer::AttrType>()
Unexecuted instantiation: xmlProtoFuzzer::EnumeratedType* google::protobuf::Arena::DoCreateMessage<xmlProtoFuzzer::EnumeratedType>()
Unexecuted instantiation: xmlProtoFuzzer::AttrListDecl* google::protobuf::Arena::DoCreateMessage<xmlProtoFuzzer::AttrListDecl>()
Unexecuted instantiation: xmlProtoFuzzer::ExternalId* google::protobuf::Arena::DoCreateMessage<xmlProtoFuzzer::ExternalId>()
Unexecuted instantiation: xmlProtoFuzzer::AttValue* google::protobuf::Arena::DoCreateMessage<xmlProtoFuzzer::AttValue>()
Unexecuted instantiation: xmlProtoFuzzer::DefaultDecl* google::protobuf::Arena::DoCreateMessage<xmlProtoFuzzer::DefaultDecl>()
Unexecuted instantiation: xmlProtoFuzzer::AttDef* google::protobuf::Arena::DoCreateMessage<xmlProtoFuzzer::AttDef>()
Unexecuted instantiation: xmlProtoFuzzer::AttListDecl* google::protobuf::Arena::DoCreateMessage<xmlProtoFuzzer::AttListDecl>()
Unexecuted instantiation: xmlProtoFuzzer::NotationDecl* google::protobuf::Arena::DoCreateMessage<xmlProtoFuzzer::NotationDecl>()
Unexecuted instantiation: xmlProtoFuzzer::EntityValue* google::protobuf::Arena::DoCreateMessage<xmlProtoFuzzer::EntityValue>()
Unexecuted instantiation: xmlProtoFuzzer::NDataDecl* google::protobuf::Arena::DoCreateMessage<xmlProtoFuzzer::NDataDecl>()
Unexecuted instantiation: xmlProtoFuzzer::EntityDef* google::protobuf::Arena::DoCreateMessage<xmlProtoFuzzer::EntityDef>()
Unexecuted instantiation: xmlProtoFuzzer::PEDef* google::protobuf::Arena::DoCreateMessage<xmlProtoFuzzer::PEDef>()
Unexecuted instantiation: xmlProtoFuzzer::EntityDecl* google::protobuf::Arena::DoCreateMessage<xmlProtoFuzzer::EntityDecl>()
Unexecuted instantiation: xmlProtoFuzzer::ConditionalSect* google::protobuf::Arena::DoCreateMessage<xmlProtoFuzzer::ConditionalSect>()
Unexecuted instantiation: xmlProtoFuzzer::OneExtSubsetDecl* google::protobuf::Arena::DoCreateMessage<xmlProtoFuzzer::OneExtSubsetDecl>()
Unexecuted instantiation: xmlProtoFuzzer::ExtSubsetDecl* google::protobuf::Arena::DoCreateMessage<xmlProtoFuzzer::ExtSubsetDecl>()
Unexecuted instantiation: xmlProtoFuzzer::MarkupDecl* google::protobuf::Arena::DoCreateMessage<xmlProtoFuzzer::MarkupDecl>()
Unexecuted instantiation: xmlProtoFuzzer::DocTypeDecl* google::protobuf::Arena::DoCreateMessage<xmlProtoFuzzer::DocTypeDecl>()
Unexecuted instantiation: xmlProtoFuzzer::Prolog* google::protobuf::Arena::DoCreateMessage<xmlProtoFuzzer::Prolog>()
Unexecuted instantiation: xmlProtoFuzzer::KeyValue* google::protobuf::Arena::DoCreateMessage<xmlProtoFuzzer::KeyValue>()
Unexecuted instantiation: xmlProtoFuzzer::ProcessingInstruction* google::protobuf::Arena::DoCreateMessage<xmlProtoFuzzer::ProcessingInstruction>()
Unexecuted instantiation: xmlProtoFuzzer::CData* google::protobuf::Arena::DoCreateMessage<xmlProtoFuzzer::CData>()
Unexecuted instantiation: xmlProtoFuzzer::Content* google::protobuf::Arena::DoCreateMessage<xmlProtoFuzzer::Content>()
Unexecuted instantiation: xmlProtoFuzzer::Element* google::protobuf::Arena::DoCreateMessage<xmlProtoFuzzer::Element>()
Unexecuted instantiation: xmlProtoFuzzer::VersionNum* google::protobuf::Arena::DoCreateMessage<xmlProtoFuzzer::VersionNum>()
Unexecuted instantiation: xmlProtoFuzzer::Encodings* google::protobuf::Arena::DoCreateMessage<xmlProtoFuzzer::Encodings>()
Unexecuted instantiation: xmlProtoFuzzer::XmlDeclaration* google::protobuf::Arena::DoCreateMessage<xmlProtoFuzzer::XmlDeclaration>()
Unexecuted instantiation: xmlProtoFuzzer::XmlDocument* google::protobuf::Arena::DoCreateMessage<xmlProtoFuzzer::XmlDocument>()
Unexecuted instantiation: google::protobuf::internal::ImplicitWeakMessage* google::protobuf::Arena::DoCreateMessage<google::protobuf::internal::ImplicitWeakMessage>()
663
664
  // CreateInArenaStorage is used to implement map field. Without it,
665
  // Map need to call generated message's protected arena constructor,
666
  // which needs to declare Map as friend of generated message.
667
  template <typename T, typename... Args>
668
  static void CreateInArenaStorage(T* ptr, Arena* arena, Args&&... args) {
669
    CreateInArenaStorageInternal(ptr, arena,
670
                                 typename is_arena_constructable<T>::type(),
671
                                 std::forward<Args>(args)...);
672
    if (arena != nullptr) {
673
      RegisterDestructorInternal(
674
          ptr, arena,
675
          typename InternalHelper<T>::is_destructor_skippable::type());
676
    }
677
  }
678
679
  template <typename T, typename... Args>
680
  static void CreateInArenaStorageInternal(T* ptr, Arena* arena,
681
                                           std::true_type, Args&&... args) {
682
    InternalHelper<T>::Construct(ptr, arena, std::forward<Args>(args)...);
683
  }
684
  template <typename T, typename... Args>
685
  static void CreateInArenaStorageInternal(T* ptr, Arena* /* arena */,
686
                                           std::false_type, Args&&... args) {
687
    new (ptr) T(std::forward<Args>(args)...);
688
  }
689
690
  template <typename T>
691
  static void RegisterDestructorInternal(T* /* ptr */, Arena* /* arena */,
692
                                         std::true_type) {}
693
  template <typename T>
694
  static void RegisterDestructorInternal(T* ptr, Arena* arena,
695
                                         std::false_type) {
696
    arena->OwnDestructor(ptr);
697
  }
698
699
  // These implement Create(). The second parameter has type 'true_type' if T is
700
  // a subtype of Message and 'false_type' otherwise.
701
  template <typename T, typename... Args>
702
  PROTOBUF_ALWAYS_INLINE static T* CreateInternal(Arena* arena, std::true_type,
703
                                                  Args&&... args) {
704
    if (arena == nullptr) {
705
      return new T(std::forward<Args>(args)...);
706
    } else {
707
      auto destructor =
708
          internal::ObjectDestructor<std::is_trivially_destructible<T>::value,
709
                                     T>::destructor;
710
      T* result =
711
          new (arena->AllocateInternal(sizeof(T), alignof(T), destructor,
712
                                       RTTI_TYPE_ID(T)))
713
          T(std::forward<Args>(args)...);
714
      return result;
715
    }
716
  }
717
  template <typename T, typename... Args>
718
  PROTOBUF_ALWAYS_INLINE static T* CreateInternal(Arena* arena, std::false_type,
719
0
                                                  Args&&... args) {
720
0
    if (arena == nullptr) {
721
0
      return new T(std::forward<Args>(args)...);
722
0
    } else {
723
0
      auto destructor =
724
0
          internal::ObjectDestructor<std::is_trivially_destructible<T>::value,
725
0
                                     T>::destructor;
726
0
      return new (arena->AllocateInternal(sizeof(T), alignof(T), destructor,
727
0
                                          RTTI_TYPE_ID(T)))
728
0
          T(std::forward<Args>(args)...);
729
0
    }
730
0
  }
Unexecuted instantiation: std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >* google::protobuf::Arena::CreateInternal<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >>(google::protobuf::Arena*, std::__1::integral_constant<bool, false>)
Unexecuted instantiation: google::protobuf::internal::InternalMetadata::Container<google::protobuf::UnknownFieldSet>* google::protobuf::Arena::CreateInternal<google::protobuf::internal::InternalMetadata::Container<google::protobuf::UnknownFieldSet>>(google::protobuf::Arena*, std::__1::integral_constant<bool, false>)
Unexecuted instantiation: google::protobuf::internal::InternalMetadata::Container<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >* google::protobuf::Arena::CreateInternal<google::protobuf::internal::InternalMetadata::Container<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >>(google::protobuf::Arena*, std::__1::integral_constant<bool, false>)
Unexecuted instantiation: std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >* google::protobuf::Arena::CreateInternal<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(google::protobuf::Arena*, std::__1::integral_constant<bool, false>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&&)
731
732
  // These implement Own(), which registers an object for deletion (destructor
733
  // call and operator delete()). The second parameter has type 'true_type' if T
734
  // is a subtype of Message and 'false_type' otherwise. Collapsing
735
  // all template instantiations to one for generic Message reduces code size,
736
  // using the virtual destructor instead.
737
  template <typename T>
738
  PROTOBUF_ALWAYS_INLINE void OwnInternal(T* object, std::true_type) {
739
    if (object != NULL) {
740
      impl_.AddCleanup(object, &internal::arena_delete_object<MessageLite>);
741
    }
742
  }
743
  template <typename T>
744
0
  PROTOBUF_ALWAYS_INLINE void OwnInternal(T* object, std::false_type) {
745
0
    if (object != NULL) {
746
0
      impl_.AddCleanup(object, &internal::arena_delete_object<T>);
747
0
    }
748
0
  }
749
750
  // Implementation for GetArena(). Only message objects with
751
  // InternalArenaConstructable_ tags can be associated with an arena, and such
752
  // objects must implement a GetArena() method.
753
  template <typename T, typename std::enable_if<
754
                            is_arena_constructable<T>::value, int>::type = 0>
755
  PROTOBUF_ALWAYS_INLINE static Arena* GetArenaInternal(const T* value) {
756
    return InternalHelper<T>::GetArena(value);
757
  }
758
  template <typename T,
759
            typename std::enable_if<!is_arena_constructable<T>::value &&
760
                                        has_get_arena<T>::value,
761
                                    int>::type = 0>
762
  PROTOBUF_ALWAYS_INLINE static Arena* GetArenaInternal(const T* value) {
763
    return value->GetArena();
764
  }
765
  template <typename T,
766
            typename std::enable_if<!is_arena_constructable<T>::value &&
767
                                        !has_get_arena<T>::value,
768
                                    int>::type = 0>
769
  PROTOBUF_ALWAYS_INLINE static Arena* GetArenaInternal(const T* value) {
770
    (void)value;
771
    return nullptr;
772
  }
773
774
  template <typename T>
775
  PROTOBUF_ALWAYS_INLINE static Arena* GetOwningArena(const T* value) {
776
    return GetOwningArenaInternal(
777
        value, std::is_convertible<T*, MessageLite*>());
778
  }
779
780
  // Implementation for GetOwningArena(). All and only message objects have
781
  // GetOwningArena() method.
782
  template <typename T>
783
  PROTOBUF_ALWAYS_INLINE static Arena* GetOwningArenaInternal(
784
      const T* value, std::true_type) {
785
    return InternalHelper<T>::GetOwningArena(value);
786
  }
787
  template <typename T>
788
  PROTOBUF_ALWAYS_INLINE static Arena* GetOwningArenaInternal(
789
      const T* /* value */, std::false_type) {
790
    return nullptr;
791
  }
792
793
  void* AllocateAlignedWithHookForArray(size_t n, size_t align,
794
0
                                        const std::type_info* type) {
795
0
    if (align <= 8) {
796
0
      return AllocateAlignedWithHookForArray(internal::AlignUpTo8(n), type);
797
0
    } else {
798
0
      // We are wasting space by over allocating align - 8 bytes. Compared
799
0
      // to a dedicated function that takes current alignment in consideration.
800
0
      // Such a scheme would only waste (align - 8)/2 bytes on average, but
801
0
      // requires a dedicated function in the outline arena allocation
802
0
      // functions. Possibly re-evaluate tradeoffs later.
803
0
      return internal::AlignTo(
804
0
          AllocateAlignedWithHookForArray(n + align - 8, type), align);
805
0
    }
806
0
  }
807
808
  void* AllocateAlignedWithHook(size_t n, size_t align,
809
0
                                const std::type_info* type) {
810
0
    if (align <= 8) {
811
0
      return AllocateAlignedWithHook(internal::AlignUpTo8(n), type);
812
0
    } else {
813
      // We are wasting space by over allocating align - 8 bytes. Compared
814
      // to a dedicated function that takes current alignment in consideration.
815
      // Such a scheme would only waste (align - 8)/2 bytes on average, but
816
      // requires a dedicated function in the outline arena allocation
817
      // functions. Possibly re-evaluate tradeoffs later.
818
0
      return internal::AlignTo(AllocateAlignedWithHook(n + align - 8, type),
819
0
                               align);
820
0
    }
821
0
  }
822
823
  void* AllocateAlignedNoHook(size_t n);
824
  void* AllocateAlignedWithHook(size_t n, const std::type_info* type);
825
  void* AllocateAlignedWithHookForArray(size_t n, const std::type_info* type);
826
  std::pair<void*, internal::SerialArena::CleanupNode*>
827
  AllocateAlignedWithCleanup(size_t n, const std::type_info* type);
828
829
  template <typename Type>
830
  friend class internal::GenericTypeHandler;
831
  friend class internal::InternalMetadata;  // For user_arena().
832
  friend class internal::LazyField;        // For CreateMaybeMessage.
833
  friend class internal::EpsCopyInputStream;  // For parser performance
834
  friend class MessageLite;
835
  template <typename Key, typename T>
836
  friend class Map;
837
  template <typename>
838
  friend class RepeatedField;                   // For ReturnArrayMemory
839
  friend class internal::RepeatedPtrFieldBase;  // For ReturnArrayMemory
840
  friend struct internal::ArenaTestPeer;
841
};
842
843
// Defined above for supporting environments without RTTI.
844
#undef RTTI_TYPE_ID
845
846
}  // namespace protobuf
847
}  // namespace google
848
849
#include <google/protobuf/port_undef.inc>
850
851
#endif  // GOOGLE_PROTOBUF_ARENA_H__