diff options
| author | Anastasia Stulova <anastasia.stulova@arm.com> | 2019-07-18 10:02:35 +0000 |
|---|---|---|
| committer | Anastasia Stulova <anastasia.stulova@arm.com> | 2019-07-18 10:02:35 +0000 |
| commit | 46b55fa58dead05222211e327ed90ffab949040b (patch) | |
| tree | 8f2ca71f2ea82e472c64c13ff4e0a900a5c19bb9 /clang/lib | |
| parent | 51cdd51807ad0b8b9507c12c679ff618a572c0fc (diff) | |
| download | bcm5719-llvm-46b55fa58dead05222211e327ed90ffab949040b.tar.gz bcm5719-llvm-46b55fa58dead05222211e327ed90ffab949040b.zip | |
[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
llvm-svn: 366421
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/Frontend/InitPreprocessor.cpp | 2 | ||||
| -rw-r--r-- | clang/lib/Parse/ParseDecl.cpp | 3 | ||||
| -rw-r--r-- | clang/lib/Sema/DeclSpec.cpp | 1 | ||||
| -rw-r--r-- | clang/lib/Sema/SemaCast.cpp | 2 | ||||
| -rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 11 | ||||
| -rw-r--r-- | clang/lib/Sema/SemaDeclCXX.cpp | 4 | ||||
| -rw-r--r-- | clang/lib/Sema/SemaExprCXX.cpp | 6 |
7 files changed, 14 insertions, 15 deletions
diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp index 11ebab94548..3906e2ae1b9 100644 --- a/clang/lib/Frontend/InitPreprocessor.cpp +++ b/clang/lib/Frontend/InitPreprocessor.cpp @@ -411,7 +411,7 @@ static void InitializeStandardPredefinedMacros(const TargetInfo &TI, 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 diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index 97fd92bec78..73b4f50fda4 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/lib/Parse/ParseDecl.cpp @@ -3559,7 +3559,8 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS, 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(); diff --git a/clang/lib/Sema/DeclSpec.cpp b/clang/lib/Sema/DeclSpec.cpp index 9433efb1819..77e5eb09569 100644 --- a/clang/lib/Sema/DeclSpec.cpp +++ b/clang/lib/Sema/DeclSpec.cpp @@ -596,7 +596,6 @@ bool DeclSpec::SetStorageClassSpec(Sema &S, SCS SC, SourceLocation Loc, // 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) { diff --git a/clang/lib/Sema/SemaCast.cpp b/clang/lib/Sema/SemaCast.cpp index 85d6da700ea..f184eda2f27 100644 --- a/clang/lib/Sema/SemaCast.cpp +++ b/clang/lib/Sema/SemaCast.cpp @@ -285,7 +285,7 @@ Sema::BuildCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind, 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"); diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 72b4f6bbcda..a6c52b7d4b2 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -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(VarDecl *NewVD) { // 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 *RealDecl, Expr *Init, bool DirectInit) { // 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); diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index cb6b4188039..dd77fc55721 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -13272,7 +13272,7 @@ CheckOperatorNewDeleteTypes(Sema &SemaRef, const FunctionDecl *FnDecl, 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 &SemaRef, const FunctionDecl *FnDecl, // 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); diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp index cdca2e8cac6..705e3b9bd7f 100644 --- a/clang/lib/Sema/SemaExprCXX.cpp +++ b/clang/lib/Sema/SemaExprCXX.cpp @@ -529,7 +529,7 @@ ExprResult Sema::BuildCXXTypeId(QualType TypeInfoType, 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; |

