Skip to content

Commit cd6dfc3

Browse files
committed
Make synthesizeAnonRecordName static
1 parent 5b42b0a commit cd6dfc3

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

cpp2rust/converter/mapper.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,17 @@ std::string normalizeTranslationRule(std::string rule) {
562562
return rule;
563563
}
564564

565+
static std::string synthesizeAnonRecordName(const clang::RecordDecl *record) {
566+
std::string parent_name;
567+
if (auto *parent =
568+
clang::dyn_cast<clang::RecordDecl>(record->getDeclContext())) {
569+
parent_name = parent->getIdentifier()
570+
? parent->getIdentifier()->getName().str()
571+
: synthesizeAnonRecordName(parent);
572+
}
573+
return std::format("{}_anon_{}", parent_name, GetAnonIndex(record));
574+
}
575+
565576
} // namespace
566577

567578
PushASTContext::PushASTContext(clang::ASTContext &ctx) : prev_(ctx_) {
@@ -723,17 +734,6 @@ std::string ToString(clang::QualType qual_type) {
723734
return normalizeTranslationRule(type);
724735
}
725736

726-
static std::string synthesizeAnonRecordName(const clang::RecordDecl *record) {
727-
std::string parent_name;
728-
if (auto *parent =
729-
clang::dyn_cast<clang::RecordDecl>(record->getDeclContext())) {
730-
parent_name = parent->getIdentifier()
731-
? parent->getIdentifier()->getName().str()
732-
: synthesizeAnonRecordName(parent);
733-
}
734-
return std::format("{}_anon_{}", parent_name, GetAnonIndex(record));
735-
}
736-
737737
std::string ToString(const clang::NamedDecl *decl) {
738738
if (auto *record = clang::dyn_cast<clang::RecordDecl>(decl);
739739
record && !record->getIdentifier()) {

0 commit comments

Comments
 (0)