From a5b627aa4fe749f8df0a27fcb1f6fe3b59a21e09 Mon Sep 17 00:00:00 2001 From: Anton Zabaznov Date: Fri, 5 Feb 2021 11:15:56 +0300 Subject: [OpenCL] Introduce new language options for OpenCL keywords. OpenCL keywords 'pipe' and 'generic' are unconditionally supported for OpenCL C 2.0 or in OpenCL C++ mode. In OpenCL C 3.0 these keywords are available if corresponding optional core feature is supported. Reviewed By: Anastasia, svenvh Differential Revision: https://reviews.llvm.org/D95778 --- clang/lib/Parse/ParseDecl.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'clang/lib/Parse/ParseDecl.cpp') diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index 55a0c6a..3d5c984 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/lib/Parse/ParseDecl.cpp @@ -3896,8 +3896,8 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS, case tok::kw_pipe: if (!getLangOpts().OpenCL || (getLangOpts().OpenCLVersion < 200 && !getLangOpts().OpenCLCPlusPlus)) { - // OpenCL 2.0 defined this keyword. OpenCL 1.2 and earlier should - // support the "pipe" word as identifier. + // OpenCL 2.0 and later define this keyword. OpenCL 1.2 and earlier + // should support the "pipe" word as identifier. Tok.getIdentifierInfo()->revertTokenIDToIdentifier(); goto DoneWithDeclSpec; } @@ -4017,8 +4017,7 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS, case tok::kw___generic: // generic address space is introduced only in OpenCL v2.0 // see OpenCL C Spec v2.0 s6.5.5 - if (Actions.getLangOpts().OpenCLVersion < 200 && - !Actions.getLangOpts().OpenCLCPlusPlus) { + if (!Actions.getLangOpts().OpenCLGenericAddressSpace) { DiagID = diag::err_opencl_unknown_type_specifier; PrevSpec = Tok.getIdentifierInfo()->getNameStart(); isInvalid = true; @@ -5070,8 +5069,7 @@ bool Parser::isDeclarationSpecifier(bool DisambiguatingWithExpression) { default: return false; case tok::kw_pipe: - return (getLangOpts().OpenCL && getLangOpts().OpenCLVersion >= 200) || - getLangOpts().OpenCLCPlusPlus; + return getLangOpts().OpenCLPipe; case tok::identifier: // foo::bar // Unfortunate hack to support "Class.factoryMethod" notation. @@ -5599,8 +5597,7 @@ static bool isPtrOperatorToken(tok::TokenKind Kind, const LangOptions &Lang, if (Kind == tok::star || Kind == tok::caret) return true; - if (Kind == tok::kw_pipe && - ((Lang.OpenCL && Lang.OpenCLVersion >= 200) || Lang.OpenCLCPlusPlus)) + if (Kind == tok::kw_pipe && Lang.OpenCLPipe) return true; if (!Lang.CPlusPlus) -- cgit v1.1