// OpenCL Section 6.8.g
def err_opencl_unknown_type_specifier : Error<
- "OpenCL %select{C|C++}0 version %1 does not support the '%2' "
- "%select{type qualifier|storage class specifier}3">;
+ "%select{OpenCL C|C++ for OpenCL}0 version %1 does not support the "
+ "'%2' %select{type qualifier|storage class specifier}3">;
def warn_unknown_attribute_ignored : Warning<
"unknown attribute %0 ignored">, InGroup<UnknownAttributes>;
def warn_arcmt_nsalloc_realloc : Warning<"[rewriter] call returns pointer to GC managed memory; it will become unmanaged in ARC">;
def err_arcmt_nsinvocation_ownership : Error<"NSInvocation's %0 is not safe to be used with an object with ownership other than __unsafe_unretained">;
-// OpenCL C++.
+// C++ for OpenCL.
def err_openclcxx_not_supported : Error<
- "'%0' is not supported in OpenCL C++">;
+ "'%0' is not supported in C++ for OpenCL">;
// OpenMP
def err_omp_more_one_clause : Error<
def err_opencl_logical_exclusive_or : Error<
"^^ is a reserved operator in OpenCL">;
-// OpenCL C++.
+// C++ for OpenCL.
def err_openclcxx_virtual_function : Error<
- "virtual functions are not supported in OpenCL C++">;
+ "virtual functions are not supported in C++ for OpenCL">;
// OpenMP support.
def warn_pragma_omp_ignored : Warning<
LANGOPT(OpenCL , 1, 0, "OpenCL")
LANGOPT(OpenCLVersion , 32, 0, "OpenCL C version")
-LANGOPT(OpenCLCPlusPlus , 1, 0, "OpenCL C++")
-LANGOPT(OpenCLCPlusPlusVersion , 32, 0, "OpenCL C++ version")
+LANGOPT(OpenCLCPlusPlus , 1, 0, "C++ for OpenCL")
+LANGOPT(OpenCLCPlusPlusVersion , 32, 0, "C++ for OpenCL version")
LANGOPT(NativeHalfType , 1, 0, "Native half type support")
LANGOPT(NativeHalfArgsAndReturns, 1, 0, "Native half args and returns")
LANGOPT(HalfArgsAndReturns, 1, 0, "half args and returns")
// KEYNOMS18 - This is a keyword that must never be enabled under
// MSVC <= v18.
// KEYOPENCLC - This is a keyword in OpenCL C
-// KEYOPENCLCXX - This is a keyword in OpenCL C++
-// KEYNOOPENCL - This is a keyword that is not supported in OpenCL C
-// nor in OpenCL C++.
+// KEYOPENCLCXX - This is a keyword in C++ for OpenCL
+// KEYNOOPENCL - This is a keyword that is not supported in OpenCL
// KEYALTIVEC - This is a keyword in AltiVec
// KEYZVECTOR - This is a keyword for the System z vector extensions,
// which are heavily based on AltiVec
OpenCL, "OpenCL 2.0",
LineComment | C99 | Digraphs | HexFloat | OpenCL)
LANGSTANDARD(openclcpp, "c++",
- OpenCL, "OpenCL C++ 1.0",
+ OpenCL, "C++ for OpenCL",
LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus17 |
Digraphs | HexFloat | OpenCL)
if (LangOpts.OpenCLCPlusPlusVersion == 100)
Builder.defineMacro("__OPENCL_CPP_VERSION__", "100");
else
- llvm_unreachable("Unsupported OpenCL C++ version");
+ llvm_unreachable("Unsupported C++ version for OpenCL");
Builder.defineMacro("__CL_CPP_VERSION_1_0__", "100");
} else {
// OpenCL v1.0 and v1.1 do not have a predefined macro to indicate the
isInvalid = DS.setFunctionSpecInline(Loc, PrevSpec, DiagID);
break;
case tok::kw_virtual:
- // OpenCL C++ v1.0 s2.9: the virtual function qualifier is not supported.
+ // C++ for OpenCL does not allow virtual function qualifier, to avoid
+ // function pointers restricted in OpenCL v2.0 s6.9.a.
if (getLangOpts().OpenCLCPlusPlus) {
DiagID = diag::err_openclcxx_virtual_function;
PrevSpec = Tok.getIdentifierInfo()->getNameStart();
// these storage-class specifiers.
// OpenCL v1.2 s6.8 changes this to "The auto and register storage-class
// specifiers are not supported."
- // OpenCL C++ v1.0 s2.9 restricts register.
if (S.getLangOpts().OpenCL &&
!S.getOpenCLOptions().isEnabled("cl_clang_storage_class_specifiers")) {
switch (SC) {
AngleBrackets));
case tok::kw_dynamic_cast: {
- // OpenCL C++ 1.0 s2.9: dynamic_cast is not supported.
+ // dynamic_cast is not supported in C++ for OpenCL.
if (getLangOpts().OpenCLCPlusPlus) {
return ExprError(Diag(OpLoc, diag::err_openclcxx_not_supported)
<< "dynamic_cast");
}
}
- // OpenCL C++ 1.0 s2.9: the thread_local storage qualifier is not
- // supported. OpenCL C does not support thread_local either, and
+ // C++ for OpenCL does not allow the thread_local storage qualifier.
+ // OpenCL C does not support thread_local either, and
// also reject all other thread storage class specifiers.
DeclSpec::TSCS TSC = D.getDeclSpec().getThreadStorageClassSpec();
if (TSC != TSCS_unspecified) {
// OpenCL C v2.0 s6.5.1 - Variables defined at program scope and static
// variables inside a function can also be declared in the global
// address space.
- // OpenCL C++ v1.0 s2.5 inherits rule from OpenCL C v2.0 and allows local
- // address space additionally.
- // FIXME: Add local AS for OpenCL C++.
+ // C++ for OpenCL inherits rule from OpenCL C v2.0.
+ // FIXME: Adding local AS in C++ for OpenCL might make sense.
if (NewVD->isFileVarDecl() || NewVD->isStaticLocal() ||
NewVD->hasExternalStorage()) {
if (!T->isSamplerT() &&
// do nothing
// OpenCL v1.2 s6.5.3: __constant locals must be constant-initialized.
- // This is true even in OpenCL C++.
+ // This is true even in C++ for OpenCL.
} else if (VDecl->getType().getAddressSpace() == LangAS::opencl_constant) {
CheckForConstantInitializer(Init, DclT);
diag::err_operator_new_delete_dependent_result_type)
<< FnDecl->getDeclName() << ExpectedResultType;
- // OpenCL C++: the operator is valid on any address space.
+ // The operator is valid on any address space for OpenCL.
if (SemaRef.getLangOpts().OpenCLCPlusPlus) {
if (auto *PtrTy = ResultType->getAs<PointerType>()) {
ResultType = RemoveAddressSpaceFromPtr(SemaRef, PtrTy);
// Check that the first parameter type is what we expect.
if (SemaRef.getLangOpts().OpenCLCPlusPlus) {
- // OpenCL C++: the operator is valid on any address space.
+ // The operator is valid on any address space for OpenCL.
if (auto *PtrTy =
FnDecl->getParamDecl(0)->getType()->getAs<PointerType>()) {
FirstParamType = RemoveAddressSpaceFromPtr(SemaRef, PtrTy);
ExprResult
Sema::ActOnCXXTypeid(SourceLocation OpLoc, SourceLocation LParenLoc,
bool isType, void *TyOrExpr, SourceLocation RParenLoc) {
- // OpenCL C++ 1.0 s2.9: typeid is not supported.
+ // typeid is not supported in OpenCL.
if (getLangOpts().OpenCLCPlusPlus) {
return ExprError(Diag(OpLoc, diag::err_openclcxx_not_supported)
<< "typeid");
if (GlobalNewDeleteDeclared)
return;
- // OpenCL C++ 1.0 s2.9: the implicitly declared new and delete operators
- // are not supported.
+ // The implicitly declared new and delete operators
+ // are not supported in OpenCL.
if (getLangOpts().OpenCLCPlusPlus)
return;
// CHECK-NEXT: note: use 'cl1.1' for 'OpenCL 1.1' standard
// CHECK-NEXT: note: use 'cl1.2' for 'OpenCL 1.2' standard
// CHECK-NEXT: note: use 'cl2.0' for 'OpenCL 2.0' standard
-// CHECK-NEXT: note: use 'c++' for 'OpenCL C++ 1.0' standard
+// CHECK-NEXT: note: use 'c++' for 'C++ for OpenCL' standard
// Make sure that no other output is present.
// CHECK-NOT: {{^.+$}}
// RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=c++ -verify -fsyntax-only -fexceptions -fcxx-exceptions
// This test checks that various C++ and OpenCL C keywords are not available
-// in OpenCL C++, according to OpenCL C++ 1.0 Specification Section 2.9.
+// in OpenCL.
// Test that exceptions are disabled despite passing -fcxx-exceptions.
kernel void test_exceptions() {
// Test that virtual functions and abstract classes are rejected.
class virtual_functions {
virtual void bad1() {}
- //expected-error@-1 {{virtual functions are not supported in OpenCL C++}}
+ //expected-error@-1 {{virtual functions are not supported in C++ for OpenCL}}
virtual void bad2() = 0;
- //expected-error@-1 {{virtual functions are not supported in OpenCL C++}}
+ //expected-error@-1 {{virtual functions are not supported in C++ for OpenCL}}
//expected-error@-2 {{'bad2' is not virtual and cannot be declared pure}}
};
template <typename T>
class X {
virtual T f();
- //expected-error@-1 {{virtual functions are not supported in OpenCL C++}}
+ //expected-error@-1 {{virtual functions are not supported in C++ for OpenCL}}
};
// Test that virtual base classes are allowed.
// There are no global user-defined new operators at this point. Test that clang
// rejects these gracefully.
void test_default_new_delete(void *buffer, A **pa) {
- A *a = new A; // expected-error {{'default new' is not supported in OpenCL C++}}
- delete a; // expected-error {{'default delete' is not supported in OpenCL C++}}
+ A *a = new A; // expected-error {{'default new' is not supported in C++ for OpenCL}}
+ delete a; // expected-error {{'default delete' is not supported in C++ for OpenCL}}
*pa = new (buffer) A; // expected-error {{use of placement new requires explicit declaration}}
}
void test_new_delete(void *buffer, A **a, B **b) {
*a = new A; // expected-error {{no matching function for call to 'operator new'}}
- delete a; // expected-error {{'default delete' is not supported in OpenCL C++}}
+ delete a; // expected-error {{'default delete' is not supported in C++ for OpenCL}}
*a = new A[20]; // expected-error {{no matching function for call to 'operator new[]'}}
- delete[] *a; // expected-error {{'default delete' is not supported in OpenCL C++}}
+ delete[] *a; // expected-error {{'default delete' is not supported in C++ for OpenCL}}
// User-defined placement new is supported.
*a = new (buffer) A;
// RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=c++ -pedantic -verify -fsyntax-only
// This test checks that various C/C++/OpenCL C constructs are not available in
-// OpenCL C++, according to OpenCL C++ 1.0 Specification Section 2.9.
+// C++ for OpenCL.
-// Test that typeid is not available in OpenCL C++.
+// Test that typeid is not available.
namespace std {
// Provide a dummy std::type_info so that we can use typeid.
class type_info {
};
}
__constant std::type_info int_ti = typeid(int);
-// expected-error@-1 {{'typeid' is not supported in OpenCL C++}}
+// expected-error@-1 {{'typeid' is not supported in C++ for OpenCL}}
-// Test that dynamic_cast is not available in OpenCL C++.
+// Test that dynamic_cast is not available in C++ for OpenCL.
class A {
public:
int a;
B *test_dynamic_cast(B *p) {
return dynamic_cast<B *>(p);
- // expected-error@-1 {{'dynamic_cast' is not supported in OpenCL C++}}
+ // expected-error@-1 {{'dynamic_cast' is not supported in C++ for OpenCL}}
}
// Test storage class qualifiers.
__constant _Thread_local int a = 1;
-// expected-error@-1 {{OpenCL C++ version 1.0 does not support the '_Thread_local' storage class specifier}}
+// expected-error@-1 {{C++ for OpenCL version 1.0 does not support the '_Thread_local' storage class specifier}}
__constant __thread int b = 2;
-// expected-error@-1 {{OpenCL C++ version 1.0 does not support the '__thread' storage class specifier}}
+// expected-error@-1 {{C++ for OpenCL version 1.0 does not support the '__thread' storage class specifier}}
kernel void test_storage_classes() {
register int x;
- // expected-error@-1 {{OpenCL C++ version 1.0 does not support the 'register' storage class specifier}}
+ // expected-error@-1 {{C++ for OpenCL version 1.0 does not support the 'register' storage class specifier}}
thread_local int y;
- // expected-error@-1 {{OpenCL C++ version 1.0 does not support the 'thread_local' storage class specifier}}
+ // expected-error@-1 {{C++ for OpenCL version 1.0 does not support the 'thread_local' storage class specifier}}
}