[PATCH] D117994: [Clang] Implement multidimentional subscript operator

Corentin Jabot via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jan 23 10:05:24 PST 2022


cor3ntin created this revision.
Herald added a subscriber: carlosgalvezp.
cor3ntin requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added subscribers: cfe-commits, sstefan1.
Herald added projects: clang, clang-tools-extra.

Implement P2128R6 in C++23 mode.

Unlike GCC's implementation, this doesn't try
to recover when a user meant to use a comma expression.

Because the syntax changes meaning in C++23, the patch is
*NOT* implemented as an extension. Instead, declaring an array
with not exactly 1 parameter is an error in older languages
modes. There is an off-by-default extension warning in C++23 mode.

Unlike the standard, we supports default arguments;

Ie, we assume, based on conversations in WG21, that
the proposed resolution to CWG2507 will be accepted.

We allow arrays OpenMP sections and C++23 multidimensional array
to cohexist:

[a , b]   // multi dimensional array
[a : b]   // open mp section
[a, b, c] // error

The rest of the patch is relatively straight forward: we
take care to support arbitrary number of argument everywhere.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D117994

Files:
  clang-tools-extra/clang-tidy/modernize/LoopConvertUtils.cpp
  clang/docs/ReleaseNotes.rst
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/StmtPrinter.cpp
  clang/lib/Frontend/InitPreprocessor.cpp
  clang/lib/Parse/ParseExpr.cpp
  clang/lib/Sema/SemaAccess.cpp
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/SemaOverload.cpp
  clang/lib/Sema/TreeTransform.h
  clang/test/OpenMP/target_update_messages.cpp
  clang/test/Parser/cxx2b-subscript.cpp
  clang/test/SemaCXX/cxx2b-overloaded-operator.cpp
  clang/test/SemaTemplate/instantiate-subscript.cpp
  clang/www/cxx_status.html

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D117994.402347.patch
Type: text/x-patch
Size: 49125 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220123/f5c30310/attachment-0001.bin>


More information about the cfe-commits mailing list