Skip to content

Commit eaa0d9a

Browse files
committed
Don't load builtin types in cpp-rule-preprocessor
1 parent 8db4b01 commit eaa0d9a

2 files changed

Lines changed: 1 addition & 8 deletions

File tree

cpp2rust/converter/mapper.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ namespace {
2626
clang::ASTContext *ctx_ = nullptr;
2727
Model model_ = Model::kUnsafe;
2828
bool translation_rules_loaded_ = false;
29-
bool builtin_types_loaded_ = false;
3029

3130
std::unordered_multimap<std::string, TranslationRule::ExprRule>
3231
exprs_; // src -> ExprRule
@@ -623,10 +622,6 @@ std::string normalizeTranslationRule(std::string rule) {
623622

624623
PushASTContext::PushASTContext(clang::ASTContext &ctx) : prev_(ctx_) {
625624
ctx_ = &ctx;
626-
if (!builtin_types_loaded_) {
627-
builtin_types_loaded_ = true;
628-
addBuiltinTypes(model_);
629-
}
630625
}
631626
PushASTContext::~PushASTContext() { ctx_ = prev_; }
632627

@@ -996,7 +991,6 @@ void LoadTranslationRules(Model model, clang::ASTContext &ctx,
996991
}
997992
translation_rules_loaded_ = true;
998993

999-
builtin_types_loaded_ = true;
1000994
addBuiltinTypes(model);
1001995
addRulesFromDirectory(rules_dir, model);
1002996

cpp2rust/cpp_rule_preprocessor.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,7 @@ class Callback : public clang::ast_matchers::MatchFinder::MatchCallback {
113113
} else {
114114
type = var->getUnderlyingType();
115115
}
116-
out_.try_emplace(var->getQualifiedNameAsString(),
117-
Mapper::ToString(type, Mapper::ScalarSugar::kPreserve));
116+
out_.try_emplace(var->getQualifiedNameAsString(), Mapper::ToString(type));
118117
return;
119118
}
120119

0 commit comments

Comments
 (0)