diff options
author | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-08-20 01:45:44 +0000 |
---|---|---|
committer | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-08-20 01:45:44 +0000 |
commit | d05ba3efcce20690ea475037fb40611263a6aaab (patch) | |
tree | 610e361af05e82acc2adedabe3bec485e19f5df2 /gcc/cp/lambda.c | |
parent | 353e554a0af099e541b0209a0308ceed7357d25f (diff) | |
download | gcc-d05ba3efcce20690ea475037fb40611263a6aaab.tar.gz |
* lambda.c (current_nonlambda_scope): New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@227022 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/lambda.c')
-rw-r--r-- | gcc/cp/lambda.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/gcc/cp/lambda.c b/gcc/cp/lambda.c index dcd3bb92ca0..ea9dba05227 100644 --- a/gcc/cp/lambda.c +++ b/gcc/cp/lambda.c @@ -817,6 +817,30 @@ nonlambda_method_basetype (void) return TYPE_METHOD_BASETYPE (TREE_TYPE (fn)); } +/* Like current_scope, but looking through lambdas. */ + +tree +current_nonlambda_scope (void) +{ + tree scope = current_scope (); + for (;;) + { + if (TREE_CODE (scope) == FUNCTION_DECL + && LAMBDA_FUNCTION_P (scope)) + { + scope = CP_TYPE_CONTEXT (DECL_CONTEXT (scope)); + continue; + } + else if (LAMBDA_TYPE_P (scope)) + { + scope = CP_TYPE_CONTEXT (scope); + continue; + } + break; + } + return scope; +} + /* Helper function for maybe_add_lambda_conv_op; build a CALL_EXPR with indicated FN and NARGS, but do not initialize the return type or any of the argument slots. */ |