summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorJoey Gouly <joey.gouly@gmail.com>2014-01-06 11:26:18 +0000
committerJoey Gouly <joey.gouly@gmail.com>2014-01-06 11:26:18 +0000
commit16cb99dd15834bcc0c857e0bbfb1c9b48a26d694 (patch)
tree9c8c16901d364fef2ec86e195d49982cb729b47b /clang/lib
parent20b9966e5f6a7cc0e0d374492c2de1062888b156 (diff)
downloadbcm5719-llvm-16cb99dd15834bcc0c857e0bbfb1c9b48a26d694.tar.gz
bcm5719-llvm-16cb99dd15834bcc0c857e0bbfb1c9b48a26d694.zip
[OpenCL] Produce an error if an address space is used on the return
type of a function. llvm-svn: 198597
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 793337cc5ad..bdb8bbac72a 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -7030,6 +7030,19 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC,
}
}
+ if (getLangOpts().OpenCL) {
+ // OpenCL v1.1 s6.5: Using an address space qualifier in a function return
+ // type declaration will generate a compilation error.
+ unsigned AddressSpace = RetType.getAddressSpace();
+ if (AddressSpace == LangAS::opencl_local ||
+ AddressSpace == LangAS::opencl_global ||
+ AddressSpace == LangAS::opencl_constant) {
+ Diag(NewFD->getLocation(),
+ diag::err_opencl_return_value_with_address_space);
+ NewFD->setInvalidDecl();
+ }
+ }
+
if (!getLangOpts().CPlusPlus) {
// Perform semantic checking on the function declaration.
bool isExplicitSpecialization=false;
OpenPOWER on IntegriCloud