summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/DeclSpec.cpp
diff options
context:
space:
mode:
authorTanya Lattner <tonic@nondot.org>2012-06-19 23:09:52 +0000
committerTanya Lattner <tonic@nondot.org>2012-06-19 23:09:52 +0000
commit4fdce3faa89802741d5944ce3e6d06891c6ff21a (patch)
treef79e171887ed34a4dae9f3de6427a2d32b3a0659 /clang/lib/Sema/DeclSpec.cpp
parent73696927903b88bf92d78a98baad4cba6026ffac (diff)
downloadbcm5719-llvm-4fdce3faa89802741d5944ce3e6d06891c6ff21a.tar.gz
bcm5719-llvm-4fdce3faa89802741d5944ce3e6d06891c6ff21a.zip
Extend the support for cl-std to include 1.2.
Add error checking for the static qualifier which is now allowed in certain situations for OpenCL 1.2. Use the CL version to turn on this feature. Added test case for 1.2 static storage class feature. llvm-svn: 158759
Diffstat (limited to 'clang/lib/Sema/DeclSpec.cpp')
-rw-r--r--clang/lib/Sema/DeclSpec.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/clang/lib/Sema/DeclSpec.cpp b/clang/lib/Sema/DeclSpec.cpp
index f6764c29994..966fee3158e 100644
--- a/clang/lib/Sema/DeclSpec.cpp
+++ b/clang/lib/Sema/DeclSpec.cpp
@@ -420,19 +420,27 @@ const char *DeclSpec::getSpecifierName(TQ T) {
bool DeclSpec::SetStorageClassSpec(Sema &S, SCS SC, SourceLocation Loc,
const char *&PrevSpec,
unsigned &DiagID) {
- // OpenCL 1.1 6.8g: "The extern, static, auto and register storage-class
- // specifiers are not supported."
+ // OpenCL v1.1 s6.8g: "The extern, static, auto and register storage-class
+ // specifiers are not supported.
// It seems sensible to prohibit private_extern too
// The cl_clang_storage_class_specifiers extension enables support for
// these storage-class specifiers.
+ // OpenCL v1.2 s6.8 changes this to "The auto and register storage-class
+ // specifiers are not supported."
if (S.getLangOpts().OpenCL &&
!S.getOpenCLOptions().cl_clang_storage_class_specifiers) {
switch (SC) {
case SCS_extern:
case SCS_private_extern:
+ case SCS_static:
+ if (S.getLangOpts().OpenCLVersion < 120) {
+ DiagID = diag::err_not_opencl_storage_class_specifier;
+ PrevSpec = getSpecifierName(SC);
+ return true;
+ }
+ break;
case SCS_auto:
case SCS_register:
- case SCS_static:
DiagID = diag::err_not_opencl_storage_class_specifier;
PrevSpec = getSpecifierName(SC);
return true;
OpenPOWER on IntegriCloud