Index: clang/include/clang/Basic/DiagnosticFrontendKinds.td =================================================================== --- clang/include/clang/Basic/DiagnosticFrontendKinds.td +++ clang/include/clang/Basic/DiagnosticFrontendKinds.td @@ -245,7 +245,7 @@ "invalid virtual filesystem overlay file '%0'">, DefaultFatal; def warn_option_invalid_ocl_version : Warning< - "OpenCL version %0 does not support the option '%1'">, InGroup; + "%select{OpenCL C|C++ for OpenCL}0 version %1 does not support the option '%2'">, InGroup; def err_builtin_needs_feature : Error<"%0 needs target feature %1">; def err_function_needs_feature : Error< Index: clang/include/clang/Basic/DiagnosticSemaKinds.td =================================================================== --- clang/include/clang/Basic/DiagnosticSemaKinds.td +++ clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -2953,7 +2953,7 @@ "%0 attribute requires a %select{positive|non-negative}1 " "integral compile time constant expression">; def err_attribute_requires_opencl_version : Error< - "%0 attribute requires OpenCL version %1%select{| or above}2">; + "%0 attribute requires %select{OpenCL C|C++ for OpenCL}1 version %2%select{| or above}3">; def err_invalid_branch_protection_spec : Error< "invalid or misplaced branch protection specification '%0'">; def warn_unsupported_target_attribute @@ -10080,7 +10080,7 @@ def err_opencl_type_not_found : Error< "%0 type %1 not found; include the base header with -finclude-default-header">; def warn_opencl_attr_deprecated_ignored : Warning < - "%0 attribute is deprecated and ignored in OpenCL version %1">, + "%0 attribute is deprecated and ignored in %select{OpenCL C|C++ for OpenCL}1 version %2">, InGroup; def err_opencl_variadic_function : Error< "invalid prototype, variadic arguments are not allowed in OpenCL">; @@ -10148,7 +10148,7 @@ // OpenCL v3.0 s6.3.7 - Vector Components def ext_opencl_ext_vector_type_rgba_selector: ExtWarn< - "vector component name '%0' is an OpenCL C version 3.0 feature">, + "vector component name '%0' is %select{an OpenCL C|a C++ for OpenCL}1 version %2 feature">, InGroup; def err_openclcxx_placement_new : Error< Index: clang/lib/Frontend/CompilerInvocation.cpp =================================================================== --- clang/lib/Frontend/CompilerInvocation.cpp +++ clang/lib/Frontend/CompilerInvocation.cpp @@ -503,8 +503,10 @@ // -cl-strict-aliasing needs to emit diagnostic in the case where CL > 1.0. // This option should be deprecated for CL > 1.0 because // this option was added for compatibility with OpenCL 1.0. - if (Args.getLastArg(OPT_cl_strict_aliasing) && LangOpts.OpenCLVersion > 100) + if (Args.getLastArg(OPT_cl_strict_aliasing) && + (LangOpts.OpenCLCPlusPlus || LangOpts.OpenCLVersion > 100)) Diags.Report(diag::warn_option_invalid_ocl_version) + << LangOpts.OpenCLCPlusPlus << LangOpts.getOpenCLVersionTuple().getAsString() << Args.getLastArg(OPT_cl_strict_aliasing)->getAsString(Args); Index: clang/lib/Sema/SemaDeclAttr.cpp =================================================================== --- clang/lib/Sema/SemaDeclAttr.cpp +++ clang/lib/Sema/SemaDeclAttr.cpp @@ -7369,12 +7369,12 @@ } static void handleOpenCLNoSVMAttr(Sema &S, Decl *D, const ParsedAttr &AL) { - if (S.LangOpts.OpenCLVersion != 200) + if (S.LangOpts.OpenCLCPlusPlus || S.LangOpts.OpenCLVersion != 200) S.Diag(AL.getLoc(), diag::err_attribute_requires_opencl_version) - << AL << "2.0" << 0; + << AL << 0 << "2.0" << 0; else - S.Diag(AL.getLoc(), diag::warn_opencl_attr_deprecated_ignored) << AL - << "2.0"; + S.Diag(AL.getLoc(), diag::warn_opencl_attr_deprecated_ignored) + << AL << 0 << "2.0"; } static void handleOpenCLAccessAttr(Sema &S, Decl *D, const ParsedAttr &AL) { Index: clang/lib/Sema/SemaExprMember.cpp =================================================================== --- clang/lib/Sema/SemaExprMember.cpp +++ clang/lib/Sema/SemaExprMember.cpp @@ -343,7 +343,7 @@ if (S.getLangOpts().OpenCL && S.getLangOpts().OpenCLVersion < 300) { const char *DiagBegin = HasRGBA ? CompName->getNameStart() : compStr; S.Diag(OpLoc, diag::ext_opencl_ext_vector_type_rgba_selector) - << StringRef(DiagBegin, 1) << SourceRange(CompLoc); + << StringRef(DiagBegin, 1) << SourceRange(CompLoc) << 0 << "3.0"; } } } else { Index: clang/test/Frontend/opencl.cl =================================================================== --- clang/test/Frontend/opencl.cl +++ clang/test/Frontend/opencl.cl @@ -2,7 +2,7 @@ // RUN: %clang_cc1 %s -verify -fsyntax-only -cl-std=CL1.1 -DSYNTAX // RUN: %clang_cc1 %s -verify -fsyntax-only -cl-std=CL1.2 -DSYNTAX // RUN: %clang_cc1 %s -verify -fsyntax-only -cl-std=CL2.0 -DSYNTAX -// RUN: %clang_cc1 %s -verify -fsyntax-only -cl-std=clc++ -DSYNTAX +// RUN: %clang_cc1 %s -verify -fsyntax-only -cl-std=clc++1.0 -DSYNTAX // RUN: %clang_cc1 %s -verify -fsyntax-only -fblocks -DBLOCKS -DSYNTAX // RUN: %clang_cc1 %s -verify -fsyntax-only -cl-std=CL1.1 -fblocks -DBLOCKS -DSYNTAX // RUN: %clang_cc1 %s -verify -fsyntax-only -cl-std=CL1.2 -fblocks -DBLOCKS -DSYNTAX @@ -10,6 +10,7 @@ // RUN: %clang_cc1 -cl-std=CL1.1 -cl-strict-aliasing -fblocks %s 2>&1 | FileCheck --check-prefix=CHECK-INVALID-OPENCL-VERSION11 %s // RUN: %clang_cc1 -cl-std=CL1.2 -cl-strict-aliasing -fblocks %s 2>&1 | FileCheck --check-prefix=CHECK-INVALID-OPENCL-VERSION12 %s // RUN: %clang_cc1 -cl-std=CL2.0 -cl-strict-aliasing %s 2>&1 | FileCheck --check-prefix=CHECK-INVALID-OPENCL-VERSION20 %s +// RUN: %clang_cc1 -cl-std=clc++1.0 -cl-strict-aliasing -fblocks %s 2>&1 | FileCheck --check-prefix=CHECK-INVALID-OPENCLCPP-VERSION10 %s #ifdef SYNTAX class test{ @@ -30,6 +31,7 @@ // expected-error@-6{{blocks support disabled - compile with -fblocks or pick a deployment target that supports them}} #endif -// CHECK-INVALID-OPENCL-VERSION11: warning: OpenCL version 1.1 does not support the option '-cl-strict-aliasing' -// CHECK-INVALID-OPENCL-VERSION12: warning: OpenCL version 1.2 does not support the option '-cl-strict-aliasing' -// CHECK-INVALID-OPENCL-VERSION20: warning: OpenCL version 2.0 does not support the option '-cl-strict-aliasing' +// CHECK-INVALID-OPENCL-VERSION11: warning: OpenCL C version 1.1 does not support the option '-cl-strict-aliasing' +// CHECK-INVALID-OPENCL-VERSION12: warning: OpenCL C version 1.2 does not support the option '-cl-strict-aliasing' +// CHECK-INVALID-OPENCL-VERSION20: warning: OpenCL C version 2.0 does not support the option '-cl-strict-aliasing' +// CHECK-INVALID-OPENCLCPP-VERSION10: warning: C++ for OpenCL version 1.0 does not support the option '-cl-strict-aliasing' Index: clang/test/SemaOpenCL/ext_vectors.cl =================================================================== --- clang/test/SemaOpenCL/ext_vectors.cl +++ clang/test/SemaOpenCL/ext_vectors.cl @@ -1,6 +1,7 @@ // RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL1.1 // RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0 // RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 +// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=clc++1.0 typedef float float4 __attribute__((ext_vector_type(4))); Index: clang/test/SemaOpenCL/nosvm.cl =================================================================== --- clang/test/SemaOpenCL/nosvm.cl +++ clang/test/SemaOpenCL/nosvm.cl @@ -1,13 +1,14 @@ // RUN: %clang_cc1 -verify %s // RUN: %clang_cc1 -verify -cl-std=CL2.0 -D CL20 %s +// RUN: %clang_cc1 -verify -cl-std=clc++1.0 %s // RUN: %clang_cc1 -verify -x c -D NOCL %s #ifndef NOCL kernel void f(__attribute__((nosvm)) global int* a); #ifndef CL20 -// expected-error@-2 {{'nosvm' attribute requires OpenCL version 2.0}} +// expected-error@-2 {{'nosvm' attribute requires OpenCL C version 2.0}} #else -// expected-warning@-4 {{'nosvm' attribute is deprecated and ignored in OpenCL version 2.0}} +// expected-warning@-4 {{'nosvm' attribute is deprecated and ignored in OpenCL C version 2.0}} #endif __attribute__((nosvm)) void g(); // expected-warning {{'nosvm' attribute only applies to variables}}