Skip to content

Commit e5a7167

Browse files
committed
review comments
1 parent 0803115 commit e5a7167

File tree

3 files changed

+7
-12
lines changed

3 files changed

+7
-12
lines changed

gcc/cp/contracts.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2730,7 +2730,7 @@ tree view_as_const(tree decl)
27302730
ctype = cp_build_qualified_type (ctype, (cp_type_quals (ctype)
27312731
| TYPE_QUAL_CONST));
27322732
decl = build1 (VIEW_CONVERT_EXPR, ctype, decl);
2733-
EXPR_CONTRACT_CONST_WRAPPER_P(decl) = true;
2733+
CONTRACT_CONSTIFY_EXPR_P(decl) = true;
27342734
}
27352735
return decl;
27362736
}

gcc/cp/cp-tree.h

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3207,15 +3207,9 @@ struct GTY(()) lang_decl {
32073207
/* In VIEW_CONVERT_EXPR, set when this node is a const wrapper. Used to
32083208
constify entities inside contract assertions. */
32093209

3210-
#define EXPR_CONTRACT_CONST_WRAPPER_P(NODE) \
3210+
#define CONTRACT_CONSTIFY_EXPR_P(NODE) \
32113211
(TREE_CHECK(NODE, VIEW_CONVERT_EXPR)->base.private_flag)
32123212

3213-
/* Remove any VIEW_CONVERT_EXPR that's used to constify an entity inside a
3214-
contract assertion. */
3215-
3216-
#define STRIP_ANY_CONTRACT_CONST_WRAPPER(EXP) \
3217-
(EXP) = tree_strip_any_contract_const_wrapper (CONST_CAST_TREE (EXP))
3218-
32193213
/* For a FUNCTION_DECL or a VAR_DECL, the language linkage for the
32203214
declaration. Some entities (like a member function in a local
32213215
class, or a local variable) do not have linkage at all, and this
@@ -9021,15 +9015,16 @@ contract_const_wrapper_p (const_tree exp)
90219015
/* A wrapper node has code VIEW_CONVERT_EXPR, and the flag
90229016
EXPR_LOCATION_WRAPPER_P is set. */
90239017
if (TREE_CODE (exp) == VIEW_CONVERT_EXPR
9024-
&& EXPR_CONTRACT_CONST_WRAPPER_P (exp))
9018+
&& CONTRACT_CONSTIFY_EXPR_P (exp))
90259019
return true;
90269020
return false;
90279021
}
90289022

9029-
/* Implementation of STRIP_ANY_CONTRACT_CONST_WRAPPER. */
9023+
/* If EXP is a CONTRACT_CONSTIFY_EXPR_P, return the wrapped expression.
9024+
Otherwise, do nothing. */
90309025

90319026
inline tree
9032-
tree_strip_any_contract_const_wrapper (tree exp)
9027+
strip_contract_constify_expr (tree exp)
90339028
{
90349029
if (contract_const_wrapper_p (exp))
90359030
return TREE_OPERAND (exp, 0);

gcc/cp/semantics.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12597,7 +12597,7 @@ finish_decltype_type (tree expr, bool id_expression_or_member_access_p,
1259712597
strip the const wrapper. Per P2900R14, "For a function f with the
1259812598
return type T , the result name is an lvalue of type const T , decltype(r)
1259912599
is T , and decltype((r)) is const T&." */
12600-
STRIP_ANY_CONTRACT_CONST_WRAPPER (expr);
12600+
expr = strip_contract_constify_expr (expr);
1260112601

1260212602
if (INDIRECT_REF_P (expr)
1260312603
|| TREE_CODE (expr) == VIEW_CONVERT_EXPR)

0 commit comments

Comments
 (0)