| 231 | |
| 232 | template <typename T, typename... Args> |
| 233 | std::pair<T* absl_nonnull, const ReferenceCount* absl_nonnull> |
| 234 | MakeEmplacedReferenceCount(Args&&... args) { |
| 235 | using U = std::remove_const_t<T>; |
| 236 | U* pointer; |
| 237 | auto* const refcount = |
| 238 | new EmplacedReferenceCount<U>(pointer, std::forward<Args>(args)...); |
| 239 | if constexpr (google::protobuf::Arena::is_arena_constructable<U>::value) { |
| 240 | ABSL_DCHECK_EQ(pointer->GetArena(), nullptr); |
| 241 | } |
| 242 | if constexpr (std::is_base_of_v<Data, T>) { |
| 243 | common_internal::SetDataReferenceCount(pointer, refcount); |
| 244 | } |
| 245 | return std::pair{static_cast<T* absl_nonnull>(pointer), |
| 246 | static_cast<const ReferenceCount* absl_nonnull>(refcount)}; |
| 247 | } |
| 248 | |
| 249 | template <typename T> |
| 250 | class InlinedReferenceCount final : public ReferenceCounted { |
nothing calls this directly
no test coverage detected