r366421 - [OpenCL] Update comments/diagnostics to refer to C++ for OpenCL
Anastasia Stulova via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 18 03:02:36 PDT 2019
Author: stulova
Date: Thu Jul 18 03:02:35 2019
New Revision: 366421
URL: http://llvm.org/viewvc/llvm-project?rev=366421&view=rev
Log:
[OpenCL] Update comments/diagnostics to refer to C++ for OpenCL
Clang doesn't implement OpenCL C++, change the comments to
reflect that.
Differential Revision: https://reviews.llvm.org/D64867
Modified:
cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td
cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
cfe/trunk/include/clang/Basic/LangOptions.def
cfe/trunk/include/clang/Basic/TokenKinds.def
cfe/trunk/include/clang/Frontend/LangStandards.def
cfe/trunk/lib/Frontend/InitPreprocessor.cpp
cfe/trunk/lib/Parse/ParseDecl.cpp
cfe/trunk/lib/Sema/DeclSpec.cpp
cfe/trunk/lib/Sema/SemaCast.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/lib/Sema/SemaExprCXX.cpp
cfe/trunk/test/Driver/unknown-std.cl
cfe/trunk/test/Parser/opencl-cxx-keywords.cl
cfe/trunk/test/Parser/opencl-cxx-virtual.cl
cfe/trunk/test/SemaOpenCLCXX/newdelete.cl
cfe/trunk/test/SemaOpenCLCXX/restricted.cl
Modified: cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td?rev=366421&r1=366420&r2=366421&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td Thu Jul 18 03:02:35 2019
@@ -132,8 +132,8 @@ def err_nullability_conflicting : Error<
// 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>;
@@ -291,9 +291,9 @@ def note_mt_message : Note<"[rewriter] %
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<
Modified: cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td?rev=366421&r1=366420&r2=366421&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td Thu Jul 18 03:02:35 2019
@@ -1154,9 +1154,9 @@ def err_opencl_taking_function_address_p
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<
Modified: cfe/trunk/include/clang/Basic/LangOptions.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LangOptions.def?rev=366421&r1=366420&r2=366421&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/LangOptions.def (original)
+++ cfe/trunk/include/clang/Basic/LangOptions.def Thu Jul 18 03:02:35 2019
@@ -197,8 +197,8 @@ LANGOPT(ShortEnums , 1, 0, "short
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")
Modified: cfe/trunk/include/clang/Basic/TokenKinds.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TokenKinds.def?rev=366421&r1=366420&r2=366421&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/TokenKinds.def (original)
+++ cfe/trunk/include/clang/Basic/TokenKinds.def Thu Jul 18 03:02:35 2019
@@ -252,9 +252,8 @@ PUNCTUATOR(caretcaret, "^^")
// 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
Modified: cfe/trunk/include/clang/Frontend/LangStandards.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/LangStandards.def?rev=366421&r1=366420&r2=366421&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/LangStandards.def (original)
+++ cfe/trunk/include/clang/Frontend/LangStandards.def Thu Jul 18 03:02:35 2019
@@ -166,7 +166,7 @@ LANGSTANDARD(opencl20, "cl2.0",
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)
Modified: cfe/trunk/lib/Frontend/InitPreprocessor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitPreprocessor.cpp?rev=366421&r1=366420&r2=366421&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/InitPreprocessor.cpp (original)
+++ cfe/trunk/lib/Frontend/InitPreprocessor.cpp Thu Jul 18 03:02:35 2019
@@ -411,7 +411,7 @@ static void InitializeStandardPredefined
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
Modified: cfe/trunk/lib/Parse/ParseDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=366421&r1=366420&r2=366421&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDecl.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDecl.cpp Thu Jul 18 03:02:35 2019
@@ -3559,7 +3559,8 @@ void Parser::ParseDeclarationSpecifiers(
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();
Modified: cfe/trunk/lib/Sema/DeclSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/DeclSpec.cpp?rev=366421&r1=366420&r2=366421&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/DeclSpec.cpp (original)
+++ cfe/trunk/lib/Sema/DeclSpec.cpp Thu Jul 18 03:02:35 2019
@@ -596,7 +596,6 @@ bool DeclSpec::SetStorageClassSpec(Sema
// 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) {
Modified: cfe/trunk/lib/Sema/SemaCast.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCast.cpp?rev=366421&r1=366420&r2=366421&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaCast.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCast.cpp Thu Jul 18 03:02:35 2019
@@ -285,7 +285,7 @@ Sema::BuildCXXNamedCast(SourceLocation O
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");
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=366421&r1=366420&r2=366421&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Thu Jul 18 03:02:35 2019
@@ -6428,8 +6428,8 @@ NamedDecl *Sema::ActOnVariableDeclarator
}
}
- // 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) {
@@ -7435,9 +7435,8 @@ void Sema::CheckVariableDeclarationType(
// 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() &&
@@ -11590,7 +11589,7 @@ void Sema::AddInitializerToDecl(Decl *Re
// 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);
Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=366421&r1=366420&r2=366421&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Thu Jul 18 03:02:35 2019
@@ -13272,7 +13272,7 @@ CheckOperatorNewDeleteTypes(Sema &SemaRe
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);
@@ -13305,7 +13305,7 @@ CheckOperatorNewDeleteTypes(Sema &SemaRe
// 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);
Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=366421&r1=366420&r2=366421&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Thu Jul 18 03:02:35 2019
@@ -529,7 +529,7 @@ ExprResult Sema::BuildCXXTypeId(QualType
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");
@@ -2656,8 +2656,8 @@ void Sema::DeclareGlobalNewDelete() {
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;
Modified: cfe/trunk/test/Driver/unknown-std.cl
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/unknown-std.cl?rev=366421&r1=366420&r2=366421&view=diff
==============================================================================
--- cfe/trunk/test/Driver/unknown-std.cl (original)
+++ cfe/trunk/test/Driver/unknown-std.cl Thu Jul 18 03:02:35 2019
@@ -10,7 +10,7 @@
// 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: {{^.+$}}
Modified: cfe/trunk/test/Parser/opencl-cxx-keywords.cl
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/opencl-cxx-keywords.cl?rev=366421&r1=366420&r2=366421&view=diff
==============================================================================
--- cfe/trunk/test/Parser/opencl-cxx-keywords.cl (original)
+++ cfe/trunk/test/Parser/opencl-cxx-keywords.cl Thu Jul 18 03:02:35 2019
@@ -2,7 +2,7 @@
// 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() {
Modified: cfe/trunk/test/Parser/opencl-cxx-virtual.cl
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/opencl-cxx-virtual.cl?rev=366421&r1=366420&r2=366421&view=diff
==============================================================================
--- cfe/trunk/test/Parser/opencl-cxx-virtual.cl (original)
+++ cfe/trunk/test/Parser/opencl-cxx-virtual.cl Thu Jul 18 03:02:35 2019
@@ -3,17 +3,17 @@
// Test that virtual functions and abstract classes are rejected.
class virtual_functions {
virtual void bad1() {}
- //expected-error at -1 {{virtual functions are not supported in OpenCL C++}}
+ //expected-error at -1 {{virtual functions are not supported in C++ for OpenCL}}
virtual void bad2() = 0;
- //expected-error at -1 {{virtual functions are not supported in OpenCL C++}}
+ //expected-error at -1 {{virtual functions are not supported in C++ for OpenCL}}
//expected-error at -2 {{'bad2' is not virtual and cannot be declared pure}}
};
template <typename T>
class X {
virtual T f();
- //expected-error at -1 {{virtual functions are not supported in OpenCL C++}}
+ //expected-error at -1 {{virtual functions are not supported in C++ for OpenCL}}
};
// Test that virtual base classes are allowed.
Modified: cfe/trunk/test/SemaOpenCLCXX/newdelete.cl
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaOpenCLCXX/newdelete.cl?rev=366421&r1=366420&r2=366421&view=diff
==============================================================================
--- cfe/trunk/test/SemaOpenCLCXX/newdelete.cl (original)
+++ cfe/trunk/test/SemaOpenCLCXX/newdelete.cl Thu Jul 18 03:02:35 2019
@@ -19,8 +19,8 @@ class B {
// 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}}
}
@@ -36,10 +36,10 @@ void *operator new[](size_t _s, void *pt
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;
Modified: cfe/trunk/test/SemaOpenCLCXX/restricted.cl
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaOpenCLCXX/restricted.cl?rev=366421&r1=366420&r2=366421&view=diff
==============================================================================
--- cfe/trunk/test/SemaOpenCLCXX/restricted.cl (original)
+++ cfe/trunk/test/SemaOpenCLCXX/restricted.cl Thu Jul 18 03:02:35 2019
@@ -1,9 +1,9 @@
// 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 {
@@ -11,9 +11,9 @@ namespace std {
};
}
__constant std::type_info int_ti = typeid(int);
-// expected-error at -1 {{'typeid' is not supported in OpenCL C++}}
+// expected-error at -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;
@@ -25,17 +25,17 @@ class B : public A {
B *test_dynamic_cast(B *p) {
return dynamic_cast<B *>(p);
- // expected-error at -1 {{'dynamic_cast' is not supported in OpenCL C++}}
+ // expected-error at -1 {{'dynamic_cast' is not supported in C++ for OpenCL}}
}
// Test storage class qualifiers.
__constant _Thread_local int a = 1;
-// expected-error at -1 {{OpenCL C++ version 1.0 does not support the '_Thread_local' storage class specifier}}
+// expected-error at -1 {{C++ for OpenCL version 1.0 does not support the '_Thread_local' storage class specifier}}
__constant __thread int b = 2;
-// expected-error at -1 {{OpenCL C++ version 1.0 does not support the '__thread' storage class specifier}}
+// expected-error at -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 at -1 {{OpenCL C++ version 1.0 does not support the 'register' storage class specifier}}
+ // expected-error at -1 {{C++ for OpenCL version 1.0 does not support the 'register' storage class specifier}}
thread_local int y;
- // expected-error at -1 {{OpenCL C++ version 1.0 does not support the 'thread_local' storage class specifier}}
+ // expected-error at -1 {{C++ for OpenCL version 1.0 does not support the 'thread_local' storage class specifier}}
}
More information about the cfe-commits
mailing list