Skip to content

Commit f9b817e

Browse files
committed
---
yaml --- r: 4514 b: refs/heads/master c: 6fbb7ff h: refs/heads/master v: v3
1 parent 304fa89 commit f9b817e

File tree

2 files changed

+46
-3
lines changed

2 files changed

+46
-3
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 8e6e6f5f896e1dbc2fb124e7dad8750d8b9112ef
2+
refs/heads/master: 6fbb7ffdbdfc3ea45eb913f9d6644fe5020f21d7

trunk/src/rt/rust_shape.cpp

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// actions, such as copying, freeing, comparing, and so on.
33

44
#include <algorithm>
5+
#include <iostream>
56
#include <utility>
67
#include <cassert>
78
#include <cstdio>
@@ -1085,11 +1086,11 @@ class cmp : public data<cmp,ptr_pair> {
10851086
result(0) {}
10861087

10871088
void walk_evec(bool align, bool is_pod, uint16_t sp_size) {
1088-
return walk_vec(align, is_pod, get_evec_data_range(dp));
1089+
walk_vec(align, is_pod, get_evec_data_range(dp));
10891090
}
10901091

10911092
void walk_ivec(bool align, bool is_pod, size_align &elem_sa) {
1092-
return walk_vec(align, is_pod, get_ivec_data_range(dp));
1093+
walk_vec(align, is_pod, get_ivec_data_range(dp));
10931094
}
10941095

10951096
void walk_fn(bool align) { return cmp_two_pointers(align); }
@@ -1183,6 +1184,48 @@ cmp::walk_variant(bool align, tag_info &tinfo, uint32_t variant_id,
11831184
}
11841185
}
11851186

1187+
1188+
// Polymorphic logging, for convenience
1189+
1190+
class log : public data<log,uint8_t *> {
1191+
friend class data<log,uint8_t *>;
1192+
1193+
private:
1194+
std::ostream &out;
1195+
bool in_string;
1196+
1197+
void walk_evec(bool align, bool is_pod, uint16_t sp_size) {
1198+
walk_vec(align, is_pod, get_evec_data_range(dp));
1199+
}
1200+
1201+
void walk_ivec(bool align, bool is_pod, size_align &elem_sa) {
1202+
walk_vec(align, is_pod, get_ivec_data_range(dp));
1203+
}
1204+
1205+
void walk_vec(bool align, bool is_pod,
1206+
const std::pair<uint8_t *,uint8_t *> &data);
1207+
1208+
template<typename T>
1209+
void walk_number() { out << get_dp<T>(dp); }
1210+
1211+
public:
1212+
log(rust_task *in_task,
1213+
const uint8_t *in_sp,
1214+
const type_param *in_params,
1215+
const rust_shape_tables *in_tables,
1216+
uint8_t *in_data,
1217+
std::ostream &in_out)
1218+
: data<log,uint8_t *>(in_task, in_sp, in_params, in_tables, in_data),
1219+
out(in_out) {}
1220+
};
1221+
1222+
void
1223+
log::walk_vec(bool align, bool is_pod,
1224+
const std::pair<uint8_t *,uint8_t *> &data) {
1225+
// TODO: Check to see whether this is a string (contains u8). If so,
1226+
// write the vector ""-style; otherwise [ ... , ... ] style.
1227+
}
1228+
11861229
} // end namespace shape
11871230

11881231
extern "C" void

0 commit comments

Comments
 (0)