Skip to content

Commit e37f42b

Browse files
committed
Replace GetNameOfScalarTypedef with kPreserve flag in ToString
1 parent 351b072 commit e37f42b

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

cpp2rust/converter/mapper.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,6 @@ search(clang::QualType qual_type) {
415415
return {};
416416
}
417417
auto res = search(types_, type, GetTypeMapKey(type));
418-
auto res = search(types_, type, GetTypeMapKey(type));
419418
log() << "search type " << type
420419
<< ", result: " << (res.first ? res.first->type_info.type : "None")
421420
<< '\n';
@@ -796,6 +795,9 @@ std::string ToString(clang::QualType qual_type, ScalarSugar sugar) {
796795
}
797796
}
798797

798+
}
799+
}
800+
799801
if (auto cxx_record_decl = qual_type->getAsCXXRecordDecl()) {
800802
if (cxx_record_decl->isLambda()) {
801803
return ToString(cxx_record_decl->getLambdaCallOperator());

cpp2rust/cpp_rule_preprocessor.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,7 @@ class Callback : public clang::ast_matchers::MatchFinder::MatchCallback {
117117
type = lookupType(tdecl);
118118
}
119119
}
120-
auto src = GetNameOfScalarTypedef(type);
121-
if (src.empty()) {
122-
src = Mapper::ToString(type);
123-
}
120+
auto src = Mapper::ToString(type, Mapper::ScalarSugar::kPreserve);
124121
out_.try_emplace(var->getQualifiedNameAsString(), std::move(src));
125122
return;
126123
}

0 commit comments

Comments
 (0)