mirror of git://gcc.gnu.org/git/gcc.git
[C++ PATCH] cleanup 2
https://gcc.gnu.org/ml/gcc-patches/2018-04/msg01231.html * typeck.c (convert_ptrmem): Move local var decls to initialization. From-SVN: r259710
This commit is contained in:
parent
3db18011e5
commit
036b5ad136
|
|
@ -1,5 +1,7 @@
|
||||||
2018-04-27 Nathan Sidwell <nathan@acm.org>
|
2018-04-27 Nathan Sidwell <nathan@acm.org>
|
||||||
|
|
||||||
|
* typeck.c (convert_ptrmem): Move local var decls to initialization.
|
||||||
|
|
||||||
* cp-tree.h (TEMPLATE_INFO): Fix comments.
|
* cp-tree.h (TEMPLATE_INFO): Fix comments.
|
||||||
(TI_PENDING_TEMPLATE_FLAG): Check TEMPLATE_INFO.
|
(TI_PENDING_TEMPLATE_FLAG): Check TEMPLATE_INFO.
|
||||||
(NON_DEFAULT_TEMPLATE_ARG_COUNT): Wrap line.
|
(NON_DEFAULT_TEMPLATE_ARG_COUNT): Wrap line.
|
||||||
|
|
|
||||||
|
|
@ -6833,34 +6833,28 @@ convert_ptrmem (tree type, tree expr, bool allow_inverse_p,
|
||||||
|
|
||||||
if (TYPE_PTRDATAMEM_P (type))
|
if (TYPE_PTRDATAMEM_P (type))
|
||||||
{
|
{
|
||||||
tree delta;
|
tree delta = (get_delta_difference
|
||||||
|
(TYPE_PTRMEM_CLASS_TYPE (TREE_TYPE (expr)),
|
||||||
delta = get_delta_difference (TYPE_PTRMEM_CLASS_TYPE (TREE_TYPE (expr)),
|
|
||||||
TYPE_PTRMEM_CLASS_TYPE (type),
|
TYPE_PTRMEM_CLASS_TYPE (type),
|
||||||
allow_inverse_p,
|
allow_inverse_p, c_cast_p, complain));
|
||||||
c_cast_p, complain);
|
|
||||||
if (delta == error_mark_node)
|
if (delta == error_mark_node)
|
||||||
return error_mark_node;
|
return error_mark_node;
|
||||||
|
|
||||||
if (!integer_zerop (delta))
|
if (!integer_zerop (delta))
|
||||||
{
|
{
|
||||||
tree cond, op1, op2;
|
|
||||||
|
|
||||||
if (TREE_CODE (expr) == PTRMEM_CST)
|
if (TREE_CODE (expr) == PTRMEM_CST)
|
||||||
expr = cplus_expand_constant (expr);
|
expr = cplus_expand_constant (expr);
|
||||||
cond = cp_build_binary_op (input_location,
|
|
||||||
EQ_EXPR,
|
tree cond = cp_build_binary_op (input_location, EQ_EXPR, expr,
|
||||||
expr,
|
|
||||||
build_int_cst (TREE_TYPE (expr), -1),
|
build_int_cst (TREE_TYPE (expr), -1),
|
||||||
complain);
|
complain);
|
||||||
op1 = build_nop (ptrdiff_type_node, expr);
|
tree op1 = build_nop (ptrdiff_type_node, expr);
|
||||||
op2 = cp_build_binary_op (input_location,
|
tree op2 = cp_build_binary_op (input_location, PLUS_EXPR, op1, delta,
|
||||||
PLUS_EXPR, op1, delta,
|
|
||||||
complain);
|
complain);
|
||||||
|
|
||||||
expr = fold_build3_loc (input_location,
|
expr = fold_build3_loc (input_location,
|
||||||
COND_EXPR, ptrdiff_type_node, cond, op1, op2);
|
COND_EXPR, ptrdiff_type_node, cond, op1, op2);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return build_nop (type, expr);
|
return build_nop (type, expr);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue