aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2022-10-19 15:25:12 +0200
committerMartin Liska <mliska@suse.cz>2022-10-19 15:25:12 +0200
commit4465e2a047c3b175bf6c4ca500547eb6b12df52f (patch)
tree3159c8256f9907538f186ce7c1087c83825b5519 /gcc/cp
parent6c22519f33270a689fc8730ceff9212b376ed40d (diff)
parent09fed44cabd50f3d8e050f91cc2db02364ce9176 (diff)
downloadgcc-4465e2a047c3b175bf6c4ca500547eb6b12df52f.zip
gcc-4465e2a047c3b175bf6c4ca500547eb6b12df52f.tar.gz
gcc-4465e2a047c3b175bf6c4ca500547eb6b12df52f.tar.bz2
Merge branch 'master' into devel/sphinx
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog23
-rw-r--r--gcc/cp/cp-gimplify.cc15
-rw-r--r--gcc/cp/cp-tree.h1
-rw-r--r--gcc/cp/module.cc79
-rw-r--r--gcc/cp/parser.cc6
-rw-r--r--gcc/cp/pt.cc5
6 files changed, 52 insertions, 77 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index a9983c1..1fe2b1f 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,26 @@
+2022-10-18 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/105045
+ * module.cc (trees_out::tpl_parms_fini): Don't assume default
+ template arguments must be trailing.
+ (trees_in::tpl_parms_fini): Likewise.
+
+2022-10-18 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/106654
+ * cp-tree.h (build_assume_call): Declare.
+ * parser.cc (cp_parser_omp_assumption_clauses): Use build_assume_call.
+ * cp-gimplify.cc (build_assume_call): New function.
+ (process_stmt_assume_attribute): Use build_assume_call.
+ * pt.cc (tsubst_copy_and_build): Likewise.
+
+2022-10-17 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/101449
+ * module.cc (trees_out::write_function_def): Stream the
+ parms and result of the constexpr_fundef entry.
+ (trees_in::read_function_def): Likewise.
+
2022-10-14 Patrick Palka <ppalka@redhat.com>
PR c++/106304
diff --git a/gcc/cp/cp-gimplify.cc b/gcc/cp/cp-gimplify.cc
index 2608475..28c3398 100644
--- a/gcc/cp/cp-gimplify.cc
+++ b/gcc/cp/cp-gimplify.cc
@@ -3101,6 +3101,17 @@ process_stmt_hotness_attribute (tree std_attrs, location_t attrs_loc)
return std_attrs;
}
+/* Build IFN_ASSUME internal call for assume condition ARG. */
+
+tree
+build_assume_call (location_t loc, tree arg)
+{
+ if (!processing_template_decl)
+ arg = fold_build_cleanup_point_expr (TREE_TYPE (arg), arg);
+ return build_call_expr_internal_loc (loc, IFN_ASSUME, void_type_node,
+ 1, arg);
+}
+
/* If [[assume (cond)]] appears on this statement, handle it. */
tree
@@ -3137,9 +3148,7 @@ process_stmt_assume_attribute (tree std_attrs, tree statement,
arg = contextual_conv_bool (arg, tf_warning_or_error);
if (error_operand_p (arg))
continue;
- statement = build_call_expr_internal_loc (attrs_loc, IFN_ASSUME,
- void_type_node, 1, arg);
- finish_expr_stmt (statement);
+ finish_expr_stmt (build_assume_call (attrs_loc, arg));
}
}
return remove_attribute ("gnu", "assume", std_attrs);
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index e2607f0..60a2510 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -8280,6 +8280,7 @@ extern tree predeclare_vla (tree);
extern void clear_fold_cache (void);
extern tree lookup_hotness_attribute (tree);
extern tree process_stmt_hotness_attribute (tree, location_t);
+extern tree build_assume_call (location_t, tree);
extern tree process_stmt_assume_attribute (tree, tree, location_t);
extern bool simple_empty_class_p (tree, tree, tree_code);
extern tree fold_builtin_source_location (location_t);
diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc
index 7ffeefa..2c2f9a9 100644
--- a/gcc/cp/module.cc
+++ b/gcc/cp/module.cc
@@ -10034,15 +10034,11 @@ trees_out::tpl_parms_fini (tree tmpl, unsigned tpl_levels)
tree vec = TREE_VALUE (parms);
tree_node (TREE_TYPE (vec));
- tree dflt = error_mark_node;
for (unsigned ix = TREE_VEC_LENGTH (vec); ix--;)
{
tree parm = TREE_VEC_ELT (vec, ix);
- if (dflt)
- {
- dflt = TREE_PURPOSE (parm);
- tree_node (dflt);
- }
+ tree dflt = TREE_PURPOSE (parm);
+ tree_node (dflt);
if (streaming_p ())
{
@@ -10072,19 +10068,15 @@ trees_in::tpl_parms_fini (tree tmpl, unsigned tpl_levels)
tpl_levels--; parms = TREE_CHAIN (parms))
{
tree vec = TREE_VALUE (parms);
- tree dflt = error_mark_node;
TREE_TYPE (vec) = tree_node ();
for (unsigned ix = TREE_VEC_LENGTH (vec); ix--;)
{
tree parm = TREE_VEC_ELT (vec, ix);
- if (dflt)
- {
- dflt = tree_node ();
- if (get_overrun ())
- return false;
- TREE_PURPOSE (parm) = dflt;
- }
+ tree dflt = tree_node ();
+ if (get_overrun ())
+ return false;
+ TREE_PURPOSE (parm) = dflt;
tree decl = TREE_VALUE (parm);
if (TREE_CODE (decl) == TEMPLATE_DECL)
@@ -11553,34 +11545,13 @@ trees_out::write_function_def (tree decl)
tree_node (DECL_FRIEND_CONTEXT (decl));
constexpr_fundef *cexpr = retrieve_constexpr_fundef (decl);
- int tag = 0;
- if (cexpr)
- {
- if (cexpr->result == error_mark_node)
- /* We'll stream the RESULT_DECL naturally during the
- serialization. We never need to fish it back again, so
- that's ok. */
- tag = 0;
- else
- tag = insert (cexpr->result);
- }
+
if (streaming_p ())
+ u (cexpr != nullptr);
+ if (cexpr)
{
- i (tag);
- if (tag)
- dump (dumper::TREE)
- && dump ("Constexpr:%d result %N", tag, cexpr->result);
- }
- if (tag)
- {
- unsigned ix = 0;
- for (tree parm = cexpr->parms; parm; parm = DECL_CHAIN (parm), ix++)
- {
- tag = insert (parm);
- if (streaming_p ())
- dump (dumper::TREE)
- && dump ("Constexpr:%d parm:%u %N", tag, ix, parm);
- }
+ chained_decls (cexpr->parms);
+ tree_node (cexpr->result);
tree_node (cexpr->body);
}
@@ -11613,32 +11584,10 @@ trees_in::read_function_def (tree decl, tree maybe_template)
tree maybe_dup = odr_duplicate (maybe_template, DECL_SAVED_TREE (decl));
bool installing = maybe_dup && !DECL_SAVED_TREE (decl);
- if (int wtag = i ())
+ if (u ())
{
- int tag = 1;
- cexpr.result = error_mark_node;
-
- cexpr.result = copy_decl (result);
- tag = insert (cexpr.result);
-
- if (wtag != tag)
- set_overrun ();
- dump (dumper::TREE)
- && dump ("Constexpr:%d result %N", tag, cexpr.result);
-
- cexpr.parms = NULL_TREE;
- tree *chain = &cexpr.parms;
- unsigned ix = 0;
- for (tree parm = DECL_ARGUMENTS (maybe_dup ? maybe_dup : decl);
- parm; parm = DECL_CHAIN (parm), ix++)
- {
- tree p = copy_decl (parm);
- tag = insert (p);
- dump (dumper::TREE)
- && dump ("Constexpr:%d parm:%u %N", tag, ix, p);
- *chain = p;
- chain = &DECL_CHAIN (p);
- }
+ cexpr.parms = chained_decls ();
+ cexpr.result = tree_node ();
cexpr.body = tree_node ();
cexpr.decl = decl;
}
diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc
index 9ddfb02..a39c5f0 100644
--- a/gcc/cp/parser.cc
+++ b/gcc/cp/parser.cc
@@ -46012,11 +46012,7 @@ cp_parser_omp_assumption_clauses (cp_parser *parser, cp_token *pragma_tok,
if (!type_dependent_expression_p (t))
t = contextual_conv_bool (t, tf_warning_or_error);
if (is_assume && !error_operand_p (t))
- {
- t = build_call_expr_internal_loc (eloc, IFN_ASSUME,
- void_type_node, 1, t);
- finish_expr_stmt (t);
- }
+ finish_expr_stmt (build_assume_call (eloc, t));
if (!parens.require_close (parser))
cp_parser_skip_to_closing_parenthesis (parser,
/*recovering=*/true,
diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc
index e4dca9d..5eddad9 100644
--- a/gcc/cp/pt.cc
+++ b/gcc/cp/pt.cc
@@ -21140,10 +21140,7 @@ tsubst_copy_and_build (tree t,
ret = error_mark_node;
break;
}
- ret = build_call_expr_internal_loc (EXPR_LOCATION (t),
- IFN_ASSUME,
- void_type_node, 1,
- arg);
+ ret = build_assume_call (EXPR_LOCATION (t), arg);
RETURN (ret);
}
break;