Skip to content

Commit f59e173

Browse files
committed
Mark every converted type as referenced
1 parent 3b2f88e commit f59e173

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

‎cpp2rust/converter/converter.cpp‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,11 @@ bool Converter::Convert(clang::QualType qual_type) {
9898
return false;
9999
}
100100

101+
if (auto decl = qual_type->getAsRecordDecl();
102+
decl && IsUserDefinedDecl(decl)) {
103+
record_decls_.MarkReferenced(GetRecordName(decl));
104+
}
105+
101106
auto mapped = Mapper::Map(qual_type);
102107
if (!mapped.empty() && mapped != token::kIgnoreRule) {
103108
StrCat(mapped);
@@ -206,11 +211,7 @@ bool Converter::VisitRecordType(clang::RecordType *type) {
206211
}
207212
}
208213

209-
auto name = GetRecordName(decl);
210-
StrCat(name);
211-
if (!ctx_.getSourceManager().isInSystemHeader(decl->getLocation())) {
212-
record_decls_.MarkReferenced(std::move(name));
213-
}
214+
StrCat(GetRecordName(decl));
214215
Mapper::AddRuleForUserDefinedType(decl);
215216
return false;
216217
}

0 commit comments

Comments
 (0)