@@ -181,6 +181,11 @@ template <typename... Ts> inline std::string stringify_args(const Ts &... ts) {
181
181
namespace lldb_private {
182
182
namespace repro {
183
183
184
+ template <class T >
185
+ struct is_trivially_serializable
186
+ : std::integral_constant<bool , std::is_fundamental<T>::value ||
187
+ std::is_enum<T>::value> {};
188
+
184
189
// / Mapping between serialized indices and their corresponding objects.
185
190
// /
186
191
// / This class is used during replay to map indices back to in-memory objects.
@@ -279,7 +284,7 @@ class Deserializer {
279
284
// / Store the returned value in the index-to-object mapping.
280
285
template <typename T> void HandleReplayResult (const T &t) {
281
286
unsigned result = Deserialize<unsigned >();
282
- if (std::is_fundamental <T>::value)
287
+ if (is_trivially_serializable <T>::value)
283
288
return ;
284
289
// We need to make a copy as the original object might go out of scope.
285
290
m_index_to_object.AddObjectForIndex (result, new T (t));
@@ -288,7 +293,7 @@ class Deserializer {
288
293
// / Store the returned value in the index-to-object mapping.
289
294
template <typename T> void HandleReplayResult (T *t) {
290
295
unsigned result = Deserialize<unsigned >();
291
- if (std::is_fundamental <T>::value)
296
+ if (is_trivially_serializable <T>::value)
292
297
return ;
293
298
m_index_to_object.AddObjectForIndex (result, t);
294
299
}
@@ -565,7 +570,7 @@ class Serializer {
565
570
// / fundamental types (in which case we serialize its value) and references
566
571
// / to objects (in which case we serialize their index).
567
572
template <typename T> void Serialize (T &t) {
568
- if (std::is_fundamental <T>::value) {
573
+ if (is_trivially_serializable <T>::value) {
569
574
m_stream.write (reinterpret_cast <const char *>(&t), sizeof (T));
570
575
} else {
571
576
unsigned idx = m_tracker.GetIndexForObject (&t);
0 commit comments