diff options
author | Justin Lebar <jlebar@google.com> | 2016-09-30 17:14:53 +0000 |
---|---|---|
committer | Justin Lebar <jlebar@google.com> | 2016-09-30 17:14:53 +0000 |
commit | 7ca116cacfcf3d33bb0a17a76bd8495557e2b6fb (patch) | |
tree | 37d68d77ad3ef7397af18af9687700f7468556b6 /clang/lib/Sema/SemaLambda.cpp | |
parent | 0fad0ba6a9b0e4900a6e247831c83f665bde2a6b (diff) | |
download | bcm5719-llvm-7ca116cacfcf3d33bb0a17a76bd8495557e2b6fb.tar.gz bcm5719-llvm-7ca116cacfcf3d33bb0a17a76bd8495557e2b6fb.zip |
[CUDA] Make lambdas inherit __host__ and __device__ attributes from the scope in which they're created.
Summary: NVCC compat. Fixes bug 30567.
Reviewers: tra
Subscribers: cfe-commits, rnk
Differential Revision: https://reviews.llvm.org/D25105
llvm-svn: 282880
Diffstat (limited to 'clang/lib/Sema/SemaLambda.cpp')
-rw-r--r-- | clang/lib/Sema/SemaLambda.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaLambda.cpp b/clang/lib/Sema/SemaLambda.cpp index a9462228d6c..0de501fc5e4 100644 --- a/clang/lib/Sema/SemaLambda.cpp +++ b/clang/lib/Sema/SemaLambda.cpp @@ -886,7 +886,12 @@ void Sema::ActOnStartOfLambdaDefinition(LambdaIntroducer &Intro, // Attributes on the lambda apply to the method. ProcessDeclAttributes(CurScope, Method, ParamInfo); - + + // CUDA lambdas get implicit attributes based on the scope in which they're + // declared. + if (getLangOpts().CUDA) + CUDASetLambdaAttrs(Method); + // Introduce the function call operator as the current declaration context. PushDeclContext(CurScope, Method); |