aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/module.cc
diff options
context:
space:
mode:
authorNathaniel Shead <nathanieloshead@gmail.com>2024-06-15 22:47:07 +1000
committerNathaniel Shead <nathanieloshead@gmail.com>2024-07-08 01:02:39 +1000
commit24cb586cafd40f8fbea68641f97e3431ea76c1b8 (patch)
treed1a93b85b4186ab6d3ea43d8d28a9bd1fc922008 /gcc/cp/module.cc
parentd364c4ced8823bc41fda84f182e1d64e7870549e (diff)
downloadgcc-24cb586cafd40f8fbea68641f97e3431ea76c1b8.zip
gcc-24cb586cafd40f8fbea68641f97e3431ea76c1b8.tar.gz
gcc-24cb586cafd40f8fbea68641f97e3431ea76c1b8.tar.bz2
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>
Diffstat (limited to 'gcc/cp/module.cc')
-rw-r--r--gcc/cp/module.cc7
1 files changed, 2 insertions, 5 deletions
diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc
index dc5d046..da18024 100644
--- a/gcc/cp/module.cc
+++ b/gcc/cp/module.cc
@@ -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