|
| 1 | +diff --git a/absl/container/internal/compressed_tuple.h b/absl/container/internal/compressed_tuple.h |
| 2 | +index 5ebe1649..01db7134 100644 |
| 3 | +--- a/absl/container/internal/compressed_tuple.h |
| 4 | ++++ b/absl/container/internal/compressed_tuple.h |
| 5 | +@@ -32,7 +32,6 @@ |
| 6 | + #ifndef ABSL_CONTAINER_INTERNAL_COMPRESSED_TUPLE_H_ |
| 7 | + #define ABSL_CONTAINER_INTERNAL_COMPRESSED_TUPLE_H_ |
| 8 | + |
| 9 | +-#include <initializer_list> |
| 10 | + #include <tuple> |
| 11 | + #include <type_traits> |
| 12 | + #include <utility> |
| 13 | +@@ -77,134 +76,61 @@ constexpr bool IsFinal() { |
| 14 | + #endif |
| 15 | + } |
| 16 | + |
| 17 | +-// We can't use EBCO on other CompressedTuples because that would mean that we |
| 18 | +-// derive from multiple Storage<> instantiations with the same I parameter, |
| 19 | +-// and potentially from multiple identical Storage<> instantiations. So anytime |
| 20 | +-// we use type inheritance rather than encapsulation, we mark |
| 21 | +-// CompressedTupleImpl, to make this easy to detect. |
| 22 | +-struct uses_inheritance {}; |
| 23 | +- |
| 24 | + template <typename T> |
| 25 | + constexpr bool ShouldUseBase() { |
| 26 | +- return std::is_class<T>::value && std::is_empty<T>::value && !IsFinal<T>() && |
| 27 | +- !std::is_base_of<uses_inheritance, T>::value; |
| 28 | ++ return std::is_class<T>::value && std::is_empty<T>::value && !IsFinal<T>(); |
| 29 | + } |
| 30 | + |
| 31 | + // The storage class provides two specializations: |
| 32 | + // - For empty classes, it stores T as a base class. |
| 33 | + // - For everything else, it stores T as a member. |
| 34 | +-template <typename T, size_t I, |
| 35 | +-#if defined(_MSC_VER) |
| 36 | +- bool UseBase = |
| 37 | +- ShouldUseBase<typename std::enable_if<true, T>::type>()> |
| 38 | +-#else |
| 39 | +- bool UseBase = ShouldUseBase<T>()> |
| 40 | +-#endif |
| 41 | ++template <typename D, size_t I, bool = ShouldUseBase<ElemT<D, I>>()> |
| 42 | + struct Storage { |
| 43 | ++ using T = ElemT<D, I>; |
| 44 | + T value; |
| 45 | + constexpr Storage() = default; |
| 46 | +- template <typename V> |
| 47 | +- explicit constexpr Storage(absl::in_place_t, V&& v) |
| 48 | +- : value(absl::forward<V>(v)) {} |
| 49 | ++ explicit constexpr Storage(T&& v) : value(absl::forward<T>(v)) {} |
| 50 | + constexpr const T& get() const& { return value; } |
| 51 | + T& get() & { return value; } |
| 52 | + constexpr const T&& get() const&& { return absl::move(*this).value; } |
| 53 | + T&& get() && { return std::move(*this).value; } |
| 54 | + }; |
| 55 | + |
| 56 | +-template <typename T, size_t I> |
| 57 | +-struct ABSL_INTERNAL_COMPRESSED_TUPLE_DECLSPEC Storage<T, I, true> : T { |
| 58 | ++template <typename D, size_t I> |
| 59 | ++struct ABSL_INTERNAL_COMPRESSED_TUPLE_DECLSPEC Storage<D, I, true> |
| 60 | ++ : ElemT<D, I> { |
| 61 | ++ using T = internal_compressed_tuple::ElemT<D, I>; |
| 62 | + constexpr Storage() = default; |
| 63 | +- |
| 64 | +- template <typename V> |
| 65 | +- explicit constexpr Storage(absl::in_place_t, V&& v) |
| 66 | +- : T(absl::forward<V>(v)) {} |
| 67 | +- |
| 68 | ++ explicit constexpr Storage(T&& v) : T(absl::forward<T>(v)) {} |
| 69 | + constexpr const T& get() const& { return *this; } |
| 70 | + T& get() & { return *this; } |
| 71 | + constexpr const T&& get() const&& { return absl::move(*this); } |
| 72 | + T&& get() && { return std::move(*this); } |
| 73 | + }; |
| 74 | + |
| 75 | +-template <typename D, typename I, bool ShouldAnyUseBase> |
| 76 | ++template <typename D, typename I> |
| 77 | + struct ABSL_INTERNAL_COMPRESSED_TUPLE_DECLSPEC CompressedTupleImpl; |
| 78 | + |
| 79 | +-template <typename... Ts, size_t... I, bool ShouldAnyUseBase> |
| 80 | +-struct ABSL_INTERNAL_COMPRESSED_TUPLE_DECLSPEC CompressedTupleImpl< |
| 81 | +- CompressedTuple<Ts...>, absl::index_sequence<I...>, ShouldAnyUseBase> |
| 82 | ++template <typename... Ts, size_t... I> |
| 83 | ++struct ABSL_INTERNAL_COMPRESSED_TUPLE_DECLSPEC |
| 84 | ++ CompressedTupleImpl<CompressedTuple<Ts...>, absl::index_sequence<I...>> |
| 85 | + // We use the dummy identity function through std::integral_constant to |
| 86 | + // convince MSVC of accepting and expanding I in that context. Without it |
| 87 | + // you would get: |
| 88 | + // error C3548: 'I': parameter pack cannot be used in this context |
| 89 | +- : uses_inheritance, |
| 90 | +- Storage<Ts, std::integral_constant<size_t, I>::value>... { |
| 91 | ++ : Storage<CompressedTuple<Ts...>, |
| 92 | ++ std::integral_constant<size_t, I>::value>... { |
| 93 | + constexpr CompressedTupleImpl() = default; |
| 94 | +- template <typename... Vs> |
| 95 | +- explicit constexpr CompressedTupleImpl(absl::in_place_t, Vs&&... args) |
| 96 | +- : Storage<Ts, I>(absl::in_place, absl::forward<Vs>(args))... {} |
| 97 | +- friend CompressedTuple<Ts...>; |
| 98 | ++ explicit constexpr CompressedTupleImpl(Ts&&... args) |
| 99 | ++ : Storage<CompressedTuple<Ts...>, I>(absl::forward<Ts>(args))... {} |
| 100 | + }; |
| 101 | + |
| 102 | +-template <typename... Ts, size_t... I> |
| 103 | +-struct ABSL_INTERNAL_COMPRESSED_TUPLE_DECLSPEC CompressedTupleImpl< |
| 104 | +- CompressedTuple<Ts...>, absl::index_sequence<I...>, false> |
| 105 | +- // We use the dummy identity function as above... |
| 106 | +- : Storage<Ts, std::integral_constant<size_t, I>::value, false>... { |
| 107 | +- constexpr CompressedTupleImpl() = default; |
| 108 | +- template <typename... Vs> |
| 109 | +- explicit constexpr CompressedTupleImpl(absl::in_place_t, Vs&&... args) |
| 110 | +- : Storage<Ts, I, false>(absl::in_place, absl::forward<Vs>(args))... {} |
| 111 | +- friend CompressedTuple<Ts...>; |
| 112 | +-}; |
| 113 | +- |
| 114 | +-std::false_type Or(std::initializer_list<std::false_type>); |
| 115 | +-std::true_type Or(std::initializer_list<bool>); |
| 116 | +- |
| 117 | +-// MSVC requires this to be done separately rather than within the declaration |
| 118 | +-// of CompressedTuple below. |
| 119 | +-template <typename... Ts> |
| 120 | +-constexpr bool ShouldAnyUseBase() { |
| 121 | +- return decltype( |
| 122 | +- Or({std::integral_constant<bool, ShouldUseBase<Ts>()>()...})){}; |
| 123 | +-} |
| 124 | +- |
| 125 | +-template <typename T, typename V> |
| 126 | +-using TupleElementMoveConstructible = |
| 127 | +- typename std::conditional<std::is_reference<T>::value, |
| 128 | +- std::is_convertible<V, T>, |
| 129 | +- std::is_constructible<T, V&&>>::type; |
| 130 | +- |
| 131 | +-template <bool SizeMatches, class T, class... Vs> |
| 132 | +-struct TupleMoveConstructible : std::false_type {}; |
| 133 | +- |
| 134 | +-template <class... Ts, class... Vs> |
| 135 | +-struct TupleMoveConstructible<true, CompressedTuple<Ts...>, Vs...> |
| 136 | +- : std::integral_constant< |
| 137 | +- bool, absl::conjunction< |
| 138 | +- TupleElementMoveConstructible<Ts, Vs&&>...>::value> {}; |
| 139 | +- |
| 140 | +-template <typename T> |
| 141 | +-struct compressed_tuple_size; |
| 142 | +- |
| 143 | +-template <typename... Es> |
| 144 | +-struct compressed_tuple_size<CompressedTuple<Es...>> |
| 145 | +- : public std::integral_constant<std::size_t, sizeof...(Es)> {}; |
| 146 | +- |
| 147 | +-template <class T, class... Vs> |
| 148 | +-struct TupleItemsMoveConstructible |
| 149 | +- : std::integral_constant< |
| 150 | +- bool, TupleMoveConstructible<compressed_tuple_size<T>::value == |
| 151 | +- sizeof...(Vs), |
| 152 | +- T, Vs...>::value> {}; |
| 153 | +- |
| 154 | + } // namespace internal_compressed_tuple |
| 155 | + |
| 156 | + // Helper class to perform the Empty Base Class Optimization. |
| 157 | + // Ts can contain classes and non-classes, empty or not. For the ones that |
| 158 | + // are empty classes, we perform the CompressedTuple. If all types in Ts are |
| 159 | +-// empty classes, then CompressedTuple<Ts...> is itself an empty class. (This |
| 160 | +-// does not apply when one or more of those empty classes is itself an empty |
| 161 | +-// CompressedTuple.) |
| 162 | ++// empty classes, then CompressedTuple<Ts...> is itself an empty class. |
| 163 | + // |
| 164 | + // To access the members, use member .get<N>() function. |
| 165 | + // |
| 166 | +@@ -220,59 +146,36 @@ struct TupleItemsMoveConstructible |
| 167 | + template <typename... Ts> |
| 168 | + class ABSL_INTERNAL_COMPRESSED_TUPLE_DECLSPEC CompressedTuple |
| 169 | + : private internal_compressed_tuple::CompressedTupleImpl< |
| 170 | +- CompressedTuple<Ts...>, absl::index_sequence_for<Ts...>, |
| 171 | +- internal_compressed_tuple::ShouldAnyUseBase<Ts...>()> { |
| 172 | ++ CompressedTuple<Ts...>, absl::index_sequence_for<Ts...>> { |
| 173 | + private: |
| 174 | + template <int I> |
| 175 | + using ElemT = internal_compressed_tuple::ElemT<CompressedTuple, I>; |
| 176 | + |
| 177 | +- template <int I> |
| 178 | +- using StorageT = internal_compressed_tuple::Storage<ElemT<I>, I>; |
| 179 | +- |
| 180 | + public: |
| 181 | +- // There seems to be a bug in MSVC dealing in which using '=default' here will |
| 182 | +- // cause the compiler to ignore the body of other constructors. The work- |
| 183 | +- // around is to explicitly implement the default constructor. |
| 184 | +-#if defined(_MSC_VER) |
| 185 | +- constexpr CompressedTuple() : CompressedTuple::CompressedTupleImpl() {} |
| 186 | +-#else |
| 187 | + constexpr CompressedTuple() = default; |
| 188 | +-#endif |
| 189 | +- explicit constexpr CompressedTuple(const Ts&... base) |
| 190 | +- : CompressedTuple::CompressedTupleImpl(absl::in_place, base...) {} |
| 191 | +- |
| 192 | +- template <typename First, typename... Vs, |
| 193 | +- absl::enable_if_t< |
| 194 | +- absl::conjunction< |
| 195 | +- // Ensure we are not hiding default copy/move constructors. |
| 196 | +- absl::negation<std::is_same<void(CompressedTuple), |
| 197 | +- void(absl::decay_t<First>)>>, |
| 198 | +- internal_compressed_tuple::TupleItemsMoveConstructible< |
| 199 | +- CompressedTuple<Ts...>, First, Vs...>>::value, |
| 200 | +- bool> = true> |
| 201 | +- explicit constexpr CompressedTuple(First&& first, Vs&&... base) |
| 202 | +- : CompressedTuple::CompressedTupleImpl(absl::in_place, |
| 203 | +- absl::forward<First>(first), |
| 204 | +- absl::forward<Vs>(base)...) {} |
| 205 | ++ explicit constexpr CompressedTuple(Ts... base) |
| 206 | ++ : CompressedTuple::CompressedTupleImpl(absl::forward<Ts>(base)...) {} |
| 207 | + |
| 208 | + template <int I> |
| 209 | + ElemT<I>& get() & { |
| 210 | +- return StorageT<I>::get(); |
| 211 | ++ return internal_compressed_tuple::Storage<CompressedTuple, I>::get(); |
| 212 | + } |
| 213 | + |
| 214 | + template <int I> |
| 215 | + constexpr const ElemT<I>& get() const& { |
| 216 | +- return StorageT<I>::get(); |
| 217 | ++ return internal_compressed_tuple::Storage<CompressedTuple, I>::get(); |
| 218 | + } |
| 219 | + |
| 220 | + template <int I> |
| 221 | + ElemT<I>&& get() && { |
| 222 | +- return std::move(*this).StorageT<I>::get(); |
| 223 | ++ return std::move(*this) |
| 224 | ++ .internal_compressed_tuple::template Storage<CompressedTuple, I>::get(); |
| 225 | + } |
| 226 | + |
| 227 | + template <int I> |
| 228 | + constexpr const ElemT<I>&& get() const&& { |
| 229 | +- return absl::move(*this).StorageT<I>::get(); |
| 230 | ++ return absl::move(*this) |
| 231 | ++ .internal_compressed_tuple::template Storage<CompressedTuple, I>::get(); |
| 232 | + } |
| 233 | + }; |
| 234 | + |
| 235 | +diff --git a/absl/time/internal/cctz/BUILD.bazel b/absl/time/internal/cctz/BUILD.bazel |
| 236 | +index 7304d40d..75d8e086 100644 |
| 237 | +--- a/absl/time/internal/cctz/BUILD.bazel |
| 238 | ++++ b/absl/time/internal/cctz/BUILD.bazel |
| 239 | +@@ -72,15 +72,6 @@ cc_library( |
| 240 | + "include/cctz/time_zone.h", |
| 241 | + "include/cctz/zone_info_source.h", |
| 242 | + ], |
| 243 | +- linkopts = select({ |
| 244 | +- ":osx": [ |
| 245 | +- "-framework Foundation", |
| 246 | +- ], |
| 247 | +- ":ios": [ |
| 248 | +- "-framework Foundation", |
| 249 | +- ], |
| 250 | +- "//conditions:default": [], |
| 251 | +- }), |
| 252 | + visibility = ["//visibility:public"], |
| 253 | + deps = [ |
| 254 | + ":civil_time", |
| 255 | +diff --git a/absl/base/config.h b/absl/base/config.h |
| 256 | +index 8533aea..07b4e80 100644 |
| 257 | +--- a/absl/base/config.h.orig |
| 258 | ++++ b/absl/base/config.h |
| 259 | +@@ -906,7 +906,7 @@ static_assert(ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' || |
| 260 | + // SIMD). |
| 261 | + #ifdef ABSL_INTERNAL_HAVE_ARM_NEON |
| 262 | + #error ABSL_INTERNAL_HAVE_ARM_NEON cannot be directly set |
| 263 | +-#elif defined(__ARM_NEON) |
| 264 | ++#elif defined(__ARM_NEON) && !defined(__CUDACC__) |
| 265 | + #define ABSL_INTERNAL_HAVE_ARM_NEON 1 |
| 266 | + #endif |
| 267 | + |
0 commit comments