|
|
|
@ -77,15 +77,19 @@ class PROTOBUF_EXPORT InternalMetadata { |
|
|
|
|
GOOGLE_DCHECK(!is_message_owned || arena != nullptr); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#if defined(NDEBUG) || defined(_MSC_VER) |
|
|
|
|
// To keep the ABI identical between debug and non-debug builds,
|
|
|
|
|
// the destructor is always defined here even though it may delegate
|
|
|
|
|
// to a non-inline private method.
|
|
|
|
|
// (see https://github.com/protocolbuffers/protobuf/issues/9947)
|
|
|
|
|
~InternalMetadata() { |
|
|
|
|
#if defined(NDEBUG) || defined(_MSC_VER) |
|
|
|
|
if (HasMessageOwnedArenaTag()) { |
|
|
|
|
delete reinterpret_cast<Arena*>(ptr_ - kMessageOwnedArenaTagMask); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
#else |
|
|
|
|
~InternalMetadata(); |
|
|
|
|
CheckedDestruct(); |
|
|
|
|
#endif |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template <typename T> |
|
|
|
|
void Delete() { |
|
|
|
@ -264,6 +268,9 @@ class PROTOBUF_EXPORT InternalMetadata { |
|
|
|
|
PROTOBUF_NOINLINE void DoSwap(T* other) { |
|
|
|
|
mutable_unknown_fields<T>()->Swap(other); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Private helper with debug checks for ~InternalMetadata()
|
|
|
|
|
void CheckedDestruct(); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
// String Template specializations.
|
|
|
|
|