c++: Simplify uses of LAMBDA_EXPR_EXTRA_SCOPE
I noticed there already exists a getter to get the scope of a lambda from its type directly rather than needing to go via CLASSTYPE_LAMBDA_EXPR, we may as well use it. gcc/cp/ChangeLog: * module.cc (trees_out::get_merge_kind): Use LAMBDA_TYPE_EXTRA_SCOPE instead of LAMBDA_EXPR_EXTRA_SCOPE. (trees_out::key_mergeable): Likewise. Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
This commit is contained in:
parent
d364c4ced8
commit
24cb586caf
1 changed files with 2 additions and 5 deletions
|
@ -10686,9 +10686,7 @@ trees_out::get_merge_kind (tree decl, depset *dep)
|
|||
g++.dg/modules/lambda-6_a.C. */
|
||||
if (DECL_IMPLICIT_TYPEDEF_P (STRIP_TEMPLATE (decl))
|
||||
&& LAMBDA_TYPE_P (TREE_TYPE (decl)))
|
||||
if (tree scope
|
||||
= LAMBDA_EXPR_EXTRA_SCOPE (CLASSTYPE_LAMBDA_EXPR
|
||||
(TREE_TYPE (decl))))
|
||||
if (tree scope = LAMBDA_TYPE_EXTRA_SCOPE (TREE_TYPE (decl)))
|
||||
{
|
||||
/* Lambdas attached to fields are keyed to its class. */
|
||||
if (TREE_CODE (scope) == FIELD_DECL)
|
||||
|
@ -10993,8 +10991,7 @@ trees_out::key_mergeable (int tag, merge_kind mk, tree decl, tree inner,
|
|||
case MK_keyed:
|
||||
{
|
||||
gcc_checking_assert (LAMBDA_TYPE_P (TREE_TYPE (inner)));
|
||||
tree scope = LAMBDA_EXPR_EXTRA_SCOPE (CLASSTYPE_LAMBDA_EXPR
|
||||
(TREE_TYPE (inner)));
|
||||
tree scope = LAMBDA_TYPE_EXTRA_SCOPE (TREE_TYPE (inner));
|
||||
gcc_checking_assert (TREE_CODE (scope) == VAR_DECL
|
||||
|| TREE_CODE (scope) == FIELD_DECL
|
||||
|| TREE_CODE (scope) == PARM_DECL
|
||||
|
|
Loading…
Add table
Reference in a new issue