aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/backend/rust-tree.h
diff options
context:
space:
mode:
authorFaisal Abbas <90.abbasfaisal@gmail.com>2022-07-28 18:54:48 +0100
committerPhilip Herron <philip.herron@embecosm.com>2022-08-25 12:40:25 +0100
commitf21f475feca30d0c9fb74dfe3bb65a6d88d5311c (patch)
tree17483b904b93b37334630e2768735405f16db365 /gcc/rust/backend/rust-tree.h
parenta360c28cb6c2536a4ab3dfdaebb63ae05354a054 (diff)
downloadgcc-f21f475feca30d0c9fb74dfe3bb65a6d88d5311c.zip
gcc-f21f475feca30d0c9fb74dfe3bb65a6d88d5311c.tar.gz
gcc-f21f475feca30d0c9fb74dfe3bb65a6d88d5311c.tar.bz2
rust-constexpr.cc: add more cases to eval_constant_expression()
Following cases have been added in this changeset: - LOOP_EXPR - WHILE_STMT - FOR_STMT These need following supporting functions which are also ported: - eval_loop_expr - returns - breaks - continues - switches
Diffstat (limited to 'gcc/rust/backend/rust-tree.h')
-rw-r--r--gcc/rust/backend/rust-tree.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/gcc/rust/backend/rust-tree.h b/gcc/rust/backend/rust-tree.h
index 01de727..f9623a2 100644
--- a/gcc/rust/backend/rust-tree.h
+++ b/gcc/rust/backend/rust-tree.h
@@ -1240,6 +1240,10 @@ extern GTY (()) tree cp_global_trees[CPTI_MAX];
#define DECL_FUNCTION_MEMBER_P(NODE) \
(DECL_NONSTATIC_MEMBER_FUNCTION_P (NODE) || DECL_STATIC_FUNCTION_P (NODE))
+/* Nonzero if NODE is the target for genericization of 'return' stmts
+ in constructors/destructors of targetm.cxx.cdtor_returns_this targets. */
+#define LABEL_DECL_CDTOR(NODE) DECL_LANG_FLAG_2 (LABEL_DECL_CHECK (NODE))
+
#if defined ENABLE_TREE_CHECKING
#define LANG_DECL_MIN_CHECK(NODE) \
@@ -1334,6 +1338,26 @@ extern GTY (()) tree cp_global_trees[CPTI_MAX];
#define DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P(NODE) \
(TREE_LANG_FLAG_2 (VAR_DECL_CHECK (NODE)))
+/* WHILE_STMT accessors. These give access to the condition of the
+ while statement and the body of the while statement, respectively. */
+#define WHILE_COND(NODE) TREE_OPERAND (WHILE_STMT_CHECK (NODE), 0)
+#define WHILE_BODY(NODE) TREE_OPERAND (WHILE_STMT_CHECK (NODE), 1)
+
+/* FOR_STMT accessors. These give access to the init statement,
+ condition, update expression, and body of the for statement,
+ respectively. */
+#define FOR_INIT_STMT(NODE) TREE_OPERAND (FOR_STMT_CHECK (NODE), 0)
+#define FOR_COND(NODE) TREE_OPERAND (FOR_STMT_CHECK (NODE), 1)
+#define FOR_EXPR(NODE) TREE_OPERAND (FOR_STMT_CHECK (NODE), 2)
+#define FOR_BODY(NODE) TREE_OPERAND (FOR_STMT_CHECK (NODE), 3)
+#define FOR_SCOPE(NODE) TREE_OPERAND (FOR_STMT_CHECK (NODE), 4)
+
+/* Nonzero if NODE is the target for genericization of 'break' stmts. */
+#define LABEL_DECL_BREAK(NODE) DECL_LANG_FLAG_0 (LABEL_DECL_CHECK (NODE))
+
+/* Nonzero if NODE is the target for genericization of 'continue' stmts. */
+#define LABEL_DECL_CONTINUE(NODE) DECL_LANG_FLAG_1 (LABEL_DECL_CHECK (NODE))
+
// Above macros are copied from gcc/c-family/c-common.h
// Below macros are copied from gcc/cp/name-lookup.cc