[all-commits] [llvm/llvm-project] 1881f6: Remove ^^ as a token in OpenCL (#108224)
Aaron Ballman via All-commits
all-commits at lists.llvm.org
Mon Sep 16 04:47:20 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 1881f648e28aa58aa0a4dca1422572f65dafa9a4
https://github.com/llvm/llvm-project/commit/1881f648e28aa58aa0a4dca1422572f65dafa9a4
Author: Aaron Ballman <aaron at aaronballman.com>
Date: 2024-09-16 (Mon, 16 Sep 2024)
Changed paths:
M clang-tools-extra/clang-tidy/readability/AvoidUnconditionalPreprocessorIfCheck.cpp
M clang-tools-extra/pseudo/lib/cxx/cxx.bnf
M clang/include/clang/Basic/DiagnosticLexKinds.td
M clang/include/clang/Basic/DiagnosticParseKinds.td
M clang/include/clang/Basic/TokenKinds.def
M clang/lib/Basic/OperatorPrecedence.cpp
M clang/lib/Lex/Lexer.cpp
M clang/lib/Parse/ParseExpr.cpp
M clang/lib/Sema/SemaCodeComplete.cpp
M clang/test/SemaOpenCL/unsupported.cl
Log Message:
-----------
Remove ^^ as a token in OpenCL (#108224)
OpenCL has a reserved operator (^^), the use of which was diagnosed as
an error (735c6cdebdcd4292928079cb18a90f0dd5cd65fb). However, OpenCL
also encourages working with the blocks language extension. This token
has a parsing ambiguity as a result. Consider:
unsigned x=0;
unsigned y=x^^{return 0;}();
This should result in y holding the value zero (0^0) through an
immediately invoked block call as the right-hand side of the xor
operator. However, it causes errors instead because of this reserved
token: https://godbolt.org/z/navf7jTv1
This token is still reserved in OpenCL 3.0, so we still wish to issue a
diagnostic for its use. However, we do not need to create a token for an
extension point that's been unused for about a decade. So this patch
moves the diagnostic from a parsing diagnostic to a lexing diagnostic
and no longer forms a single token. The diagnostic behavior is slightly
worse as a result, but still seems acceptable.
Part of the reason this is coming up is because WG21 is considering
using ^^ as a token for reflection, so this token may come back in the
future.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list