Skip to content

Commit

Permalink
refactor(to_cpp1): remove useless non-rvalue context
Browse files Browse the repository at this point in the history
  • Loading branch information
JohelEGP committed Dec 21, 2023
1 parent 9e0b7c4 commit 4eef0da
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
2 changes: 1 addition & 1 deletion regression-tests/test-results/pure2-last-use.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ auto issue_850() -> void{
auto issue_857::n() && -> void{}
auto issue_857::o0() && -> void { std::move(*this).n(); }
auto issue_857::o1() && -> void { CPP2_UFCS(n)(std::move((*this))); }
auto issue_857::o2() && -> void { CPP2_UFCS(n)(0); }
auto issue_857::o2() && -> void { CPP2_UFCS(std::move(*this).n)(0); }
auto issue_857::o3() && -> void { std::move(*this).n(0); }
auto issue_857::o4() && -> void { n(std::move((*this))); }
auto issue_857::p0() && -> void{
Expand Down
11 changes: 1 addition & 10 deletions source/to_cpp1.h
Original file line number Diff line number Diff line change
Expand Up @@ -3220,18 +3220,9 @@ class cppfront
&& !lookup_finds_variable_with_placeholder_type_under_initialization(*i->id_expr)
)
{
auto is_type_scope_function = lookup_finds_type_scope_function(*i->id_expr);
if (is_type_scope_function) {
in_non_rvalue_context.push_back(true);
}

// The function name is the argument to the macro
auto funcname = print_to_string(*i->id_expr);

if (is_type_scope_function) {
in_non_rvalue_context.pop_back();
}

// First, build the UFCS macro name

auto ufcs_string = std::string("CPP2_UFCS");
Expand Down Expand Up @@ -3288,7 +3279,7 @@ class cppfront
// by leveraging the last use only in the non-member branch
if (auto last_use = is_definite_last_use(i->id_expr->get_token());
last_use
&& !is_type_scope_function
&& !lookup_finds_type_scope_function(*i->id_expr)
)
{
if (last_use->is_forward) {
Expand Down

0 comments on commit 4eef0da

Please sign in to comment.