File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2033,8 +2033,7 @@ std::string Converter::ConvertDeclRefExpr(clang::DeclRefExpr *expr) {
20332033 }
20342034
20352035 auto *decl = expr->getDecl ();
2036- if (!(clang::isa<clang::FunctionDecl>(decl) && isAddrOf ()) &&
2037- Mapper::Contains (expr)) {
2036+ if (ShouldReplaceWithMappedBody (expr)) {
20382037 return GetMappedAsString (expr);
20392038 } else if (auto *function = decl->getAsFunction ()) {
20402039 if (auto method = clang::dyn_cast<clang::CXXMethodDecl>(function)) {
@@ -3430,6 +3429,13 @@ bool Converter::isCallee() const {
34303429 return !curr_expr_kind_.empty () && curr_expr_kind_.back () == ExprKind::Callee;
34313430}
34323431
3432+ bool Converter::ShouldReplaceWithMappedBody (clang::DeclRefExpr *expr) const {
3433+ if (clang::isa<clang::FunctionDecl>(expr->getDecl ()) && isAddrOf ()) {
3434+ return false ;
3435+ }
3436+ return Mapper::Contains (expr);
3437+ }
3438+
34333439void Converter::SetFresh () {
34343440 switch (computed_expr_type_) {
34353441 case ComputedExprType::Value:
Original file line number Diff line number Diff line change @@ -455,6 +455,8 @@ class Converter : public clang::RecursiveASTVisitor<Converter> {
455455
456456 virtual bool RecordDerivesDefault (const clang::CXXRecordDecl *decl);
457457
458+ bool ShouldReplaceWithMappedBody (clang::DeclRefExpr *expr) const ;
459+
458460 std::string *rs_code_;
459461 clang::ASTContext &ctx_;
460462 clang::FunctionDecl *curr_function_ = nullptr ;
Original file line number Diff line number Diff line change @@ -626,15 +626,14 @@ bool ConverterRefCount::VisitDeclRefExpr(clang::DeclRefExpr *expr) {
626626 }
627627 }
628628
629- auto str = ConvertDeclRefExpr (expr);
630- auto decl = expr->getDecl ();
631-
632- if (!(clang::isa<clang::FunctionDecl>(decl) && isAddrOf ()) &&
633- Mapper::Contains (expr)) {
629+ if (ShouldReplaceWithMappedBody (expr)) {
634630 StrCat (GetMappedAsString (expr));
635631 return false ;
636632 }
637633
634+ auto str = ConvertDeclRefExpr (expr);
635+ auto decl = expr->getDecl ();
636+
638637 if (auto fn_decl = clang::dyn_cast<clang::FunctionDecl>(decl)) {
639638 if (isAddrOf ()) {
640639 ConvertFunctionToFunctionPointer (fn_decl);
You can’t perform that action at this time.
0 commit comments