[gcc/devel/rust/master] Remove unused switch statement wrapper
Thomas Schwinge
tschwinge@gcc.gnu.org
Thu Aug 11 19:19:41 GMT 2022
https://gcc.gnu.org/g:113b830ca0f80cf02d2db993fb3850b1f8c3293e
commit 113b830ca0f80cf02d2db993fb3850b1f8c3293e
Author: Philip Herron <philip.herron@embecosm.com>
Date: Thu Aug 11 12:54:42 2022 +0100
Remove unused switch statement wrapper
Diff:
---
gcc/rust/rust-backend.h | 12 ---------
gcc/rust/rust-gcc.cc | 65 -------------------------------------------------
2 files changed, 77 deletions(-)
diff --git a/gcc/rust/rust-backend.h b/gcc/rust/rust-backend.h
index f7c0b083370..126283c1a54 100644
--- a/gcc/rust/rust-backend.h
+++ b/gcc/rust/rust-backend.h
@@ -306,18 +306,6 @@ public:
// exit expressions
virtual tree exit_expression (tree condition, Location) = 0;
- // Create a switch statement where the case values are constants.
- // CASES and STATEMENTS must have the same number of entries. If
- // VALUE matches any of the list in CASES[i], which will all be
- // integers, then STATEMENTS[i] is executed. STATEMENTS[i] will
- // either end with a goto statement or will fall through into
- // STATEMENTS[i + 1]. CASES[i] is empty for the default clause,
- // which need not be last. FUNCTION is the current function.
- virtual tree switch_statement (tree function, tree value,
- const std::vector<std::vector<tree> > &cases,
- const std::vector<tree> &statements, Location)
- = 0;
-
// Create a single statement from two statements.
virtual tree compound_statement (tree, tree) = 0;
diff --git a/gcc/rust/rust-gcc.cc b/gcc/rust/rust-gcc.cc
index 27196e88593..f6c053465fb 100644
--- a/gcc/rust/rust-gcc.cc
+++ b/gcc/rust/rust-gcc.cc
@@ -264,10 +264,6 @@ public:
tree if_statement (tree, tree condition, tree then_block, tree else_block,
Location);
- tree switch_statement (tree function, tree value,
- const std::vector<std::vector<tree>> &cases,
- const std::vector<tree> &statements, Location);
-
tree compound_statement (tree, tree);
tree statement_list (const std::vector<tree> &);
@@ -2054,67 +2050,6 @@ Gcc_backend::exit_expression (tree cond_tree, Location locus)
cond_tree);
}
-// Switch.
-
-tree
-Gcc_backend::switch_statement (tree decl, tree value,
- const std::vector<std::vector<tree>> &cases,
- const std::vector<tree> &statements,
- Location switch_location)
-{
- gcc_assert (cases.size () == statements.size ());
-
- if (DECL_STRUCT_FUNCTION (decl) == NULL)
- push_struct_function (decl);
- else
- push_cfun (DECL_STRUCT_FUNCTION (decl));
-
- tree stmt_list = NULL_TREE;
- std::vector<std::vector<tree>>::const_iterator pc = cases.begin ();
- for (std::vector<tree>::const_iterator ps = statements.begin ();
- ps != statements.end (); ++ps, ++pc)
- {
- if (pc->empty ())
- {
- location_t loc
- = (*ps != NULL ? EXPR_LOCATION (*ps) : UNKNOWN_LOCATION);
- tree label = create_artificial_label (loc);
- tree c = build_case_label (NULL_TREE, NULL_TREE, label);
- append_to_statement_list (c, &stmt_list);
- }
- else
- {
- for (std::vector<tree>::const_iterator pcv = pc->begin ();
- pcv != pc->end (); ++pcv)
- {
- tree t = (*pcv);
- if (t == error_mark_node)
- return error_mark_node;
- location_t loc = EXPR_LOCATION (t);
- tree label = create_artificial_label (loc);
- tree c = build_case_label ((*pcv), NULL_TREE, label);
- append_to_statement_list (c, &stmt_list);
- }
- }
-
- if (*ps != NULL)
- {
- tree t = (*ps);
- if (t == error_mark_node)
- return error_mark_node;
- append_to_statement_list (t, &stmt_list);
- }
- }
- pop_cfun ();
-
- tree tv = value;
- if (tv == error_mark_node)
- return error_mark_node;
- tree t = build2_loc (switch_location.gcc_location (), SWITCH_EXPR, NULL_TREE,
- tv, stmt_list);
- return t;
-}
-
// Pair of statements.
tree
More information about the Gcc-cvs
mailing list