summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclAttr.cpp
diff options
context:
space:
mode:
authorJustin Lebar <jlebar@google.com>2016-10-13 18:45:13 +0000
committerJustin Lebar <jlebar@google.com>2016-10-13 18:45:13 +0000
commitaa370bd0d77c136bc6ba87c7b20d007a53e82602 (patch)
tree02c923c7e31bf18513da0488ed0be7403fed2b52 /clang/lib/Sema/SemaDeclAttr.cpp
parent179bdce72a4d36abeb9ba6ece8cf312456b92e73 (diff)
downloadbcm5719-llvm-aa370bd0d77c136bc6ba87c7b20d007a53e82602.tar.gz
bcm5719-llvm-aa370bd0d77c136bc6ba87c7b20d007a53e82602.zip
[CUDA] Disallow __shared__ variables in host functions.
Reviewers: tra, rnk Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D25143 llvm-svn: 284144
Diffstat (limited to 'clang/lib/Sema/SemaDeclAttr.cpp')
-rw-r--r--clang/lib/Sema/SemaDeclAttr.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
index 3e8a39a5786..aafb2cbb4cc 100644
--- a/clang/lib/Sema/SemaDeclAttr.cpp
+++ b/clang/lib/Sema/SemaDeclAttr.cpp
@@ -3724,6 +3724,10 @@ static void handleSharedAttr(Sema &S, Decl *D, const AttributeList &Attr) {
S.Diag(Attr.getLoc(), diag::err_cuda_extern_shared) << VD;
return;
}
+ if (S.getLangOpts().CUDA && VD->hasLocalStorage() &&
+ S.CUDADiagIfHostCode(Attr.getLoc(), diag::err_cuda_host_shared)
+ << S.CurrentCUDATarget())
+ return;
D->addAttr(::new (S.Context) CUDASharedAttr(
Attr.getRange(), S.Context, Attr.getAttributeSpellingListIndex()));
}
OpenPOWER on IntegriCloud