Skip to content

Commit b421c19

Browse files
committed
refactor(cpp1): discard unused result
1 parent 979bec5 commit b421c19

File tree

1 file changed

+32
-27
lines changed

1 file changed

+32
-27
lines changed

source/cppfront.cpp

Lines changed: 32 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1799,36 +1799,41 @@ class cppfront
17991799

18001800
bool res = false;
18011801
// If the first parent declaration
1802-
std::find_if(current_declarations.rbegin(), current_declarations.rend() - 1, [&](declaration_node const* decl) {
1803-
// that can have aliases
1804-
if ((decl->is_function()
1805-
|| decl->is_type()
1806-
|| decl->is_namespace())
1807-
&& decl->initializer
1808-
&& decl->initializer->is_compound())
1802+
(void)std::find_if(
1803+
current_declarations.rbegin(),
1804+
current_declarations.rend() - 1,
1805+
[&](declaration_node const* decl)
18091806
{
1810-
auto& stmts = decl->initializer->get_if<compound_statement_node>()->statements;
1811-
// among its statements
1812-
return std::any_of(stmts.rbegin(), stmts.rend(), [&](decltype(stmts.front())& stmt) {
1813-
if (auto decl = stmt->get_if<declaration_node>();
1814-
decl
1815-
&& decl->is_alias()) {
1816-
auto& alias = get<declaration_node::an_alias>(decl->type);
1817-
// has a type alias declaration of equal name
1818-
if (alias->is_type_alias()
1819-
&& decl->identifier
1820-
&& *decl->identifier->identifier == lookup_id) {
1821-
auto& type_id = get<alias_node::a_type>(alias->initializer);
1822-
// and its value is a dependent _type-id_.
1823-
res = is_dependent(*type_id);
1824-
return true;
1807+
// that can have aliases
1808+
if ((decl->is_function()
1809+
|| decl->is_type()
1810+
|| decl->is_namespace())
1811+
&& decl->initializer
1812+
&& decl->initializer->is_compound())
1813+
{
1814+
auto& stmts = decl->initializer->get_if<compound_statement_node>()->statements;
1815+
// among its statements
1816+
return std::any_of(stmts.rbegin(), stmts.rend(), [&](decltype(stmts.front())& stmt) {
1817+
if (auto decl = stmt->get_if<declaration_node>();
1818+
decl
1819+
&& decl->is_alias()) {
1820+
auto& alias = get<declaration_node::an_alias>(decl->type);
1821+
// has a type alias declaration of equal name
1822+
if (alias->is_type_alias()
1823+
&& decl->identifier
1824+
&& *decl->identifier->identifier == lookup_id) {
1825+
auto& type_id = get<alias_node::a_type>(alias->initializer);
1826+
// and its value is a dependent _type-id_.
1827+
res = is_dependent(*type_id);
1828+
return true;
1829+
}
18251830
}
1826-
}
1827-
return false;
1828-
});
1831+
return false;
1832+
});
1833+
}
1834+
return false;
18291835
}
1830-
return false;
1831-
});
1836+
);
18321837

18331838
return res;
18341839
}

0 commit comments

Comments
 (0)