Skip to content

Commit 968f659

Browse files
committed
Load derives vector
1 parent 3236b5d commit 968f659

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

cpp2rust/converter/translation_rule.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ TypeInfo ParseTypeInfoJSON(const llvm::json::Object &obj) {
2525
if (auto v = obj.getBoolean("is_unsafe_pointer"))
2626
info.is_unsafe_pointer = *v;
2727
assert(!(info.is_refcount_pointer && info.is_unsafe_pointer));
28+
if (auto *arr = obj.getArray("derives")) {
29+
for (const auto &elem : *arr) {
30+
if (auto s = elem.getAsString())
31+
info.derives.emplace_back(s->str());
32+
}
33+
}
2834
return info;
2935
}
3036

@@ -329,6 +335,8 @@ void TypeInfo::dump() const {
329335
log() << " [rc_ptr]";
330336
if (is_unsafe_pointer)
331337
log() << " [unsafe_ptr]";
338+
for (const auto &d : derives)
339+
log() << " +" << d;
332340
}
333341

334342
void TypeRule::dump() const {

cpp2rust/converter/translation_rule.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ struct TypeInfo {
5757
std::string type;
5858
bool is_refcount_pointer = false;
5959
bool is_unsafe_pointer = false;
60+
std::vector<std::string> derives;
6061

6162
bool is_pointer() const { return is_refcount_pointer || is_unsafe_pointer; }
6263

0 commit comments

Comments
 (0)