diff options
author | Anton Zabaznov <anton.zabaznov@intel.com> | 2021-02-05 11:15:56 +0300 |
---|---|---|
committer | Anton Zabaznov <anton.zabaznov@intel.com> | 2021-02-05 11:18:48 +0300 |
commit | a5b627aa4fe749f8df0a27fcb1f6fe3b59a21e09 (patch) | |
tree | 7899900038fa1b6bc78ea41d8eb63768ac43183e /clang/lib/Parse/ParseDecl.cpp | |
parent | b90c4907ae81e13ff3ce8a56b698e92b36a62d61 (diff) | |
download | llvm-a5b627aa4fe749f8df0a27fcb1f6fe3b59a21e09.zip llvm-a5b627aa4fe749f8df0a27fcb1f6fe3b59a21e09.tar.gz llvm-a5b627aa4fe749f8df0a27fcb1f6fe3b59a21e09.tar.bz2 |
[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
Diffstat (limited to 'clang/lib/Parse/ParseDecl.cpp')
-rw-r--r-- | clang/lib/Parse/ParseDecl.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
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) |